diff options
author | asteinb <asteinb@google.com> | 2018-08-07 09:55:02 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-08-07 09:56:19 -0700 |
commit | 77801e3cb747010edf573eb6639460589318f943 (patch) | |
tree | 3bf04ae26de1525626b1d7d2fa4c486cec5d6191 /src/test | |
parent | 08840382263f5c21f258c19fae15b9696bc0e86f (diff) |
Remove decoupling flag from Bazel
This flag is turned on everywhere. Remove it.
There's a lot of dead code hidden behing this flag; will remove it in a series
of upcoming changes.
RELNOTES: none
PiperOrigin-RevId: 207732126
Diffstat (limited to 'src/test')
3 files changed, 4 insertions, 196 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java index be9889c848..bf04757007 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java @@ -123,31 +123,8 @@ public class AarImportTest extends BuildViewTestCase { } @Test - public void testResourcesProvided_NotDecoupled() throws Exception { - useConfiguration("--noandroid_decouple_data_processing"); - - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:foo"); - - NestedSet<ValidatedAndroidData> directResources = - aarImportTarget.get(AndroidResourcesInfo.PROVIDER).getDirectAndroidResources(); - assertThat(directResources).hasSize(1); - - ValidatedAndroidData resourceContainer = directResources.iterator().next(); - assertThat(resourceContainer.getManifest()).isNotNull(); - - Artifact resourceTreeArtifact = Iterables.getOnlyElement(resourceContainer.getResources()); - assertThat(resourceTreeArtifact.isTreeArtifact()).isTrue(); - assertThat(resourceTreeArtifact.getExecPathString()).endsWith("_aar/unzipped/resources/foo"); - - Artifact assetsTreeArtifact = Iterables.getOnlyElement(resourceContainer.getAssets()); - assertThat(assetsTreeArtifact.isTreeArtifact()).isTrue(); - assertThat(assetsTreeArtifact.getExecPathString()).endsWith("_aar/unzipped/assets/foo"); - } - - @Test public void aapt2RTxtProvided() throws Exception { useConfiguration( - "--android_decouple_data_processing", "--android_sdk=//aapt2/sdk:sdk", "--experimental_skip_parsing_action", "--android_aapt=aapt2"); @@ -178,8 +155,6 @@ public class AarImportTest extends BuildViewTestCase { @Test public void testResourcesProvided() throws Exception { - useConfiguration("--android_decouple_data_processing"); - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:foo"); NestedSet<ValidatedAndroidData> directResources = @@ -206,37 +181,7 @@ public class AarImportTest extends BuildViewTestCase { } @Test - public void testResourcesExtractor_NotDecoupled() throws Exception { - useConfiguration("--noandroid_decouple_data_processing"); - ValidatedAndroidData resourceContainer = - getConfiguredTarget("//a:foo") - .get(AndroidResourcesInfo.PROVIDER) - .getDirectAndroidResources() - .toList() - .get(0); - - Artifact resourceTreeArtifact = resourceContainer.getResources().get(0); - Artifact assetsTreeArtifact = resourceContainer.getAssets().get(0); - Artifact aarResourcesExtractor = - getHostConfiguredTarget( - ruleClassProvider.getToolsRepository() + "//tools/android:aar_resources_extractor") - .getProvider(FilesToRunProvider.class) - .getExecutable(); - - assertThat(getGeneratingSpawnAction(resourceTreeArtifact).getArguments()) - .containsExactly( - aarResourcesExtractor.getExecPathString(), - "--input_aar", - "a/foo.aar", - "--output_res_dir", - resourceTreeArtifact.getExecPathString(), - "--output_assets_dir", - assetsTreeArtifact.getExecPathString()); - } - - @Test public void testResourcesExtractor() throws Exception { - useConfiguration("--android_decouple_data_processing"); ValidatedAndroidData resourceContainer = getConfiguredTarget("//a:foo") .get(AndroidResourcesInfo.PROVIDER) @@ -271,42 +216,8 @@ public class AarImportTest extends BuildViewTestCase { } @Test - public void testDepsCheckerActionExistsForLevelErrorNotDecoupled() throws Exception { - useConfiguration( - "--experimental_import_deps_checking=ERROR", "--noandroid_decouple_data_processing"); - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:last"); - OutputGroupInfo outputGroupInfo = aarImportTarget.get(OutputGroupInfo.SKYLARK_CONSTRUCTOR); - NestedSet<Artifact> outputGroup = - outputGroupInfo.getOutputGroup(OutputGroupInfo.HIDDEN_TOP_LEVEL); - Artifact artifact = Iterables.getOnlyElement(outputGroup); - assertThat(artifact.isTreeArtifact()).isFalse(); - assertThat(artifact.getExecPathString()) - .endsWith("_aar/last/aar_import_deps_checker_result.txt"); - - SpawnAction checkerAction = getGeneratingSpawnAction(artifact); - List<String> arguments = checkerAction.getArguments(); - assertThat(arguments) - .containsAllOf( - "--bootclasspath_entry", - "--classpath_entry", - "--directdep", - "--input", - "--output", - "--checking_mode=error", - "--rule_label", - "--jdeps_output"); - ensureArgumentsHaveClassEntryOptionWithSuffix( - arguments, "/intermediate/classes_and_libs_merged.jar"); - assertThat(arguments.stream().filter(arg -> "--classpath_entry".equals(arg)).count()) - .isEqualTo(5); // transitive classpath - assertThat(arguments.stream().filter(arg -> "--directdep".equals(arg)).count()) - .isEqualTo(1); // 1 declared dep - } - - @Test public void testDepsCheckerActionExistsForLevelError() throws Exception { - useConfiguration( - "--experimental_import_deps_checking=ERROR", "--android_decouple_data_processing"); + useConfiguration("--experimental_import_deps_checking=ERROR"); ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:last"); OutputGroupInfo outputGroupInfo = aarImportTarget.get(OutputGroupInfo.SKYLARK_CONSTRUCTOR); NestedSet<Artifact> outputGroup = @@ -346,43 +257,18 @@ public class AarImportTest extends BuildViewTestCase { } @Test - public void testDepsCheckerActionExistsForLevelWarning_NotDecoupled() throws Exception { - checkDepsCheckerActionExistsForLevel_NotDecoupled(ImportDepsCheckingLevel.WARNING, "warning"); - } - - @Test public void testDepsCheckerActionExistsForLevelWarning() throws Exception { checkDepsCheckerActionExistsForLevel(ImportDepsCheckingLevel.WARNING, "warning"); } @Test - public void testDepsCheckerActionExistsForLevelOff_NotDecoupled() throws Exception { - checkDepsCheckerActionExistsForLevel_NotDecoupled(ImportDepsCheckingLevel.OFF, "silence"); - } - - @Test public void testDepsCheckerActionExistsForLevelOff() throws Exception { checkDepsCheckerActionExistsForLevel(ImportDepsCheckingLevel.OFF, "silence"); } - private void checkDepsCheckerActionExistsForLevel_NotDecoupled( - ImportDepsCheckingLevel level, String expectedCheckingMode) throws Exception { - useConfiguration( - "--experimental_import_deps_checking=" + level.name(), - "--noandroid_decouple_data_processing"); - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:bar"); - OutputGroupInfo outputGroupInfo = aarImportTarget.get(OutputGroupInfo.SKYLARK_CONSTRUCTOR); - NestedSet<Artifact> outputGroup = - outputGroupInfo.getOutputGroup(OutputGroupInfo.HIDDEN_TOP_LEVEL); - Artifact artifact = Iterables.getOnlyElement(outputGroup); - checkDepsCheckerOutputArtifact(artifact, expectedCheckingMode); - } - private void checkDepsCheckerActionExistsForLevel( ImportDepsCheckingLevel level, String expectedCheckingMode) throws Exception { - useConfiguration( - "--experimental_import_deps_checking=" + level.name(), - "--android_decouple_data_processing"); + useConfiguration("--experimental_import_deps_checking=" + level.name()); ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:bar"); OutputGroupInfo outputGroupInfo = aarImportTarget.get(OutputGroupInfo.SKYLARK_CONSTRUCTOR); NestedSet<Artifact> outputGroup = diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLibraryTest.java index 3be5519f28..d045f95ee2 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLibraryTest.java @@ -1237,38 +1237,7 @@ public class AndroidLibraryTest extends AndroidBuildViewTestCase { } @Test - public void testMultipleDirectDependentResourceDirectories_LocalResources() - throws Exception { - useConfiguration("--noandroid_decouple_data_processing"); - - scratch.file("java/android/resources/d1/BUILD", - "android_library(name = 'd1',", - " manifest = 'AndroidManifest.xml',", - " resource_files = ['d1-res/values/strings.xml'],", - " assets = ['assets-d1/some/random/file'],", - " assets_dir = 'assets-d1',", - " deps = ['//java/android/resources/d2:d2'])"); - scratch.file("java/android/resources/d2/BUILD", - "android_library(name = 'd2',", - " manifest = 'AndroidManifest.xml',", - " assets = ['assets-d2/some/random/file'],", - " assets_dir = 'assets-d2',", - " resource_files = ['d2-res/values/strings.xml'],", - " )"); - ConfiguredTarget resource = getConfiguredTarget("//java/android/resources/d1:d1"); - List<String> args = getGeneratingSpawnActionArgs(getResourceArtifact(resource)); - assertPrimaryResourceDirs(ImmutableList.of("java/android/resources/d1/d1-res"), args); - assertThat(getDirectDependentResourceDirs(args)).contains("java/android/resources/d2/d2-res"); - assertThat(getDependentAssetDirs("--directData", args)) - .contains("java/android/resources/d2/assets-d2"); - assertNoEvents(); - } - - @Test - public void testMultipleDirectDependentResourceDirectories_DecoupledLocalResources() - throws Exception { - useConfiguration("--android_decouple_data_processing"); - + public void testMultipleDirectDependentResourceDirectories() throws Exception { scratch.file( "java/android/resources/d1/BUILD", "android_library(name = 'd1',", @@ -1298,52 +1267,7 @@ public class AndroidLibraryTest extends AndroidBuildViewTestCase { } @Test - public void testTransitiveDependentResourceDirectories_LocalResources() - throws Exception { - useConfiguration("--noandroid_decouple_data_processing"); - - scratch.file("java/android/resources/d1/BUILD", - "android_library(name = 'd1',", - " manifest = 'AndroidManifest.xml',", - " resource_files = ['d1-res/values/strings.xml'],", - " assets = ['assets-d1/some/random/file'],", - " assets_dir = 'assets-d1',", - " deps = ['//java/android/resources/d2:d2'])"); - scratch.file("java/android/resources/d2/BUILD", - "android_library(name = 'd2',", - " manifest = 'AndroidManifest.xml',", - " assets = ['assets-d2/some/random/file'],", - " assets_dir = 'assets-d2',", - " resource_files = ['d2-res/values/strings.xml'],", - " deps = ['//java/android/resources/d3:d3'],", - " )"); - scratch.file("java/android/resources/d3/BUILD", - "android_library(name = 'd3',", - " manifest = 'AndroidManifest.xml',", - " assets = ['assets-d3/some/random/file'],", - " assets_dir = 'assets-d3',", - " resource_files = ['d3-res/values/strings.xml'],", - " )"); - - ConfiguredTarget resource = getConfiguredTarget("//java/android/resources/d1:d1"); - List<String> args = getGeneratingSpawnActionArgs(getResourceArtifact(resource)); - assertPrimaryResourceDirs(ImmutableList.of("java/android/resources/d1/d1-res"), args); - Truth.assertThat(getDirectDependentResourceDirs(args)) - .contains("java/android/resources/d2/d2-res"); - Truth.assertThat(getDependentAssetDirs("--directData", args)) - .contains("java/android/resources/d2/assets-d2"); - Truth.assertThat(getTransitiveDependentResourceDirs(args)) - .contains("java/android/resources/d3/d3-res"); - Truth.assertThat(getDependentAssetDirs("--data", args)) - .contains("java/android/resources/d3/assets-d3"); - assertNoEvents(); - } - - @Test - public void testTransitiveDependentResourceDirectories_DecoupledLocalResources() - throws Exception { - useConfiguration("--android_decouple_data_processing"); - + public void testTransitiveDependentResourceDirectories() throws Exception { scratch.file( "java/android/resources/d1/BUILD", "android_library(name = 'd1',", diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestTest.java index 10ad0ee2da..49decc2bbf 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestTest.java @@ -169,8 +169,6 @@ public abstract class AndroidLocalTestTest extends AbstractAndroidLocalTestTestB */ @Test public void testInferredJavaPackageFromPackageName() throws Exception { - useConfiguration("--android_decouple_data_processing"); - ConfiguredTarget target = scratchConfiguredTarget( "java-src/test", |