diff --git a/build/sdk.atree b/build/sdk.atree index 16d65de16..d3cfced73 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -59,6 +59,7 @@ development/tools/scripts/java_tests_file.template platforms/${PLATFORM_NAME}/te development/tools/scripts/layout.template platforms/${PLATFORM_NAME}/templates/layout.template development/tools/scripts/strings.template platforms/${PLATFORM_NAME}/templates/strings.template development/tools/scripts/android_rules.xml platforms/${PLATFORM_NAME}/templates/android_rules.xml +development/tools/scripts/android_test_rules.xml platforms/${PLATFORM_NAME}/templates/android_test_rules.xml development/tools/scripts/build.template tools/lib/build.template # emacs support @@ -125,6 +126,11 @@ framework/swing-worker-1.1.jar tools/lib/swing-worker-1.1.jar bin/traceview tools/traceview framework/traceview.jar tools/lib/traceview.jar +# emma lib for code coverage support +framework/emmalib.jar tools/lib/emma_device.jar +external/emma/lib/emma.jar tools/lib/emma.jar +external/emma/lib/emma_ant.jar tools/lib/emma_ant.jar + # custom ant tasks framework/anttasks.jar tools/lib/anttasks.jar diff --git a/tools/anttasks/src/com/android/ant/SetupTask.java b/tools/anttasks/src/com/android/ant/SetupTask.java index ffe8314b7..27d73d6ca 100644 --- a/tools/anttasks/src/com/android/ant/SetupTask.java +++ b/tools/anttasks/src/com/android/ant/SetupTask.java @@ -58,7 +58,8 @@ import javax.xml.xpath.XPathExpressionException; */ public final class SetupTask extends ImportTask { private final static String ANDROID_RULES = "android_rules.xml"; - + // additional android rules for test project - depends on android_rules.xml + private final static String ANDROID_TEST_RULES = "android_test_rules.xml"; // ant property with the path to the android.jar private final static String PROPERTY_ANDROID_JAR = "android.jar"; // LEGACY - compatibility with 1.6 and before @@ -103,6 +104,13 @@ public final class SetupTask extends ImportTask { // get the target property value String targetHashString = antProject.getProperty(ProjectProperties.PROPERTY_TARGET); + + boolean isTestProject = false; + + if (antProject.getProperty("tested.project.dir") != null) { + isTestProject = true; + } + if (targetHashString == null) { throw new BuildException("Android Target is not set."); } @@ -215,17 +223,21 @@ public final class SetupTask extends ImportTask { if (mDoImport) { // make sure the file exists. File templates = new File(templateFolder); + if (templates.isDirectory() == false) { throw new BuildException(String.format("Template directory '%s' is missing.", templateFolder)); } + String importedRulesFileName = isTestProject ? ANDROID_TEST_RULES : ANDROID_RULES; + // now check the rules file exists. - File rules = new File(templateFolder, ANDROID_RULES); + File rules = new File(templateFolder, importedRulesFileName); + if (rules.isFile() == false) { throw new BuildException(String.format("Build rules file '%s' is missing.", templateFolder)); - } + } // set the file location to import setFile(rules.getAbsolutePath()); diff --git a/tools/scripts/android_rules.xml b/tools/scripts/android_rules.xml index 64f0e392e..bdb983493 100644 --- a/tools/scripts/android_rules.xml +++ b/tools/scripts/android_rules.xml @@ -27,36 +27,46 @@ - - - - + + + + + + + + - - + + + + + + - + + - - - - - - - + + + + - + - - - - - + + + + + @@ -68,11 +78,11 @@ Creating output directories if needed... - - - - - + + + + + @@ -82,11 +92,11 @@ - + - + @@ -97,9 +107,9 @@ Compiling aidl files into Java classes... - - - + + + @@ -108,27 +118,48 @@ + + - - + destdir="${out.classes.absolute.dir}" + bootclasspathref="android.target.classpath" + verbose="false" classpath="${extensible.classpath}"> + + - - + - + + + + + + + + Converting compiled files and external libraries into @{out.dex.file}... + + + + + + + + + - Converting compiled files and external libraries into ${out.dir}/${dex.file.name}... - - - - - - + + + + + + - - - + + + @@ -171,8 +202,8 @@ - + + Running zip align on final apk... @@ -183,8 +214,10 @@ Debug Package: ${out.debug.package} - - + + + @@ -202,8 +235,8 @@ - + description="Builds the application. The generated apk file must be signed before + it is published."> - + Installing ${out.debug.package} onto default emulator or device... @@ -244,6 +276,13 @@ + + + + @@ -251,11 +290,14 @@ - Unable to run 'ant uninstall', application.package is not defined in build.properties + + Unable to run 'ant uninstall', application.package is not defined in build.properties + - + Uninstalling ${application.package} from the default emulator or device... @@ -264,8 +306,8 @@ - - + + @@ -278,7 +320,7 @@ debug: Builds the application and signs it with a debug key. release: Builds the application. The generated apk file must be signed before it is published. - install: Installs/reinstall the debug package onto a running + install: Installs/reinstalls the debug package onto a running emulator or device. If the application was previously installed, the signatures must match. diff --git a/tools/scripts/android_test_rules.xml b/tools/scripts/android_test_rules.xml new file mode 100644 index 000000000..dbad32dc1 --- /dev/null +++ b/tools/scripts/android_test_rules.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Instrumenting classes from ${instrumentation.dir}/${out.dir}/classes... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Running tests ... + + + + + + + + + + + + + + + + + + + + + + + + + + + Downloading coverage file into project directory... + + + + + + Extracting coverage report... + + + + + + + + + + + + + + diff --git a/tools/scripts/build.template b/tools/scripts/build.template index ca1595416..3959c570f 100644 --- a/tools/scripts/build.template +++ b/tools/scripts/build.template @@ -63,4 +63,5 @@ build steps are used. --> +