apply plugin: 'groovy' apply plugin: 'maven' apply plugin: 'signing' configurations { gradleApi compile.extendsFrom gradleApi gradleApi.extendsFrom groovy } sourceSets { buildTest { groovy.srcDir file('src/build-test/groovy') resources.srcDir file('src/build-test/resources') } deviceTest { groovy.srcDir file('src/device-test/groovy') resources.srcDir file('src/device-test/resources') } } dependencies { gradleApi gradleApi() groovy localGroovy() compile project(':builder') testCompile 'junit:junit:3.8.1' buildTestCompile sourceSets.main.output buildTestCompile configurations.testCompile buildTestCompile sourceSets.test.output buildTestCompile configurations.testRuntime deviceTestCompile sourceSets.main.output deviceTestCompile configurations.testCompile deviceTestCompile sourceSets.test.output deviceTestCompile configurations.testRuntime } idea { module { testSourceDirs += files('src/build-test/groovy', 'src/device-test/groovy').files } } def getVersion() { if (project.has("release")) { return project.ext.baseVersion } return project.ext.baseVersion + '-SNAPSHOT' } version = getVersion() archivesBaseName = 'gradle' task publishLocal(type: Upload) { configuration = configurations.archives repositories { mavenDeployer { repository(url: uri("$rootDir/repo")) } } } publishLocal.dependsOn ':builder:publishLocal' task buildTest(type: Test, dependsOn: publishLocal) { testClassesDir = sourceSets.buildTest.output.classesDir classpath = sourceSets.buildTest.runtimeClasspath description = "Runs the project build tests. This requires an SDK either from the Android source tree, under out/..., or an env var ANDROID_HOME." group = "verification" systemProperties['jar.path'] = jar.archivePath } task deviceTest(dependsOn: publishLocal) { testClassesDir = sourceSets.deviceTest.output.classesDir classpath = sourceSets.deviceTest.runtimeClasspath description = "Runs the device tests. This requires a device." group = "verification" //systemProperties['jar.path'] = jar.archivePath } deviceTest.dependsOn buildTest check.dependsOn buildTest // uncomment when device tests are ready. //check.dependsOn deviceTest project.ext.sonatypeUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : "" project.ext.sonatypePassword = project.hasProperty('sonatypePassword') ? sonatypePassword : "" uploadArchives { repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> if (!project.has("release")) { throw new StopExecutionException("uploadArchives must be called with the release.gradle init script") } if (project.ext.sonatypeUsername.length() == 0 || project.ext.sonatypePassword.length() == 0) { throw new StopExecutionException("uploadArchives cannot be called without sonatype username and password") } signing.signPom(deployment) } repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { authentication(userName: project.ext.sonatypeUsername, password: project.ext.sonatypePassword) } pom.project { name 'Gradle Plug-in for Android' description 'Gradle plug-in to build Android applications.' url 'http://tools.android.com' inceptionYear '2007' licenses { license { name 'The Apache Software License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' distribution 'repo' } } scm { url "https://android.googlesource.com/platform/tools/build" connection "git://android.googlesource.com/platform/tools/build.git" } developers { developer { name 'The Android Open Source Project' } } } } } } // custom tasks for creating source/javadoc jars task sourcesJar(type: Jar, dependsOn:classes) { classifier = 'sources' from sourceSets.main.allSource } groovydoc { exclude "**/internal/**" includePrivate false docTitle "Gradle Plugin for Android" header "" footer "Copyright (C) 2012 The Android Open Source Project" overview "" } task javadocJar(type: Jar, dependsOn:groovydoc) { classifier 'javadoc' from groovydoc.destinationDir } // add javadoc/source jar tasks as artifacts artifacts { archives jar archives sourcesJar archives javadocJar } signing { required { project.has("release") && gradle.taskGraph.hasTask("uploadArchives") } sign configurations.archives }