diff options
author | Joshua Lang <joshualang@google.com> | 2016-02-18 14:20:01 -0800 |
---|---|---|
committer | Joshua Lang <joshualang@google.com> | 2016-03-15 02:41:44 -0700 |
commit | 6087de4c9ce7ae258fbb309fd9062a11f1aaeff3 (patch) | |
tree | dbe9c663923ad944f706cfdf2c8ea2c13e122aa5 | |
parent | a236f79886500f59700c6b2adb8186f0e412319b (diff) | |
download | buildSrc-6087de4c9ce7ae258fbb309fd9062a11f1aaeff3.tar.gz |
Adding debug file and zip target to sdk tools
Tool items now have a debug attribute that will place them in a
tools.debug root directory. The tools.debug directory will be zipped
separately and copied to the distribution directory for storage.
Also added an accessor to private itemPath so it would show up in
ToolItem's property map
Emulator uses this to store debug symbols that match the binaries
distributed in tools that will not be released.
Change-Id: I5cbc52554b8f91424a92b525211632c213dbf174
4 files changed, 43 insertions, 6 deletions
diff --git a/src/main/groovy/com/android/tools/internal/sdk/base/CopyToolItemsTask.groovy b/src/main/groovy/com/android/tools/internal/sdk/base/CopyToolItemsTask.groovy index 8509ce5..565f02c 100644 --- a/src/main/groovy/com/android/tools/internal/sdk/base/CopyToolItemsTask.groovy +++ b/src/main/groovy/com/android/tools/internal/sdk/base/CopyToolItemsTask.groovy @@ -33,11 +33,14 @@ class CopyToolItemsTask extends DefaultTask { File itemOutputDir + File itemDebugOutputDir + File noticeDir @TaskAction void copy() { File outDir = getItemOutputDir() + File outDebugDir = getItemDebugOutputDir() Project p = getProject() @@ -58,10 +61,17 @@ class CopyToolItemsTask extends DefaultTask { } } - File toFolder = outDir + File itemOutDir + if (item.getDebug()) { + itemOutDir = outDebugDir + } else { + itemOutDir = outDir + } + File toFolder = itemOutDir + String destinationPath = item.getDestinationPath() if (destinationPath != null) { - toFolder = new File(outDir, destinationPath)//.replace('/', File.separatorChar)) + toFolder = new File(itemOutDir, destinationPath)//.replace('/', File.separatorChar)) toFolder.mkdirs() } @@ -72,14 +82,14 @@ class CopyToolItemsTask extends DefaultTask { } if (noticeFile != null) { - linkNoticeToFiles(noticeToFilesMap, noticeFile, outDir, Collections.singletonList(toFile)) + linkNoticeToFiles(noticeToFilesMap, noticeFile, itemOutDir, Collections.singletonList(toFile)) } } else if (sourceFile.isDirectory()) { List<File> toFiles = copyFolderItems(sourceFile, toFolder, item.getFlatten()) if (noticeFile != null) { - linkNoticeToFiles(noticeToFilesMap, noticeFile, outDir, toFiles) + linkNoticeToFiles(noticeToFilesMap, noticeFile, itemOutDir, toFiles) } } else { throw new RuntimeException("Missing sdk-files: ${sourceFile}") diff --git a/src/main/groovy/com/android/tools/internal/sdk/base/SdkFilesPlugin.groovy b/src/main/groovy/com/android/tools/internal/sdk/base/SdkFilesPlugin.groovy index a5bbbed..c1fef30 100644 --- a/src/main/groovy/com/android/tools/internal/sdk/base/SdkFilesPlugin.groovy +++ b/src/main/groovy/com/android/tools/internal/sdk/base/SdkFilesPlugin.groovy @@ -63,6 +63,7 @@ class SdkFilesPlugin extends BaseSdkPlugin implements Plugin<Project> { copySdkToolsFiles.items = platform.items copySdkToolsFiles.itemOutputDir = new File(getSdkRoot(), platform.name + File.separatorChar + "tools") + copySdkToolsFiles.itemDebugOutputDir = new File(getSdkRoot(), platform.name + File.separatorChar + "tools.debug") copySdkToolsFiles.noticeDir = new File(project.buildDir, "sdk/notices") copySdkToolsFiles.dependsOn platform.builtBy diff --git a/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy b/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy index c17e574..df24e9d 100644 --- a/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy +++ b/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy @@ -58,6 +58,7 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> { File root = new File(getSdkRoot(), platformName); File sdkRoot = new File(root, "tools") + File sdkDebugRoot = new File(root, "tools.debug") Task makeTask = project.tasks.create("make${platformName.capitalize()}Sdk") @@ -65,6 +66,8 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> { cleanFolder.doFirst { sdkRoot.deleteDir() sdkRoot.mkdirs() + sdkDebugRoot.deleteDir() + sdkDebugRoot.mkdirs() } final String copyTaskName = "copy${platformName.capitalize()}SdkToolsFiles" @@ -79,21 +82,30 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> { zipFiles.from(sdkRoot) zipFiles.destinationDir = project.ext.androidHostDist + Zip zipDebugFiles = project.tasks.create("zip${platformName.capitalize()}DebugSdk", Zip) + zipDebugFiles.from(sdkDebugRoot) + zipDebugFiles.destinationDir = project.ext.androidHostDist + String buildNumber = System.getenv("BUILD_NUMBER") String zipName + String zipDebugName if (buildNumber == null) { zipName = "sdk-repo-$plaformPkgName-tools.zip" + zipDebugName = "sdk-repo-$plaformPkgName-debug-tools.zip" } else { zipName = "sdk-repo-$plaformPkgName-tools-${buildNumber}.zip" + zipDebugName = "sdk-repo-$plaformPkgName-debug-tools-${buildNumber}.zip" } zipFiles.setArchiveName(zipName) zipFiles.mustRunAfter copyFiles + zipDebugFiles.setArchiveName(zipDebugName) + zipDebugFiles.mustRunAfter cleanFolder + makeTask.description = "Packages the ${platformName.capitalize()} SDK Tools" makeTask.group = "Android SDK" - makeTask.dependsOn cleanFolder, copyFiles, zipFiles - + makeTask.dependsOn cleanFolder, copyFiles, zipFiles, zipDebugFiles project.afterEvaluate { List<Task> copyTasks = Lists.newArrayList() diff --git a/src/main/groovy/com/android/tools/internal/sdk/base/ToolItem.groovy b/src/main/groovy/com/android/tools/internal/sdk/base/ToolItem.groovy index 3c93bbd..062fd8c 100644 --- a/src/main/groovy/com/android/tools/internal/sdk/base/ToolItem.groovy +++ b/src/main/groovy/com/android/tools/internal/sdk/base/ToolItem.groovy @@ -38,6 +38,7 @@ class ToolItem { private String name private boolean flatten = false private boolean executable = false + private boolean debug = false private String sourcePath @@ -57,6 +58,10 @@ class ToolItem { this.notice = notice } + void debug(boolean b) { + this.debug = b + } + void executable(boolean b) { this.executable = b } @@ -110,6 +115,10 @@ class ToolItem { return destinationPath } + Object getItemPath() { + return itemPath + } + String getName() { return name } @@ -122,6 +131,10 @@ class ToolItem { return flatten } + boolean getDebug() { + return debug + } + boolean getExecutable() { return executable } @@ -142,6 +155,7 @@ class ToolItem { ", name='" + name + '\'' + ", flatten=" + flatten + ", executable=" + executable + + ", debug=" + debug + '}'; } } |