diff options
author | 2017-12-22 09:21:49 -0800 | |
---|---|---|
committer | 2017-12-22 09:24:37 -0800 | |
commit | 5892f3a08113f93c5f2570304f13c2047f24f7a5 (patch) | |
tree | 8f6d52fd1c1d3ef90670ecb23df1420f9cbf9809 /src/main | |
parent | 1ad2b699b2934e7a8c55537428120f36c50fb4e9 (diff) |
Remove more dead code
RELNOTES: none
PiperOrigin-RevId: 179933248
Diffstat (limited to 'src/main')
5 files changed, 11 insertions, 111 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index 4c3d74c914..fec5a588b4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -693,8 +693,7 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { NestedSetBuilder<Artifact> filesBuilder) throws InterruptedException, RuleErrorException { - if (LocalResourceContainer.definesAndroidResources(ruleContext.attributes()) - && !proguardSpecs.isEmpty()) { + if (!proguardSpecs.isEmpty()) { Artifact apk = new ResourceShrinkerActionBuilder(ruleContext) @@ -728,8 +727,7 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { resourceApk.getPrimaryResource(), resourceApk.getManifest(), resourceApk.getResourceProguardConfig(), - resourceApk.getMainDexProguardConfig(), - resourceApk.isLegacy()); + resourceApk.getMainDexProguardConfig()); } return resourceApk; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java index 1f1f26ff93..4229728f65 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java @@ -21,7 +21,6 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.analysis.AnalysisUtils; import com.google.devtools.build.lib.analysis.FileProvider; -import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.analysis.OutputGroupInfo; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; import com.google.devtools.build.lib.analysis.RuleContext; @@ -30,7 +29,6 @@ import com.google.devtools.build.lib.analysis.RunfilesProvider; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; -import com.google.devtools.build.lib.analysis.actions.FileWriteAction; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; @@ -479,72 +477,6 @@ public class AndroidCommon { javacHelper.createSourceJarAction(resourceSourceJar, null); } - private void createJarJarActions( - JavaTargetAttributes.Builder attributes, - NestedSetBuilder<Artifact> jarsProducedForRuntime, - Iterable<ResourceContainer> resourceContainers, - String originalPackage, - Artifact binaryResourcesJar) { - // Now use jarjar for the rest of the resources. We need to make a copy - // of the final generated resources for each of the targets included in - // the transitive closure of this binary. - for (ResourceContainer otherContainer : resourceContainers) { - if (otherContainer.getLabel().equals(ruleContext.getLabel())) { - continue; - } - - Artifact resourcesJar = createResourceJarArtifact(ruleContext, otherContainer, ".jar"); - // combined resource constants copy needs to come before library classes that may contain - // their local resource constants - attributes.addRuntimeClassPathEntry(resourcesJar); - - Artifact jarJarRuleFile = - createResourceJarArtifact(ruleContext, otherContainer, ".jar_jarjar_rules.txt"); - - String jarJarRule = - String.format("rule %s.* %s.@1", originalPackage, otherContainer.getJavaPackage()); - ruleContext.registerAction( - FileWriteAction.create(ruleContext, jarJarRuleFile, jarJarRule, false)); - - FilesToRunProvider jarjar = ruleContext.getExecutablePrerequisite("$jarjar_bin", Mode.HOST); - - ruleContext.registerAction( - new SpawnAction.Builder() - .useDefaultShellEnvironment() - .setExecutable(jarjar) - .setProgressMessage("Repackaging jar") - .setMnemonic("AndroidRepackageJar") - .addInput(jarJarRuleFile) - .addInput(binaryResourcesJar) - .addOutput(resourcesJar) - .addCommandLine( - CustomCommandLine.builder() - .add("process") - .addExecPath(jarJarRuleFile) - .addExecPath(binaryResourcesJar) - .addExecPath(resourcesJar) - .build()) - .build(ruleContext)); - jarsProducedForRuntime.add(resourcesJar); - } - } - - private static Artifact createResourceJarArtifact( - RuleContext ruleContext, ResourceContainer container, String fileNameSuffix) { - - String artifactName = container.getLabel().getName() + fileNameSuffix; - - // Since the Java sources are generated by combining all resources with the - // ones included in the binary, the path of the artifact has to be unique - // per binary and per library (not only per library). - Artifact artifact = - ruleContext.getUniqueDirectoryArtifact( - "resource_jars", - container.getLabel().getPackageIdentifier().getSourceRoot().getRelative(artifactName), - ruleContext.getBinOrGenfilesDirectory()); - return artifact; - } - public JavaTargetAttributes init( JavaSemantics javaSemantics, AndroidSemantics androidSemantics, @@ -596,10 +528,8 @@ public class AndroidCommon { Artifact resourcesJar = resourceApk.getResourceJavaSrcJar(); if (resourcesJar != null) { filesBuilder.add(resourcesJar); - // Use a fast-path R class generator for android_binary with local resources, where there is - // a bottleneck. For legacy resources, the srcjar and R class compiler don't match up - // (the legacy srcjar requires the createJarJar step below). - boolean useRClassGenerator = isBinary && !resourceApk.isLegacy(); + // Use a fast-path R class generator for android_binary, where there is a bottleneck. + boolean useRClassGenerator = isBinary; compileResources( javaSemantics, resourceApk, @@ -613,17 +543,6 @@ public class AndroidCommon { // local resource constants. artifactsBuilder.addRuntimeJar(resourceClassJar); jarsProducedForRuntime.add(resourceClassJar); - - if (resourceApk.isLegacy()) { - // Repackages the R.java for each dependency package and places the resultant jars before - // the dependency libraries to ensure that the generated resource ids are correct. - createJarJarActions( - attributes, - jarsProducedForRuntime, - resourceApk.getResourceDependencies().getResourceContainers(), - resourceApk.getPrimaryResource().getJavaPackage(), - resourceClassJar); - } } JavaCompilationHelper helper = initAttributes(attributes, javaSemantics); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java index adca93d1fc..f57d4891eb 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java @@ -621,11 +621,6 @@ public final class AndroidRuleClasses { <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ .add(attr("javacopts", STRING_LIST)) .add( - attr("$jarjar_bin", LABEL) - .cfg(HostTransition.INSTANCE) - .exec() - .value(env.getToolsLabel("//tools/android:jarjar_bin"))) - .add( attr("$idlclass", LABEL) .cfg(HostTransition.INSTANCE) .exec() diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java index 4594594220..cb9e5002d7 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java @@ -369,8 +369,7 @@ public final class ApplicationManifest { processed, processed.getManifest(), proguardCfg, - null, - false); + null); } /** Packages up the manifest with resource and assets from the LocalResourceContainer. */ @@ -458,8 +457,7 @@ public final class ApplicationManifest { processed, processed.getManifest(), null, - null, - false); + null); } /* Creates an incremental apk from assets and data. */ @@ -524,8 +522,7 @@ public final class ApplicationManifest { processed, processed.getManifest(), proguardCfg, - null, - false); + null); } /** Packages up the manifest with resource and assets from the rule and dependent resources. */ @@ -615,8 +612,7 @@ public final class ApplicationManifest { processed, processed.getManifest(), proguardCfg, - mainDexProguardCfg, - false); + mainDexProguardCfg); } public ResourceApk packLibraryWithDataAndResources( @@ -736,8 +732,7 @@ public final class ApplicationManifest { processed, processed.getManifest(), null, - null, - false); + null); } public Artifact getManifest() { diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java index 01d19ab2be..504649d403 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java @@ -35,7 +35,6 @@ public final class ResourceApk { @Nullable private final Artifact manifest; // The non-binary XML version of AndroidManifest.xml @Nullable private final Artifact resourceProguardConfig; @Nullable private final Artifact mainDexProguardConfig; - private final boolean legacy; public ResourceApk( @Nullable Artifact resourceApk, @@ -45,8 +44,7 @@ public final class ResourceApk { @Nullable ResourceContainer primaryResource, @Nullable Artifact manifest, @Nullable Artifact resourceProguardConfig, - @Nullable Artifact mainDexProguardConfig, - boolean legacy) { + @Nullable Artifact mainDexProguardConfig) { this.resourceApk = resourceApk; this.resourceJavaSrcJar = resourceJavaSrcJar; this.resourceJavaClassJar = resourceJavaClassJar; @@ -55,7 +53,6 @@ public final class ResourceApk { this.manifest = manifest; this.resourceProguardConfig = resourceProguardConfig; this.mainDexProguardConfig = mainDexProguardConfig; - this.legacy = legacy; } public Artifact getArtifact() { @@ -78,12 +75,8 @@ public final class ResourceApk { return resourceJavaClassJar; } - public boolean isLegacy() { - return legacy; - } - public static ResourceApk fromTransitiveResources(ResourceDependencies resourceDeps) { - return new ResourceApk(null, null, null, resourceDeps, null, null, null, null, false); + return new ResourceApk(null, null, null, resourceDeps, null, null, null, null); } public Artifact getResourceProguardConfig() { |