Add provided dependency scope.
(cherry picked from commit 3e89364d07261ed7a8360e6c56b7333732d70fca)
Change-Id: Ie06366abfa954c2d24d099609a380febf9d15cd3
diff --git a/build-system/.gitignore b/build-system/.gitignore
index 33547a3..5617510 100644
--- a/build-system/.gitignore
+++ b/build-system/.gitignore
@@ -7,6 +7,7 @@
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 c7b2b2e..f69bf05 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 @@
}
/**
+ * 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 d2831a0..a28fb4e 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 @@
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 @@
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 @@
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 f6c8ed4..ad8f5fb 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 @@
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 4c023c6..9cce7cc 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 201d5d2..22c9fa4 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 @@
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 8b1f0eb..93dbd9d 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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
!(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 @@
}
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 @@
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 @@
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 607905e..3deeb5b 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 @@
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 4b11232..2a42260 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 @@
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 2fc9c60..045c579 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 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 @@
@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 8b4e65a..0000000
--- 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 2c7272a..e0dcf55 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 50a8dc6..552532e 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 @@
@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 71320f3..2f61ac2 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 @@
final Configuration compileConfiguration
@NonNull
final Configuration packageConfiguration
+ @NonNull
+ final Configuration providedConfiguration
@NonNull
private final List<LibraryDependencyImpl> libraries = []
@@ -55,9 +58,13 @@
@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 @@
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 e2a1f70..764ca5d 100644
--- a/build-system/tests/dependencies/build.gradle
+++ b/build-system/tests/dependencies/build.gradle
@@ -15,23 +15,11 @@
}
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
deleted file mode 100644
index 389278e..0000000
--- a/build-system/tests/dependencies/debug.keystore
+++ /dev/null
Binary files differ
diff --git a/build-system/tests/dependencies/jarProject2/build.gradle b/build-system/tests/dependencies/jarProject2/build.gradle
new file mode 100644
index 0000000..f3eca85
--- /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 0000000..a928639
--- /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
deleted file mode 100644
index 6b03f1d..0000000
--- a/build-system/tests/dependencies/libs/jarProject.jar
+++ /dev/null
Binary files differ
diff --git a/build-system/tests/dependencies/settings.gradle b/build-system/tests/dependencies/settings.gradle
new file mode 100644
index 0000000..fedde4c
--- /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 034b8f6..df30d07 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 @@
}
@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 5b71e12..3fc2e18 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 40fdaa2..0000000
--- 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 3d617f6..dfec087 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.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 @@
}
}
- @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 fcd6f21..0000000
--- 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 3a1ff01..0000000
--- 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 1884ac9..81207f4 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"