aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Baker-Malone <jbakermalone@google.com>2016-09-02 15:33:46 -0700
committerJoe Baker-Malone <jbakermalone@google.com>2016-10-25 13:23:45 -0700
commit71d6d8665992ca8a298e5526be53ca2d5cb40aa0 (patch)
treeafe4625171a2f46e848dbd4f1edacd594301e46d
parent3654fc4aa8c262a50823548d1309e301ac403c1a (diff)
downloadbuildSrc-71d6d8665992ca8a298e5526be53ca2d5cb40aa0.tar.gz
Removing stuff not needed for emulator-only sdk build
Change-Id: I9404b94f8440dd168b7a005d53941202c36f7c22
-rw-r--r--base/baseJava.gradle45
-rw-r--r--base/build.gradle49
-rw-r--r--base/javadoc.gradle20
-rw-r--r--base/settings.gradle116
-rwxr-xr-xservers/build_tools.sh7
-rwxr-xr-xservers/mk_sdk_repo_xml.sh466
-rw-r--r--src/main/groovy/com/android/tools/internal/sdk/base/SdkEmulatorPlugin.groovy (renamed from src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy)22
-rw-r--r--src/main/groovy/com/android/tools/internal/sdk/base/SdkFilesPlugin.groovy4
-rw-r--r--src/main/resources/META-INF/gradle-plugins/sdk-emulator.properties1
-rw-r--r--src/main/resources/META-INF/gradle-plugins/sdk-tools.properties1
10 files changed, 16 insertions, 715 deletions
diff --git a/base/baseJava.gradle b/base/baseJava.gradle
deleted file mode 100644
index 116a83f..0000000
--- a/base/baseJava.gradle
+++ /dev/null
@@ -1,45 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'clone-artifacts'
-apply plugin: 'maven'
-
-repositories {
- maven { url = uri(rootProject.cloneArtifacts.repository) }
-}
-
-test {
- // todo: disable this for CI since we'll use the CI UI to do the report.
- reports.html.enabled = true
-}
-
-apply from: "$rootDir/buildSrc/base/base.gradle"
-
-task publishLocal(type: Upload) {
- configuration = configurations.archives
- repositories {
- mavenDeployer {
- repository(url: uri("$rootProject.ext.localRepo"))
- pom.project {
- 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/base'
- connection 'git://android.googlesource.com/platform/tools/base.git'
- }
- developers {
- developer {
- name 'The Android Open Source Project'
- }
- }
- }
- }
- }
-}
diff --git a/base/build.gradle b/base/build.gradle
index 8070bbe..67d2f8e 100644
--- a/base/build.gradle
+++ b/base/build.gradle
@@ -1,46 +1,8 @@
-apply plugin: 'clone-artifacts'
-
-// Currently, the minimum requirement to run Android SDK tools is Java 1.6
-// So make sure that we are compiling with 1.6
-task('checkJavaVersion') << {
- def jvmVersion = System.getProperty('java.version')
- def requiredVersion = System.getenv('JAVA_FOR_TESTS') ?: '1.6'
- if (!jvmVersion.startsWith(requiredVersion)) {
- throw new RuntimeException("Tools need to be compiled with Java $requiredVersion, you are using Java $jvmVersion.")
- }
-}
-final def checkJavaVersionTask = tasks['checkJavaVersion']
-
allprojects { subproject ->
tasks.withType(JavaForkOptions) {
// Prevent forked processes from stealing focus (on MacOS at least)
jvmArgs '-Djava.awt.headless=true'
}
-
- afterEvaluate {
- // Only check if we are doing build type tasks. Things like dependency listing
- // should still work with a "wrong" java version.
- final def buildTasks = ['build', 'compileJava', 'compileGroovy', 'classes', 'assemble', 'javadoc', 'groovydoc', 'check']
- // Task.doFirst does not run if the task has no work to do. Need to be more aggressive than that.
- // Some projects won't have all of these tasks, so need to use findByName.
- buildTasks.each { subproject.tasks.findByName(it)?.dependsOn(checkJavaVersionTask) }
- }
-}
-
-// artifact cloning destinations
-cloneArtifacts {
- repository = "$rootDir/../prebuilts/tools/common/m2/repository"
-}
-
-if (System.env.USE_EXTERNAL_REPO != null) {
- allprojects {
- repositories {
- maven { url = uri(rootProject.cloneArtifacts.repository) }
- jcenter()
- maven { url 'https://repo.gradle.org/gradle/libs-snapshots-local' }
- maven { url 'https://repo.gradle.org/gradle/libs-releases-local' }
- }
- }
}
/*
@@ -63,10 +25,8 @@ if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
// rootProject.buildDir is specific to this gradle build.
buildDir = new File(ext.androidHostOut, "build/root")
-
// apply this after the buildDir has been changed.
-apply plugin: 'sdk-tools'
-
+apply plugin: 'sdk-emulator'
ext.localRepo = project.hasProperty('localRepo') ? localRepo : "$ext.androidHostOut/repo"
@@ -126,8 +86,6 @@ task setupGradleInIde << {
task dist << {
}
-apply plugin: 'offline-repo'
-
task clean << {
delete 'build'
@@ -143,9 +101,4 @@ task init {
dependsOn prepareRepo
dependsOn setupGradleInIde
dependsOn copyGradleProperty
- Task constants = tasks.findByPath(':base:builder:generateVersionConstantsJava')
- if (constants != null) {
- dependsOn constants
- }
}
-
diff --git a/base/javadoc.gradle b/base/javadoc.gradle
deleted file mode 100644
index 5db0c48..0000000
--- a/base/javadoc.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-javadoc {
- exclude "**/internal/**"
- options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
- options.encoding = "UTF-8"
-
- title project.ext.pomName
-}
-
-task javadocJar(type: Jar, dependsOn:javadoc) {
- classifier 'javadoc'
- from javadoc.destinationDir
-}
-
-// Only package JavaDoc if using --init-script=buildSrc/base/release.gradle
-if (project.has("release")) {
- // add javadoc jar tasks as artifacts
- artifacts {
- archives javadocJar
- }
-}
diff --git a/base/settings.gradle b/base/settings.gradle
index 0b5fd55..72309a9 100644
--- a/base/settings.gradle
+++ b/base/settings.gradle
@@ -1,122 +1,6 @@
-include ':base:annotations'
-include ':base:api-generator'
-include ':base:ant-tasks'
-include ':base:archquery'
-include ':base:asset-studio'
-include ':base:common'
-include ':base:docs'
-include ':base:ddmlib'
-include ':base:perflib'
-include ':base:chartlib'
-include ':base:draw9patch'
-include ':base:dvlib'
-include ':base:jobb'
-include ':base:layoutlib-api'
-include ':base:lint'
-include ':base:lint-api'
-include ':base:lint-checks'
-include ':base:lint-tests'
-include ':base:manifest-merger'
-include ':base:ninepatch'
-include ':base:rule-api'
-include ':base:screenshot2'
-include ':base:sdk-common'
-include ':base:sdklib'
-include ':base:sdklib-test'
-include ':base:testutils'
-include ':base:gradle-import'
-
-include ':base:profile'
-include ':base:builder-model'
-include ':base:builder-test-api'
-include ':base:builder'
-include ':base:gradle-model'
-include ':base:gradle-core'
-include ':base:gradle'
-include ':base:gradle-experimental'
-include ':base:integration-test'
-include ':base:project-test-lib'
-include ':base:project-test'
-include ':base:google-services'
-
-include ':base:templates'
-
-include ':base:jack:jack-api'
-include ':base:jack:jill-api'
-
-project(':base:api-generator' ).projectDir = new File(rootDir, 'base/misc/api-generator')
-project(':base:ant-tasks' ).projectDir = new File(rootDir, 'base/legacy/ant-tasks')
-project(':base:archquery' ).projectDir = new File(rootDir, 'base/legacy/archquery')
-project(':base:dvlib' ).projectDir = new File(rootDir, 'base/device_validator/dvlib')
-project(':base:lint' ).projectDir = new File(rootDir, 'base/lint/cli')
-project(':base:lint-api' ).projectDir = new File(rootDir, 'base/lint/libs/lint-api')
-project(':base:lint-checks' ).projectDir = new File(rootDir, 'base/lint/libs/lint-checks')
-project(':base:lint-tests' ).projectDir = new File(rootDir, 'base/lint/libs/lint-tests')
-project(':base:screenshot2' ).projectDir = new File(rootDir, 'base/misc/screenshot2')
-project(':base:sdklib-test' ).projectDir = new File(rootDir, 'base/sdklib')
-project(':base:sdklib-test' ).buildFileName = 'test.gradle'
-
-project(':base:profile' ).projectDir = new File(rootDir, 'base/build-system/profile')
-project(':base:builder-model' ).projectDir = new File(rootDir, 'base/build-system/builder-model')
-project(':base:builder-test-api' ).projectDir = new File(rootDir, 'base/build-system/builder-test-api')
-project(':base:builder' ).projectDir = new File(rootDir, 'base/build-system/builder')
-project(':base:docs' ).projectDir = new File(rootDir, 'base/build-system/docs')
-project(':base:manifest-merger' ).projectDir = new File(rootDir, 'base/build-system/manifest-merger')
-project(':base:gradle-core' ).projectDir = new File(rootDir, 'base/build-system/gradle-core')
-project(':base:gradle' ).projectDir = new File(rootDir, 'base/build-system/gradle')
-project(':base:gradle-experimental').projectDir = new File(rootDir, 'base/build-system/gradle-experimental')
-project(':base:integration-test' ).projectDir = new File(rootDir, 'base/build-system/integration-test')
-project(':base:project-test-lib' ).projectDir = new File(rootDir, 'base/build-system/project-test-lib')
-project(':base:project-test' ).projectDir = new File(rootDir, 'base/build-system/project-test')
-project(':base:google-services' ).projectDir = new File(rootDir, 'base/build-system/google-services')
-
-include ':swt:chimpchat'
-include ':swt:ddms'
-include ':swt:ddmuilib'
-include ':swt:hierarchyviewer2'
-include ':swt:hierarchyviewer2lib'
-include ':swt:monkeyrunner'
-include ':swt:sdkmanager'
-include ':swt:sdkuilib'
-include ':swt:sdkstats'
-include ':swt:swtmenubar'
-include ':swt:traceview'
-include ':swt:uiautomatorviewer'
-
-project(':swt:ddms' ).projectDir = new File(rootDir, 'swt/ddms/app')
-project(':swt:ddmuilib' ).projectDir = new File(rootDir, 'swt/ddms/ddmuilib')
-project(':swt:hierarchyviewer2' ).projectDir = new File(rootDir, 'swt/hierarchyviewer2/app')
-project(':swt:hierarchyviewer2lib').projectDir = new File(rootDir, 'swt/hierarchyviewer2/hierarchyviewer2lib')
-project(':swt:sdkmanager' ).projectDir = new File(rootDir, 'swt/sdkmanager/app')
-project(':swt:sdkuilib' ).projectDir = new File(rootDir, 'swt/sdkmanager/sdkuilib')
-
-
-include ':sdk'
-project(':sdk').projectDir = new File(rootDir.getParentFile(), "sdk")
-
-include ':sdk:annotations'
-project(':sdk:annotations').projectDir = new File(rootDir.getParentFile(), "sdk/annotations")
-
-include ':sdk:find-java'
-project(':sdk:find-java').projectDir = new File(rootDir.getParentFile(), "sdk/find_java")
-
-include ':sdk:avdlauncher'
-project(':sdk:avdlauncher').projectDir = new File(rootDir.getParentFile(), "sdk/avdlauncher")
-
-include ':sdk:eclipse:monitor'
-project(':sdk:eclipse:monitor').projectDir = new File(rootDir.getParentFile(), "sdk/eclipse/monitor")
-
-include ':sdk:sdklauncher'
-project(':sdk:sdklauncher').projectDir = new File(rootDir.getParentFile(), "sdk/sdklauncher")
-
include ':emulator'
project(':emulator').projectDir = new File(rootDir.getParentFile(), "external/qemu")
include ':mksdcard'
project(':mksdcard').projectDir = new File(rootDir.getParentFile(), "sdk/emulator/mksdcard")
-include ':external:fat32lib'
-
-include ':external:emma'
-project(':external:emma').projectDir = new File(rootDir.getParentFile(), "external/emma")
-
diff --git a/servers/build_tools.sh b/servers/build_tools.sh
index f9b324d..f066d33 100755
--- a/servers/build_tools.sh
+++ b/servers/build_tools.sh
@@ -51,13 +51,8 @@ cd "$PROG_DIR"
GRADLE_FLAGS="--no-daemon --info"
-# first build Eclipse/Monitor
( set -x ; OUT_DIR="$OUT_DIR" DIST_DIR="$DIST_DIR" BUILD_NUMBER="$BNUM" ../../gradlew -b ../../build.gradle $GRADLE_FLAGS publishLocal ) || exit $?
-( set -x ; OUT_DIR="$OUT_DIR" DIST_DIR="$DIST_DIR" BUILD_NUMBER="$BNUM" ../../gradlew -b ../../../sdk/eclipse/build.gradle $GRADLE_FLAGS copydeps buildEclipse ) || exit $?
# temp disable --parallel builds
#OUT_DIR="$OUT_DIR" DIST_DIR="$DIST_DIR" ../../gradlew -b ../../build.gradle --parallel-threads="${NUM_THREADS:-47}" $GRADLE_FLAGS makeSdk
-( set -x ; OUT_DIR="$OUT_DIR" DIST_DIR="$OUT_DIR/emu-only-dist" BUILD_NUMBER="$BNUM" ../../gradlew --stacktrace -b ../../build.gradle -c ../../settings-emu-only.gradle $GRADLE_FLAGS $TARGET ) || exit $?
-( set -x ; OUT_DIR="$OUT_DIR" DIST_DIR="$DIST_DIR" BUILD_NUMBER="$BNUM" ../../gradlew -b ../../build.gradle $GRADLE_FLAGS dist makeSdk ) || exit $?
-
-for i in `find "$OUT_DIR"/emu-only-dist/*.zip`; do cp $i "$DIST_DIR"/$(basename $(echo $i|sed 's/\.zip/-emu-only.zip/'));done
+( set -x ; OUT_DIR="$OUT_DIR" DIST_DIR="$DIST_DIR" BUILD_NUMBER="$BNUM" ../../gradlew -b ../../build.gradle $GRADLE_FLAGS $TARGET ) || exit $?
diff --git a/servers/mk_sdk_repo_xml.sh b/servers/mk_sdk_repo_xml.sh
deleted file mode 100755
index 3fad505..0000000
--- a/servers/mk_sdk_repo_xml.sh
+++ /dev/null
@@ -1,466 +0,0 @@
-#!/bin/bash
-#
-# Generates an SDK Repository XML based on the input files.
-
-set -e
-
-PROG_DIR=$(dirname $0)
-
-TYPES="tool platform-tool build-tool platform sample doc add-on system-image source support"
-OSES="linux macosx windows any linux-x86 darwin"
-
-TMP_DIR=$(mktemp -d -t sdkrepo.tmp.XXXXXXXX)
-trap "rm -rf $TMP_DIR" EXIT
-
-function debug() {
- echo "DEBUG: " $@ > /dev/stderr
-}
-
-function error() {
- echo "*** ERROR: " $@
- usage
-}
-
-function usage() {
- cat <<EOFU
-Usage: $0 output.xml xml-schema [type [os zip[:dest]]*...]*
-where:
-- schema is one of 'repository' or 'addon'
-- type is one of ${TYPES// /, } (or their plural).
-- os is one of ${OSES// /, }.
-There can be more than one zip for the same type
-as long as they use different OSes.
-Zip can be in the form "source:dest" to be renamed on the fly.
-EOFU
- exit 1
-}
-
-# Validate the tools we need
-if [[ ! -x $(which sha1sum) ]]; then
- error "Missing tool: sha1sum (Linux: apt-get install coreutils; Mac: port install md5sha1sum)"
-fi
-
-# Parse input params
-OUT="$1"
-[[ -z "$OUT" ]] && error "Missing output.xml name."
-shift
-
-# Get the schema filename. E.g. ".../.../sdk-repository-10.xsd". Can be relative or absolute.
-SCHEMA="$1"
-[[ ! -f "$SCHEMA" ]] && error "Invalid XML schema name: $SCHEMA."
-shift
-
-# Get XML:NS for SDK from the schema
-# This will be something like "http://schemas.android.com/sdk/android/addon/3"
-XMLNS=$(sed -n '/xmlns:sdk="/s/.*"\(.*\)".*/\1/p' "$SCHEMA")
-[[ -z "$XMLNS" ]] && error "Failed to find xmlns:sdk in $SCHEMA."
-echo "## Using xmlns:sdk=$XMLNS"
-
-# Extract the schema version number from the XMLNS, e.g. it would extract "3"
-XSD_VERSION="${XMLNS##*/}"
-
-# Get the root element from the schema. This is the first element
-# which name starts with "sdk-" (e.g. sdk-repository, sdk-addon)
-ROOT=$(sed -n -e '/xsd:element.*name="sdk-/s/.*name="\(sdk-[^"]*\)".*/\1/p' "$SCHEMA")
-[[ -z "$ROOT" ]] && error "Failed to find root element in $SCHEMA."
-echo "## Using root element $ROOT"
-
-# Generate XML header
-cat > "$OUT" <<EOFH
-<?xml version="1.0"?>
-<sdk:$ROOT
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sdk="$XMLNS">
-EOFH
-
-# check_enum value value1 value2 value3...
-# returns valueN if matched or nothing.
-function check_enum() {
- local VALUE="$1"
- local i
- shift
- for i in "$@"; do
- if [[ "$i" == "$VALUE" ]]; then
- echo "$VALUE"
- break;
- fi
- done
-}
-
-# Definition of the attributes we read from source.properties or manifest.ini
-# files and the equivalent XML element being generated.
-
-ATTRS=(
- # Columns:
- # --------------------------+------------------------+----------------------
- # Name read from | XML element written | Min-XSD version
- # source.properties | to repository.xml | where XML can be used
- # --------------------------+------------------------+----------------------
- # from source.properties for repository.xml packages
- Pkg.Revision revision 1
- Pkg.Desc description 1
- Platform.Version version 1
- AndroidVersion.ApiLevel api-level 1
- AndroidVersion.CodeName codename 1
- Platform.IncludedAbi included-abi 5
- Platform.MinToolsRev min-tools-rev 1
- Platform.MinPlatformToolsRev min-platform-tools-rev 3
- Sample.MinApiLevel min-api-level 2
- Layoutlib.Api layoutlib/api 4
- Layoutlib.Revision layoutlib/revision 4
- # from source.properties for addon.xml packages
- # (note that vendor is mapped to different XML elements based on the XSD version)
- Extra.VendorDisplay vendor-display 4
- Extra.VendorId vendor-id 4
- Extra.Vendor vendor-id 4
- Extra.Vendor vendor 1
- Extra.NameDisplay name-display 4
- Extra.Path path 1
- Extra.OldPaths old-paths 3
- Extra.MinApiLevel min-api-level 2
- # for system-image
- SystemImage.Abi abi r:3,s:1
- SystemImage.TagId tag-id r:9,s:2
- SystemImage.TagDisplay tag-display r:9,s:2
- # from addon manifest.ini for addon.xml packages
- # (note that vendor/name are mapped to different XML elements based on the XSD version)
- vendor-id vendor-id 4
- vendor-display vendor-display 4
- vendor vendor-display 4
- vendor vendor 1
- name-id name-id 4
- name-display name-display 4
- name name-display 4
- name name 1
- description description 1
- api api-level 1
- version revision 1
- revision revision 1
-)
-
-# Start with repo-10, addon-7 and sys-img-3, we don't encode the os/arch
-# in the <archive> attributes anymore. Instead we have separate elements.
-
-function uses_new_host_os() {
- if [[ "$ROOT" == "sdk-repository" && "$XSD_VERSION" -ge "10" ]]; then return 0; fi
- if [[ "$ROOT" == "sdk-addon" && "$XSD_VERSION" -ge "7" ]]; then return 0; fi
- if [[ "$ROOT" == "sdk-sys-img" && "$XSD_VERSION" -ge "3" ]]; then return 0; fi
- return 1
-}
-
-ATTRS_ARCHIVE=(
- Archive.HostOs host-os 1
- Archive.HostBits host-bits 1
- Archive.JvmBits jvm-bits 1
- Archive.MinJvmVers min-jvm-version 1
-)
-
-
-# Starting with XSD repo-7 and addon-5, some revision elements are no longer just
-# integers. Instead they are in major.minor.micro.preview format. This defines
-# which elements. This depends on the XSD root element and the XSD version.
-#
-# Note: addon extra revision can't take a preview number. We don't enforce
-# this in this script. Instead schema validation will fail if the extra
-# source.property declares an RC and it gets inserted in the addon.xml here.
-
-if [[ "$ROOT" == "sdk-repository" && "$XSD_VERSION" -ge 7 ]] ||
- [[ "$ROOT" == "sdk-addon" && "$XSD_VERSION" -ge 5 ]]; then
-FULL_REVISIONS=(
- tool revision
- build-tool revision
- platform-tool revision
- extra revision
- @ min-tools-rev
- @ min-platform-tools-rev
-)
-else
-FULL_REVISIONS=()
-fi
-
-
-# Parse all archives.
-
-function needs_full_revision() {
- local PARENT="$1"
- local ELEMENT="$2"
- shift
- shift
- local P E
-
- while [[ "$1" ]]; do
- P=$1
- E=$2
- if [[ "$E" == "$ELEMENT" ]] && [[ "$P" == "@" || "$P" == "$PARENT" ]]; then
- return 0 # true
- fi
- shift
- shift
- done
-
- return 1 # false
-}
-
-# Parses and print a full revision in the form "1.2.3 rc4".
-# Note that the format requires to have 1 space before the
-# optional "rc" (e.g. '1 rc4', not '1rc4') and no space after
-# the rc (so not '1 rc 4' either)
-function write_full_revision() {
- local VALUE="$1"
- local EXTRA_SPACE="$2"
- local KEYS="major minor micro preview"
- local V K
-
- while [[ -n "$VALUE" && -n "$KEYS" ]]; do
- # Take 1st segment delimited by . or space
- V="${VALUE%%[. ]*}"
-
- # Print it
- if [[ "${V:0:2}" == "rc" ]]; then
- V="${V:2}"
- K="preview"
- KEYS=""
- else
- K="${KEYS%% *}"
- fi
-
- if [[ -n "$V" && -n "$K" ]]; then
- echo "$EXTRA_SPACE <sdk:$K>$V</sdk:$K>"
- fi
-
- # Take the rest.
- K="${KEYS#* }"
- if [[ "$K" == "$KEYS" ]]; then KEYS=""; else KEYS="$K"; fi
- V="${VALUE#*[. ]}"
- if [[ "$V" == "$VALUE" ]]; then VALUE=""; else VALUE="$V"; fi
- done
-}
-
-
-function parse_attributes() {
- local PROPS="$1"
- shift
- local RESULT=""
- local VALUE
- local REV
- local USED
- local S
-
- # Get the first letter of the schema name (e.g. sdk-repo => 'r')
- # This can be r, a or s and would match the min-XSD per-schema value
- # in the ATTRS list.
- S=$(basename "$SCHEMA")
- S="${S:4:1}"
-
- # $1 here is the ATTRS list above.
- while [[ "$1" ]]; do
- # Check the version in which the attribute was introduced and
- # ignore things which are too *new* for this schema. This lets
- # us generate old schemas for backward compatibility purposes.
- SRC=$1
- DST=$2
- REV=$3
-
- if [[ $REV =~ ([ras0-9:,]+,)?$S:([0-9])(,.*)? ]]; then
- # Per-schema type min-XSD revision. Format is "[<type>:rev],*]
- # where type is one of r, a or s matching $S above.
- REV="${BASH_REMATCH[2]}"
- fi
-
- if [[ ( $REV =~ ^[0-9]+ && $XSD_VERSION -ge $REV ) || $XSD_VERSION == $REV ]]; then
- # Parse the property, if present. Any space is replaced by @
- VALUE=$( grep "^$SRC=" "$PROPS" | cut -d = -f 2 | tr ' ' '@' | tr -d '\r' )
- if [[ -n "$VALUE" ]]; then
- # In case an XML element would be mapped multiple times,
- # only use its first definition.
- if [[ "${USED/$DST/}" == "$USED" ]]; then
- USED="$USED $DST"
- RESULT="$RESULT $DST $VALUE"
- fi
- fi
- fi
- shift
- shift
- shift
- done
-
- echo "$RESULT"
-}
-
-function output_attributes() {
- local ELEMENT="$1"
- local OUT="$2"
- shift
- shift
- local KEY VALUE
- local NODE LAST_NODE EXTRA_SPACE
-
- while [[ "$1" ]]; do
- KEY="$1"
- VALUE="${2//@/ }"
- NODE="${KEY%%/*}"
- KEY="${KEY##*/}"
- if [[ "$NODE" == "$KEY" ]]; then
- NODE=""
- EXTRA_SPACE=""
- fi
- if [[ "$NODE" != "$LAST_NODE" ]]; then
- EXTRA_SPACE=" "
- [[ "$LAST_NODE" ]] && echo " </sdk:$LAST_NODE>" >> "$OUT"
- LAST_NODE="$NODE"
- [[ "$NODE" ]] && echo " <sdk:$NODE>" >> "$OUT"
- fi
- if needs_full_revision "$ELEMENT" "$KEY" ${FULL_REVISIONS[@]}; then
- echo "$EXTRA_SPACE <sdk:$KEY>" >> "$OUT"
- write_full_revision "$VALUE" "$EXTRA_SPACE" >> "$OUT"
- echo "$EXTRA_SPACE </sdk:$KEY>" >> "$OUT"
- else
- echo "$EXTRA_SPACE <sdk:$KEY>$VALUE</sdk:$KEY>" >> "$OUT"
- fi
- shift
- shift
- done
- if [[ "$LAST_NODE" ]]; then echo " </sdk:$LAST_NODE>" >> "$OUT"; fi
-}
-
-while [[ -n "$1" ]]; do
- # Process archives.
- # First we expect a type. For convenience the type can be plural.
- TYPE=$(check_enum "${1%%s}" $TYPES)
- [[ -z $TYPE ]] && error "Unknown archive type '$1'."
- shift
-
- ELEMENT="$TYPE"
- # The element name is different for extras:
- [[ "$TYPE" == "support" ]] && ELEMENT="extra"
-
- MAP=""
- FIRST="1"
- LIBS_XML=""
-
- OS=$(check_enum "$1" $OSES)
- while [[ $OS ]]; do
- shift
- [[ $OS == "linux-x86" ]] && OS=linux
- [[ $OS == "darwin" ]] && OS=macosx
-
- SRC="$1"
- DST="$1"
- if [[ "${SRC/:/}" != "$SRC" ]]; then
- DST="${SRC/*:/}"
- SRC="${SRC/:*/}"
- fi
- [[ ! -f "$SRC" ]] && error "Missing file for archive $TYPE/$OS: $SRC"
- shift
-
- # Depending on the archive type, we need a number of attributes
- # from the source.properties or the manifest.ini. We'll take
- # these attributes from the first zip found.
- #
- # What we need vs. which package uses it:
- # - description all
- # - revision all
- # - version platform
- # - included-abi platform
- # - api-level platform sample doc add-on system-image
- # - codename platform sample doc add-on system-image
- # - min-tools-rev platform sample
- # - min-platform-tools-rev tool
- # - min-api-level extra
- # - vendor extra add-on
- # - path extra
- # - old-paths extra
- # - abi system-image
- #
- # We don't actually validate here.
- # Just take whatever is defined and put it in the XML.
- # XML validation against the schema will be done at the end.
-
- if [[ $FIRST ]]; then
- FIRST=""
-
- if unzip -t "$SRC" | grep -qs "source.properties" ; then
- # Extract Source Properties
- # unzip: -j=flat (no dirs), -q=quiet, -o=overwrite, -d=dest dir
- unzip -j -q -o -d "$TMP_DIR" "$SRC" "*/source.properties"
- PROPS="$TMP_DIR/source.properties"
-
- elif unzip -t "$SRC" | grep -qs "manifest.ini" ; then
- unzip -j -q -o -d "$TMP_DIR" "$SRC" "*/manifest.ini"
- PROPS="$TMP_DIR/manifest.ini"
-
- # Parse the libs for an addon and generate the <libs> node
- # libraries is a semi-colon separated list
- LIBS=$(parse_attributes "$PROPS" "libraries")
- LIBS_XML=" <sdk:libs>"
- for LIB in ${LIBS//;/ }; do
- LIBS_XML="$LIBS_XML
- <sdk:lib><sdk:name>$LIB</sdk:name></sdk:lib>"
- done
- LIBS_XML="$LIBS_XML
- </sdk:libs>"
-
- else
- error "Failed to find source.properties or manifest.ini in $SRC"
- fi
-
- [[ ! -f $PROPS ]] && error "Failed to extract $PROPS from $SRC"
- MAP=$(parse_attributes "$PROPS" ${ATTRS[@]})
-
- # Time to generate the XML for the package
- echo " <sdk:${ELEMENT}>" >> "$OUT"
- output_attributes "$ELEMENT" "$OUT" $MAP
- [[ -n "$LIBS_XML" ]] && echo "$LIBS_XML" >> "$OUT"
- echo " <sdk:archives>" >> "$OUT"
- fi
-
- # Generate archive info
- echo "## Add $TYPE/$OS archive $SRC"
- if [[ $( uname ) == "Darwin" ]]; then
- SIZE=$( stat -f %z "$SRC" )
- else
- SIZE=$( stat -c %s "$SRC" )
- fi
- SHA1=$( sha1sum "$SRC" | cut -d " " -f 1 )
-
- if uses_new_host_os ; then
- USE_HOST_OS=1
- else
- OLD_OS_ATTR=" os='$OS'"
- fi
-
- cat >> "$OUT" <<EOFA
- <sdk:archive$OLD_OS_ATTR>
- <sdk:size>$SIZE</sdk:size>
- <sdk:checksum type='sha1'>$SHA1</sdk:checksum>
- <sdk:url>$DST</sdk:url>
-EOFA
- if [[ $USE_HOST_OS ]]; then
- # parse the Archive.Host/Jvm info from the source.props if present
- MAP=$(parse_attributes "$PROPS" ${ATTRS_ARCHIVE[@]})
- # Always generate host-os if not present
- if [[ "${MAP/ host-os /}" == "$MAP" ]]; then
- MAP="$MAP host-os $OS"
- fi
- output_attributes "archive" "$OUT" $MAP
- fi
- echo " </sdk:archive>" >> "$OUT"
-
- # Skip to next arch/zip entry.
- # If not a valid OS, close the archives/package nodes.
- OS=$(check_enum "$1" $OSES)
-
- if [[ ! "$OS" ]]; then
- echo " </sdk:archives>" >> "$OUT"
- echo " </sdk:${ELEMENT}>" >> "$OUT"
- fi
- done
-
-done
-
-# Generate XML footer
-echo "</sdk:$ROOT>" >> "$OUT"
-
-echo "## Validate XML against schema"
-xmllint --schema $SCHEMA "$OUT"
-
diff --git a/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy b/src/main/groovy/com/android/tools/internal/sdk/base/SdkEmulatorPlugin.groovy
index 2984794..d909e0b 100644
--- a/src/main/groovy/com/android/tools/internal/sdk/base/SdkToolsPlugin.groovy
+++ b/src/main/groovy/com/android/tools/internal/sdk/base/SdkEmulatorPlugin.groovy
@@ -25,14 +25,14 @@ import org.gradle.api.tasks.bundling.Zip
/**
* Plugin for the root project. This orchestrates the output of all the modules
- * into the SDK Tools package
+ * into the emulator package
*/
-public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> {
+public class SdkEmulatorPlugin extends BaseSdkPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
if (!project.equals(project.rootProject)) {
- throw new RuntimeException("sdk-tools plugin must be applied to root project only")
+ throw new RuntimeException("sdk-emulator plugin must be applied to root project only")
}
super.apply(project)
@@ -57,8 +57,8 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> {
private Task setupPlatform(String platformName, String plaformPkgName) {
File root = new File(getSdkRoot(), platformName);
- File sdkRoot = new File(root, "tools")
- File sdkDebugRoot = new File(root, "tools.debug")
+ File sdkRoot = new File(root, "emulator")
+ File sdkDebugRoot = new File(root, "emulator.debug")
Task makeTask = project.tasks.create("make${platformName.capitalize()}Sdk")
@@ -79,7 +79,7 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> {
copyFiles.mustRunAfter cleanFolder
Zip zipFiles = project.tasks.create("zip${platformName.capitalize()}Sdk", Zip)
- zipFiles.from(root).include("tools/**")
+ zipFiles.from(root).include("emulator/**")
zipFiles.destinationDir = project.ext.androidHostDist
Zip zipDebugFiles = project.tasks.create("zip${platformName.capitalize()}DebugSdk", Zip)
@@ -90,11 +90,11 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> {
String zipName
String zipDebugName
if (buildNumber == null) {
- zipName = "sdk-repo-$plaformPkgName-tools.zip"
- zipDebugName = "sdk-repo-$plaformPkgName-debug-tools.zip"
+ zipName = "sdk-repo-$plaformPkgName-emulator.zip"
+ zipDebugName = "sdk-repo-$plaformPkgName-debug-emulator.zip"
} else {
- zipName = "sdk-repo-$plaformPkgName-tools-${buildNumber}.zip"
- zipDebugName = "sdk-repo-$plaformPkgName-debug-tools-${buildNumber}.zip"
+ zipName = "sdk-repo-$plaformPkgName-emulator-${buildNumber}.zip"
+ zipDebugName = "sdk-repo-$plaformPkgName-debug-emulator-${buildNumber}.zip"
}
zipFiles.setArchiveName(zipName)
@@ -103,7 +103,7 @@ public class SdkToolsPlugin extends BaseSdkPlugin implements Plugin<Project> {
zipDebugFiles.setArchiveName(zipDebugName)
zipDebugFiles.mustRunAfter cleanFolder
- makeTask.description = "Packages the ${platformName.capitalize()} SDK Tools"
+ makeTask.description = "Packages the ${platformName.capitalize()} emulator"
makeTask.group = "Android SDK"
makeTask.dependsOn cleanFolder, copyFiles, zipFiles, zipDebugFiles
project.afterEvaluate {
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 c1fef30..27ce88e 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
@@ -62,8 +62,8 @@ class SdkFilesPlugin extends BaseSdkPlugin implements Plugin<Project> {
"copy${platform.name.capitalize()}SdkToolsFiles", CopyToolItemsTask)
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.itemOutputDir = new File(getSdkRoot(), platform.name + File.separatorChar + "emulator")
+ copySdkToolsFiles.itemDebugOutputDir = new File(getSdkRoot(), platform.name + File.separatorChar + "emulator.debug")
copySdkToolsFiles.noticeDir = new File(project.buildDir, "sdk/notices")
copySdkToolsFiles.dependsOn platform.builtBy
diff --git a/src/main/resources/META-INF/gradle-plugins/sdk-emulator.properties b/src/main/resources/META-INF/gradle-plugins/sdk-emulator.properties
new file mode 100644
index 0000000..cfe53c2
--- /dev/null
+++ b/src/main/resources/META-INF/gradle-plugins/sdk-emulator.properties
@@ -0,0 +1 @@
+implementation-class=com.android.tools.internal.sdk.base.SdkEmulatorPlugin
diff --git a/src/main/resources/META-INF/gradle-plugins/sdk-tools.properties b/src/main/resources/META-INF/gradle-plugins/sdk-tools.properties
deleted file mode 100644
index 1838b00..0000000
--- a/src/main/resources/META-INF/gradle-plugins/sdk-tools.properties
+++ /dev/null
@@ -1 +0,0 @@
-implementation-class=com.android.tools.internal.sdk.base.SdkToolsPlugin