build.gradle #5

  • //
  • main/
  • guest/
  • tjuricek/
  • initializer/
  • build.gradle
  • View
  • Commits
  • Open Download .zip Download (4 KB)
// All dependencies and any plugin definitions should be set up and cached via
// artifactory.
buildscript {
    repositories {
        maven {
            url 'http://artifactory.bnr.perforce.com/artifactory/repos-p4oauth'
        }
    }
    dependencies {
        classpath('com.perforce.workshop.tjuricek:perforce-gradle-plugin:0.1.2')
        classpath('com.jfrog.bintray.gradle:gradle-bintray-plugin:0.3')
    }

}
repositories {
    maven {
        url 'http://artifactory.bnr.perforce.com/artifactory/repos-p4oauth'
    }
}


// See http://www.gradle.org/docs/current/userguide/gradle_wrapper.html
task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

apply plugin: 'perforce'
apply plugin: 'jbake'
apply plugin: 'java'
apply plugin: 'application'

version = '0.1.2'
group = 'com.perforce.workshop.tjuricek'

mainClassName = 'com.perforce.workshop.tjuricek.initializer.Initializer'

dependencies {
    compile('com.perforce.workshop.tjuricek:p4java_ext:0.1.1')
    compile('com.esotericsoftware.yamlbeans:yamlbeans:1.06')
    compile("com.fasterxml.jackson.core:jackson-databind:2.3.1")
    compile("com.github.spullara.mustache.java:compiler:0.8.12")
    compile('commons-io:commons-io:2.4')
    compile("org.apache.commons:commons-lang3:3.2.1")
}

jbake {
    input = file('src/site')
    output = file("docs/site")
}

javadoc {
    destinationDir = file("docs/javadoc")
    failOnError = false
}

// A fat jar variation would be useful most likely for any non-java folks.
//jar {
//    doFirst {
//        from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
//    }
//    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
//    manifest { attributes 'Main-Class': mainClassName }
//}

apply plugin: 'maven' // Note: mostly for local dependencies only

apply plugin: 'maven-publish'
apply plugin: 'bintray'

javadoc {
    failOnError = false
}

task fatJar(type: Jar, dependsOn: classes) {
    from files(sourceSets.main.output.classesDir)
    from files(sourceSets.main.output.resourcesDir)
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    archiveName = "initializer-complete.jar"
    manifest { attributes 'Main-Class': mainClassName }
    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

// add javadoc/source jar tasks as artifacts
artifacts {
    archives sourcesJar, javadocJar, fatJar
}

publishing {
    publications {
        mavenStuff(MavenPublication) {
            if (plugins.hasPlugin('war')) {
                from components.web
            } else {
                from components.java
            }

            artifact sourcesJar {
                classifier "sources"
            }

            artifact javadocJar {
                classifier "javadoc"
            }
        }
    }
}

if (hasProperty('bintrayUser') && hasProperty('bintrayKey')) {

    bintray {
        user = property('bintrayUser')
        key = property('bintrayKey')
        publications = ['mavenStuff']
        pkg {
            repo = 'maven'
            name = 'initializer'
            desc = 'Test data initialization system for Perforce server instances'
            licenses = ['BSD']
            labels = ['perforce', 'scm', 'p4java']
        }
//        dryRun = dry // whether to run this as dry-run, without deploying
    }
}
# Change User Description Committed
#5 9172 tjuricek 0.1.2 Added command line execution options and documentation to run the initializer locally.
#4 9165 tjuricek Some documentation framework and a fatjar style distribution for the initializer to run outside of a gradle plugin.

Upped the version to 0.1.2, but this may need some testing before it's really guaranteed to work in standalone mode
#3 9140 tjuricek 0.1.1 Fix NPE with client object cache, and update the perforce-gradle-plugin dependency
#2 9094 tjuricek Add maven plugin to distribute via the maven local repository for some local validation.
#1 9088 tjuricek 0.1.0 First version of the initializer.

This currently requires setting up a local version of the p4java_ext project, since that project is awating approval into the main jcenter repository.