Use the internal plugins to handle dependencies and publishing.
Change-Id: I70bb3e8d1ff7e5db2631a30365a601cc116844cc
diff --git a/build.gradle b/build.gradle
index 1e0e111..d55e0ad 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,26 @@
+buildscript {
+ repositories {
+ maven { url "$rootDir/../../prebuilts/tools/common/gradle-plugins/repository" }
+ }
+ dependencies {
+ classpath 'com.android.tools.internal:internal-plugins:1.0'
+ }
+}
+
+apply plugin: 'clone-artifacts'
+apply plugin: 'distrib'
+
+// artifact cloning destinations
+cloneArtifacts {
+ mainRepo = "$rootDir/../../prebuilts/tools/common/m2/repository"
+ secondaryRepo = "$rootDir/../../prebuilts/tools/common/m2/internal"
+}
+// set up the distribution destination
+distribution {
+ destinationPath = "$rootDir/../../prebuilts/devtools"
+ dependenciesRepo = cloneArtifacts.mainRepo
+}
+
// ext.androidHostOut is shared by all tools/{base,build,swt} gradle projects/
ext.androidHostOut = file("$rootDir/../../out/host/gradle")
ext.androidRootDir = file(new File(ext.androidHostOut, "../../../"))
@@ -19,12 +42,36 @@
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'findbugs'
+ apply plugin: 'distrib'
+ apply plugin: 'clone-artifacts'
repositories {
- mavenCentral()
+ maven { url = uri(rootProject.cloneArtifacts.mainRepo) }
+ maven { url = uri(rootProject.cloneArtifacts.secondaryRepo) }
maven { url = uri("$rootProject.ext.androidHostOut/repo") }
}
+ // find bug dependencies is added dynamically so it's hard for the
+ // clone artifact plugin to find it. This custom config lets us manually
+ // add such dependencies.
+ configurations {
+ hidden
+ }
+ dependencies {
+ hidden "com.google.code.findbugs:findbugs:2.0.1"
+ }
+
+ // configuration for swt dependency since the packaged jar is platform dependent
+ // but at compile time we don't care. Also we don't want the artifact in the
+ // main repo, so use the provided configuration
+ configurations {
+ swt
+ }
+
+ dependencies{
+ swt "com.android.external.eclipse:swt:3.5.0"
+ }
+
ext.baseVersion = '22.0'
version = getVersion(project, ext.baseVersion)
@@ -40,50 +87,6 @@
}
}
- project.ext.getClassPath = {
- String classPath = ""
- project.configurations.runtime.files.each { file ->
- String name = file.name
-
- // handle tools/base lib that don't have the -SNAPSHOT on them
- String versionPattern = "(.*)-${ext.baseVersion}-\\d+\\.\\d+-\\d+\\.jar"
- if (java.util.regex.Pattern.matches(versionPattern, name)) {
- name = name.replaceFirst(versionPattern, '$1.jar');
- } else {
- // now handle tools/swt libs with the -SNAPSHOT.
- String suffix = "-" + project.version + ".jar"
- if (name.endsWith(suffix)) {
- name = name.substring(0, name.size() - suffix.size()) + ".jar"
- } else if (name.equals("swt.jar")) {
- // now handle swt.jar which should be removed as we add this manually later.
- name = "";
- }
- }
-
- if (name.size() > 0) {
- classPath = classPath + " " + name
- }
- }
- return classPath
- }
-
- task prebuiltJar(type: Jar) {
- from(sourceSets.main.output)
- }
-
- if (project.hasProperty("prebuiltPath")) {
- prebuiltJar.destinationDir file(prebuiltPath)
- prebuiltJar.archiveName project.archivesBaseName + ".jar"
- }
-
- // delay computing the manifest classpath only if the
- // prebuiltJar task is set to run.
- project.gradle.taskGraph.whenReady { taskGraph ->
- if (taskGraph.hasTask(prebuiltJar)) {
- prebuiltJar.manifest.attributes("Class-Path": project.ext.getClassPath())
- }
- }
-
// add javadoc/source jar tasks as artifacts
artifacts {
archives jar
diff --git a/sdkuilib/build.gradle b/sdkuilib/build.gradle
index f4024f4..16e9078 100644
--- a/sdkuilib/build.gradle
+++ b/sdkuilib/build.gradle
@@ -9,14 +9,7 @@
compile 'org.apache.httpcomponents:httpclient:4.1.1'
compile 'org.apache.httpcomponents:httpmime:4.1'
- def prebuiltsToolsDir = "$rootProject.ext.androidRootDir/prebuilts/tools"
- compile files(
- "$prebuiltsToolsDir/common/eclipse/org.eclipse.jface_3.6.2.M20110210-1200.jar",
- "$prebuiltsToolsDir/common/eclipse/org.eclipse.equinox.common_3.6.0.v20100503.jar",
- "$prebuiltsToolsDir/common/eclipse/org.eclipse.core.commands_3.6.0.I20100512-1500.jar")
-
- // FIXME configure the host arch for swt
- compile files("$prebuiltsToolsDir/linux-x86/swt/swt.jar")
+ compile 'com.android.external.eclipse:org-eclipse-jface:3.6.2'
testCompile "com.android.tools.sdk:sdklib-test:$version"
testCompile 'junit:junit:3.8.1'
@@ -26,3 +19,7 @@
main.resources.srcDir 'src/main/java'
test.resources.srcDir 'src/test/java'
}
+
+// include swt for compilation
+sourceSets.main.compileClasspath += configurations.swt
+
diff --git a/swtmenubar/build.gradle b/swtmenubar/build.gradle
index 85b7479..bd602b1 100644
--- a/swtmenubar/build.gradle
+++ b/swtmenubar/build.gradle
@@ -1,13 +1,9 @@
-group = 'com.android.tools.sdk'
+group = 'com.android.tools'
archivesBaseName = 'swtmenubar'
dependencies {
compile "com.android.tools.sdk:sdklib:$version"
-
- def prebuiltsToolsDir = "$rootProject.ext.androidRootDir/prebuilts/tools"
- compile files("$prebuiltsToolsDir/common/eclipse/org.eclipse.jface_3.6.2.M20110210-1200.jar")
- // FIXME configure the host arch for swt
- compile files("$prebuiltsToolsDir/linux-x86/swt/swt.jar")
+ compile 'com.android.external.eclipse:org-eclipse-jface:3.6.2'
testCompile 'junit:junit:3.8.1'
}
@@ -19,3 +15,6 @@
// Also add the MacOS specific sources for SWT Cocoa
main.java.srcDir 'src/main-darwin/java'
}
+
+// include swt for compilation
+sourceSets.main.compileClasspath += configurations.swt