diff options
| author | Xavier Ducrohet <xav@android.com> | 2014-01-10 04:26:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-01-10 04:26:55 +0000 |
| commit | 06800c70e9d4af5eac0c1e73a2dc97aac38908b7 (patch) | |
| tree | 94704f2112aa4cad77eb669f33e9b8e6c946e966 | |
| parent | 5d3374d481ac2f919d247ef1867f1a5330c50e50 (diff) | |
| parent | b71fc0911866e76e447ddc9f0197bc6a5eba0e6e (diff) | |
| download | platform_tools_base-gradle_0.7.tar.gz platform_tools_base-gradle_0.7.tar.bz2 platform_tools_base-gradle_0.7.zip | |
Merge "Add provided dependency scope." into gradle_0.7gradle_0.7
27 files changed, 201 insertions, 153 deletions
diff --git a/build-system/.gitignore b/build-system/.gitignore index 33547a344d..5617510cea 100644 --- a/build-system/.gitignore +++ b/build-system/.gitignore @@ -7,6 +7,7 @@ tests/attrOrder/*/build tests/basic/lint-report* tests/3rdPartyTests/*/build tests/dependencies/jarProject/build +tests/dependencies/jarProject2/build tests/flavorlib/*/build tests/flavorlibWithFailedTests/*/build tests/libProguardJarDep/*/build diff --git a/build-system/builder/src/main/java/com/android/builder/VariantConfiguration.java b/build-system/builder/src/main/java/com/android/builder/VariantConfiguration.java index c7b2b2e966..f69bf05884 100644 --- a/build-system/builder/src/main/java/com/android/builder/VariantConfiguration.java +++ b/build-system/builder/src/main/java/com/android/builder/VariantConfiguration.java @@ -1276,6 +1276,25 @@ public class VariantConfiguration implements TestData { } /** + * Returns the list of provided jars for this config. + * + * @return a non null, but possibly empty list. + */ + @NonNull + public List<File> getProvidedJars() { + Set<File> jars = Sets.newHashSetWithExpectedSize(mJars.size()); + + for (JarDependency jar : mJars) { + File jarFile = jar.getJarFile(); + if (!jar.isPackaged() && jarFile.exists()) { + jars.add(jarFile); + } + } + + return Lists.newArrayList(jars); + } + + /** * Returns a list of items for the BuildConfig class. * * Items can be either fields (instance of {@link com.android.builder.model.ClassField}) diff --git a/build-system/builder/src/main/java/com/android/builder/dependency/JarDependency.java b/build-system/builder/src/main/java/com/android/builder/dependency/JarDependency.java index d2831a04bc..a28fb4ebd9 100644 --- a/build-system/builder/src/main/java/com/android/builder/dependency/JarDependency.java +++ b/build-system/builder/src/main/java/com/android/builder/dependency/JarDependency.java @@ -27,7 +27,7 @@ public class JarDependency { private final File mJarFile; private final boolean mCompiled; - private final boolean mPackaged; + private boolean mPackaged; private final boolean mProguarded; public JarDependency(@NonNull File jarFile, boolean compiled, boolean packaged, @@ -38,9 +38,6 @@ public class JarDependency { mProguarded = proguarded; } - public JarDependency(@NonNull File jarFile) { - this(jarFile, true, true, true); - } public JarDependency(@NonNull File jarFile, boolean compiled, boolean packaged) { this(jarFile, compiled, packaged, true); @@ -59,7 +56,21 @@ public class JarDependency { return mPackaged; } + public void setPackaged(boolean packaged) { + mPackaged = packaged; + } + public boolean isProguarded() { return mProguarded; } + + @Override + public String toString() { + return "JarDependency{" + + "mJarFile=" + mJarFile + + ", mCompiled=" + mCompiled + + ", mPackaged=" + mPackaged + + ", mProguarded=" + mProguarded + + '}'; + } } diff --git a/build-system/builder/src/main/java/com/android/builder/dependency/LibraryBundle.java b/build-system/builder/src/main/java/com/android/builder/dependency/LibraryBundle.java index f6c8ed468a..ad8f5fb65f 100644 --- a/build-system/builder/src/main/java/com/android/builder/dependency/LibraryBundle.java +++ b/build-system/builder/src/main/java/com/android/builder/dependency/LibraryBundle.java @@ -107,7 +107,7 @@ public abstract class LibraryBundle implements LibraryDependency { List<File> jars = getLocalJars(); List<JarDependency> localDependencies = Lists.newArrayListWithCapacity(jars.size()); for (File jar : jars) { - localDependencies.add(new JarDependency(jar)); + localDependencies.add(new JarDependency(jar, true, true)); } return localDependencies; diff --git a/build-system/changelog.txt b/build-system/changelog.txt index 4c023c600e..9cce7cc70e 100644 --- a/build-system/changelog.txt +++ b/build-system/changelog.txt @@ -1,3 +1,24 @@ +0.8.0 + +- Support for Gradle 1.10 +- Fixed issue 64302: Add renderscript support mode jar to the dependencies in the IDE model. +- Fixed issue 64094: buildConfigField can now replace previous values inside the same type/flavors. +- Add support for NDK prebuilts in library projects. +- Parallelize pre-dexing to speed up clean builds. +- Added 'provided' dependency scope for compile only (not packaged) dependencies. + Additional scope per buildtype and flavors are also available (debugProvided, myFlavorProvided,etc...) +- Variant API improvements: + * getPreBuild() returns the prebuild task for the variant + * getSourceSets() returns the sorted sourcesets for the task, from lower to higher priority + * createZipAlignTask(String taskName, File inputFile, File outputFile) + This creates and return a new zipalign task. Useful if you have a custom plugin providing custom signing of APKs. + This also makes the assemble task depend on the new zipalign task, and wires variant.getOutputFile() to return the result of the zipalign task. + + +0.7.3 + +- Rebuild 0.7.2 to work with Java6 + 0.7.2 - Add packagingOptions support in Library projects diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy index 201d5d2af0..22c9fa45a7 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy @@ -117,6 +117,15 @@ public abstract class BaseExtension { String.format("Classpath packaged with the compiled %s classes.", sourceSet.getName())); + Configuration providedConfiguration = configurations.findByName( + sourceSet.getProvidedConfigurationName()) + if (providedConfiguration == null) { + providedConfiguration = configurations.create(sourceSet.getProvidedConfigurationName()) + } + providedConfiguration.setVisible(false); + providedConfiguration.setDescription( + String.format("Classpath for only compiling the %s sources.", sourceSet.getName())) + sourceSet.setRoot(String.format("src/%s", sourceSet.getName())) } } diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.groovy index 8b1f0eb4a3..93dbd9d2ac 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.groovy @@ -1230,7 +1230,7 @@ public abstract class BasePlugin { def preDexTaskName = "preDex${variantData.variantConfiguration.fullName.capitalize()}" preDexTask = project.tasks.create(preDexTaskName, PreDex) - preDexTask.dependsOn variantData.javaCompileTask + preDexTask.dependsOn variantData.javaCompileTask, variantData.variantDependency.packageConfiguration preDexTask.plugin = this preDexTask.dexOptions = extension.dexOptions @@ -1428,7 +1428,8 @@ public abstract class BasePlugin { def proguardTask = project.tasks.create( "proguard${variantData.variantConfiguration.fullName.capitalize()}", ProGuardTask) - proguardTask.dependsOn variantData.javaCompileTask + proguardTask.dependsOn variantData.javaCompileTask, variantData.variantDependency.packageConfiguration + if (testedVariantData != null) { proguardTask.dependsOn testedVariantData.proguardTask } @@ -1540,6 +1541,11 @@ public abstract class BasePlugin { proguardTask.injars(inJar, filter: '!META-INF/MANIFEST.MF') } + // now add the provided jars + for (File libJar : variantData.variantConfiguration.providedJars) { + proguardTask.libraryjars(libJar) + } + // Now reset the input count for the only output present in the proguard task. // This is to go around the fact that proguard wants to know about the input // before the output is given. @@ -1830,9 +1836,13 @@ public abstract class BasePlugin { Multimap<LibraryDependency, VariantDependencies> reverseMap) { Configuration compileClasspath = variantDeps.compileConfiguration + Configuration packageClasspath = variantDeps.packageConfiguration + Configuration providedClasspath = variantDeps.providedConfiguration // TODO - shouldn't need to do this - fix this in Gradle ensureConfigured(compileClasspath) + ensureConfigured(packageClasspath) + ensureConfigured(providedClasspath) variantDeps.checker = new DependencyChecker(variantDeps, logger) @@ -1840,8 +1850,8 @@ public abstract class BasePlugin { // TODO - defer downloading until required -- This is hard to do as we need the info to build the variant config. List<LibraryDependencyImpl> bundles = [] - List<JarDependency> jars = [] - List<JarDependency> localJars = [] + Map<File, JarDependency> jars = [:] + Map<File, JarDependency> localJars = [:] collectArtifacts(compileClasspath, artifacts) def dependencies = compileClasspath.incoming.resolutionResult.root.dependencies dependencies.each { DependencyResult dep -> @@ -1862,32 +1872,35 @@ public abstract class BasePlugin { !(dep instanceof ProjectDependency)) { Set<File> files = ((SelfResolvingDependency) dep).resolve() for (File f : files) { - // TODO: support compile only dependencies. - localJars << new JarDependency(f) + localJars.put(f, new JarDependency(f, true /*compiled*/, false /*packaged*/)) } } } - // handle package dependencies. We'll refuse aar libs only in package but not - // in compile and remove all dependencies already in compile to get package-only jar - // files. - Configuration packageClasspath = variantDeps.packageConfiguration - if (!compileClasspath.resolvedConfiguration.hasError()) { + // handle package dependencies. We'll refuse aar libs only in package but not + // in compile and remove all dependencies already in compile to get package-only jar + // files. + Set<File> compileFiles = compileClasspath.files Set<File> packageFiles = packageClasspath.files for (File f : packageFiles) { if (compileFiles.contains(f)) { + // if also in compile + JarDependency jarDep = jars.get(f); + if (jarDep != null) { + jarDep.setPackaged(true) + } continue } if (f.getName().toLowerCase().endsWith(".jar")) { - jars.add(new JarDependency(f, false /*compiled*/, true /*packaged*/)) + jars.put(f, new JarDependency(f, false /*compiled*/, true /*packaged*/)) } else { throw new RuntimeException("Package-only dependency '" + f.absolutePath + - "' is not supported") + "' is not supported in project " + project.name) } } } else if (!currentUnresolvedDependencies.isEmpty()) { @@ -1895,8 +1908,8 @@ public abstract class BasePlugin { } variantDeps.addLibraries(bundles) - variantDeps.addJars(jars) - variantDeps.addLocalJars(localJars) + variantDeps.addJars(jars.values()) + variantDeps.addLocalJars(localJars.values()) // TODO - filter bundles out of source set classpath @@ -1934,7 +1947,7 @@ public abstract class BasePlugin { def addDependency(ResolvedModuleVersionResult moduleVersion, VariantDependencies configDependencies, Collection<LibraryDependencyImpl> bundles, - List<JarDependency> jars, + Map<File, JarDependency> jars, Map<ModuleVersionIdentifier, List<LibraryDependencyImpl>> modules, Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts, Multimap<LibraryDependency, VariantDependencies> reverseMap) { @@ -1969,8 +1982,8 @@ public abstract class BasePlugin { bundlesForThisModule << adep reverseMap.put(adep, configDependencies) } else { - // TODO: support compile only dependencies. - jars << new JarDependency(artifact.file) + jars.put(artifact.file, + new JarDependency(artifact.file, true /*compiled*/, false /*packaged*/)) } } diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/api/AndroidSourceSet.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/api/AndroidSourceSet.groovy index 607905ea3c..3deeb5bdcc 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/api/AndroidSourceSet.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/api/AndroidSourceSet.groovy @@ -106,6 +106,13 @@ public interface AndroidSourceSet { String getPackageConfigurationName(); /** + * Returns the name of the compiled-only configuration for this source set. + * @return The provided configuration name + */ + @NonNull + String getProvidedConfigurationName(); + + /** * The Android Manifest file for this source set. * * @return the manifest. Never returns null. diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/BuildTypeData.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/BuildTypeData.groovy index 4b11232720..2a42260ca1 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/BuildTypeData.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/BuildTypeData.groovy @@ -53,4 +53,9 @@ class BuildTypeData implements ConfigurationProvider { Configuration getPackageConfiguration() { return project.configurations.getByName(sourceSet.packageConfigurationName) } + + @NonNull + Configuration getProvidedConfiguration() { + return project.configurations.getByName(sourceSet.providedConfigurationName) + } } diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProvider.java b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProvider.java index 2fc9c60d0f..045c5792f6 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProvider.java +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProvider.java @@ -20,7 +20,7 @@ import com.android.annotations.NonNull; import org.gradle.api.artifacts.Configuration; /** - * Provides the compile and package configuration. + * Provides the compile, provided and package configurations. */ public interface ConfigurationProvider { @@ -29,4 +29,7 @@ public interface ConfigurationProvider { @NonNull Configuration getPackageConfiguration(); + + @NonNull + Configuration getProvidedConfiguration(); } diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProviderImpl.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProviderImpl.groovy deleted file mode 100644 index 8b4e65a5cb..0000000000 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ConfigurationProviderImpl.groovy +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.build.gradle.internal - -import com.android.annotations.NonNull -import com.android.build.gradle.internal.api.DefaultAndroidSourceSet -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration - -/** - */ -public class ConfigurationProviderImpl implements ConfigurationProvider { - - private final Project project - private final DefaultAndroidSourceSet sourceSet - - public ConfigurationProviderImpl(Project project, DefaultAndroidSourceSet sourceSet) { - this.project = project - this.sourceSet = sourceSet - } - - @Override - @NonNull - public Configuration getCompileConfiguration() { - return project.configurations.getByName(sourceSet.compileConfigurationName) - } - - @Override - @NonNull - public Configuration getPackageConfiguration() { - return project.configurations.getByName(sourceSet.packageConfigurationName) - } -} diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ProductFlavorData.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ProductFlavorData.groovy index 2c7272af40..e0dcf55497 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ProductFlavorData.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/ProductFlavorData.groovy @@ -16,16 +16,47 @@ package com.android.build.gradle.internal +import com.android.annotations.NonNull import com.android.build.gradle.internal.api.DefaultAndroidSourceSet import com.android.builder.DefaultProductFlavor import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.artifacts.Configuration /** * Class containing a ProductFlavor and associated data (sourcesets) */ public class ProductFlavorData<T extends DefaultProductFlavor> { + private static class ConfigurationProviderImpl implements ConfigurationProvider { + + private final Project project + private final DefaultAndroidSourceSet sourceSet + + ConfigurationProviderImpl(Project project, DefaultAndroidSourceSet sourceSet) { + this.project = project + this.sourceSet = sourceSet + } + + @Override + @NonNull + public Configuration getCompileConfiguration() { + return project.configurations.getByName(sourceSet.compileConfigurationName) + } + + @Override + @NonNull + public Configuration getPackageConfiguration() { + return project.configurations.getByName(sourceSet.packageConfigurationName) + } + + @Override + @NonNull + Configuration getProvidedConfiguration() { + return project.configurations.getByName(sourceSet.providedConfigurationName) + } + } + final T productFlavor final DefaultAndroidSourceSet sourceSet diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/api/DefaultAndroidSourceSet.java b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/api/DefaultAndroidSourceSet.java index 50a8dc602d..552532ea41 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/api/DefaultAndroidSourceSet.java +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/api/DefaultAndroidSourceSet.java @@ -144,6 +144,16 @@ public class DefaultAndroidSourceSet implements AndroidSourceSet, SourceProvider @Override @NonNull + public String getProvidedConfigurationName() { + if (name.equals(SourceSet.MAIN_SOURCE_SET_NAME)) { + return "provided"; + } else { + return String.format("%sProvided", name); + } + } + + @Override + @NonNull public AndroidSourceFile getManifest() { return manifest; } diff --git a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/dependency/VariantDependencies.groovy b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/dependency/VariantDependencies.groovy index 71320f30c1..2f61ac242f 100644 --- a/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/dependency/VariantDependencies.groovy +++ b/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/dependency/VariantDependencies.groovy @@ -16,6 +16,7 @@ package com.android.build.gradle.internal.dependency import com.android.annotations.NonNull + import com.android.build.gradle.internal.ConfigurationProvider import com.android.builder.dependency.DependencyContainer import com.android.builder.dependency.JarDependency @@ -40,6 +41,8 @@ public class VariantDependencies implements DependencyContainer, ConfigurationPr final Configuration compileConfiguration @NonNull final Configuration packageConfiguration + @NonNull + final Configuration providedConfiguration @NonNull private final List<LibraryDependencyImpl> libraries = [] @@ -55,9 +58,13 @@ public class VariantDependencies implements DependencyContainer, ConfigurationPr @NonNull ConfigurationProvider... providers) { Set<Configuration> compileConfigs = Sets.newHashSet() Set<Configuration> apkConfigs = Sets.newHashSet() + Set<Configuration> providedConfigs = Sets.newHashSet() for (ConfigurationProvider provider : providers) { compileConfigs.add(provider.compileConfiguration) + compileConfigs.add(provider.providedConfiguration) + + apkConfigs.add(provider.compileConfiguration) apkConfigs.add(provider.packageConfiguration) } @@ -67,30 +74,37 @@ public class VariantDependencies implements DependencyContainer, ConfigurationPr Configuration apk = project.configurations.create("_${name}Apk") apk.setExtendsFrom(apkConfigs) - return new VariantDependencies(name, compile, apk); + // this empty and used for things that consume a variant dependency, + // which is only tests for libraries. + Configuration provided = project.configurations.create("_${name}Provided") + //provided.setExtendsFrom(providedConfigs) + + return new VariantDependencies(name, compile, apk, provided); } private VariantDependencies(@NonNull String name, @NonNull Configuration compileConfiguration, - @NonNull Configuration packageConfiguration) { + @NonNull Configuration packageConfiguration, + @NonNull Configuration providedConfiguration) { this.name = name this.compileConfiguration = compileConfiguration this.packageConfiguration = packageConfiguration + this.providedConfiguration = providedConfiguration } public String getName() { return name } - void addLibraries(List<LibraryDependencyImpl> list) { + void addLibraries(@NonNull List<LibraryDependencyImpl> list) { libraries.addAll(list) } - void addJars(List<JarDependency> list) { + void addJars(@NonNull Collection<JarDependency> list) { jars.addAll(list) } - void addLocalJars(List<JarDependency> list) { + void addLocalJars(@NonNull Collection<JarDependency> list) { localJars.addAll(list) } diff --git a/build-system/tests/dependencies/build.gradle b/build-system/tests/dependencies/build.gradle index e2a1f70f3e..764ca5d126 100644 --- a/build-system/tests/dependencies/build.gradle +++ b/build-system/tests/dependencies/build.gradle @@ -15,23 +15,11 @@ repositories { } dependencies { - compile 'com.google.guava:guava:11.0.2' - apk files('libs/jarProject.jar') + apk project(':jarProject') + provided project(':jarProject2') } android { compileSdkVersion 15 buildToolsVersion "18.0.1" - - testBuildType "blah" - - defaultConfig { - } - - buildTypes { - blah { - packageNameSuffix ".blah" - signingConfig signingConfigs.debug - } - } }
\ No newline at end of file diff --git a/build-system/tests/dependencies/debug.keystore b/build-system/tests/dependencies/debug.keystore Binary files differdeleted file mode 100644 index 389278e539..0000000000 --- a/build-system/tests/dependencies/debug.keystore +++ /dev/null diff --git a/build-system/tests/dependencies/jarProject2/build.gradle b/build-system/tests/dependencies/jarProject2/build.gradle new file mode 100644 index 0000000000..f3eca85893 --- /dev/null +++ b/build-system/tests/dependencies/jarProject2/build.gradle @@ -0,0 +1 @@ +apply plugin: 'java'
\ No newline at end of file diff --git a/build-system/tests/dependencies/jarProject2/src/main/java/com/android/tests/dependencies/jar/StringHelper2.java b/build-system/tests/dependencies/jarProject2/src/main/java/com/android/tests/dependencies/jar/StringHelper2.java new file mode 100644 index 0000000000..a92863922e --- /dev/null +++ b/build-system/tests/dependencies/jarProject2/src/main/java/com/android/tests/dependencies/jar/StringHelper2.java @@ -0,0 +1,8 @@ +package com.android.tests.dependencies.jar; + +public class StringHelper2 { + + public static String getString2(String str) { + return str + "-helper"; + } +}
\ No newline at end of file diff --git a/build-system/tests/dependencies/libs/jarProject.jar b/build-system/tests/dependencies/libs/jarProject.jar Binary files differdeleted file mode 100644 index 6b03f1db37..0000000000 --- a/build-system/tests/dependencies/libs/jarProject.jar +++ /dev/null diff --git a/build-system/tests/dependencies/settings.gradle b/build-system/tests/dependencies/settings.gradle new file mode 100644 index 0000000000..fedde4ce75 --- /dev/null +++ b/build-system/tests/dependencies/settings.gradle @@ -0,0 +1,2 @@ +include ':jarProject' +include ':jarProject2'
\ No newline at end of file diff --git a/build-system/tests/dependencies/src/instrumentTest/java/com/android/tests/dependencies/MainActivityTest.java b/build-system/tests/dependencies/src/instrumentTest/java/com/android/tests/dependencies/MainActivityTest.java index 034b8f606f..df30d07b90 100644 --- a/build-system/tests/dependencies/src/instrumentTest/java/com/android/tests/dependencies/MainActivityTest.java +++ b/build-system/tests/dependencies/src/instrumentTest/java/com/android/tests/dependencies/MainActivityTest.java @@ -37,8 +37,18 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } @SmallTest - public void testValues() { + public void testPackageOnly() { assertEquals("Foo-helper", mTextView.getText()); } + + public void testProvided() { + boolean exception = false; + try { + getActivity().getString2("foo"); + } catch (Throwable t) { + exception = true; + } + assertTrue(exception); + } } diff --git a/build-system/tests/dependencies/src/main/AndroidManifest.xml b/build-system/tests/dependencies/src/main/AndroidManifest.xml index 5b71e127bc..3fc2e188d1 100644 --- a/build-system/tests/dependencies/src/main/AndroidManifest.xml +++ b/build-system/tests/dependencies/src/main/AndroidManifest.xml @@ -11,12 +11,5 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> - <activity - android:name="ShowPeopleActivity" - android:label="@string/title_activity_display_message" > - <meta-data - android:name="android.support.PARENT_ACTIVITY" - android:value="org.gradle.sample.MainActivity" /> - </activity> </application> </manifest> diff --git a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/BuildType.java b/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/BuildType.java deleted file mode 100644 index 40fdaa2479..0000000000 --- a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/BuildType.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.android.tests.dependencies; - -public interface BuildType { - String getBuildType(); -} diff --git a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/MainActivity.java b/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/MainActivity.java index 3d617f6f49..dfec087b73 100644 --- a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/MainActivity.java +++ b/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/MainActivity.java @@ -4,9 +4,8 @@ import android.app.Activity; import android.view.View; import android.content.Intent; import android.os.Bundle; - -import android.annotation.TargetApi; import android.widget.TextView; +import com.android.tests.dependencies.jar.StringHelper2; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -37,9 +36,7 @@ public class MainActivity extends Activity { } } - @TargetApi(10) - public void sendMessage(View view) { - Intent intent = new Intent(this, ShowPeopleActivity.class); - startActivity(intent); + public String getString2(String foo) { + return StringHelper2.getString2(foo); } } diff --git a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/Person.java b/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/Person.java deleted file mode 100644 index fcd6f217b7..0000000000 --- a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/Person.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.android.tests.dependencies; - -public class Person { - private final String name; - - public Person(String name) { - this.name = name; - } - - public String getName() { - return name; - } -} diff --git a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/ShowPeopleActivity.java b/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/ShowPeopleActivity.java deleted file mode 100644 index 3a1ff01423..0000000000 --- a/build-system/tests/dependencies/src/main/java/com/android/tests/dependencies/ShowPeopleActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.android.tests.dependencies; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.TextView; -import com.google.common.collect.Lists; - -import java.lang.String; - -public class ShowPeopleActivity extends Activity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - String message = "People:"; - - Iterable<Person> people = Lists.newArrayList(new Person("fred")); - for (Person person : people) { - message += "\n * "; - message += person.getName(); - } - - TextView textView = new TextView(this); - textView.setTextSize(20); - textView.setText(message); - - setContentView(textView); - } -} diff --git a/build-system/tests/dependencies/src/main/res/layout/main.xml b/build-system/tests/dependencies/src/main/res/layout/main.xml index 1884ac944d..81207f4da0 100644 --- a/build-system/tests/dependencies/src/main/res/layout/main.xml +++ b/build-system/tests/dependencies/src/main/res/layout/main.xml @@ -7,8 +7,7 @@ <Button android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/button_send" - android:onClick="sendMessage" /> + android:text="@string/button_send" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" |
