RELNOTES: Remove flag --experimental_zip_tree_artifact from j2objc Java annotation processing support. -- MOS_MIGRATED_REVID=136084697
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java index 5c593c8..60fc82c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -26,7 +26,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.actions.Action; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ParameterFile; import com.google.devtools.build.lib.analysis.ConfiguredAspect; @@ -37,7 +36,6 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction; -import com.google.devtools.build.lib.analysis.actions.PopulateTreeArtifactAction; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.cmdline.Label; @@ -195,13 +193,6 @@ j2ObjcSource, genSrcJar); - boolean zipTreeArtifact = ruleContext.getFragment(J2ObjcConfiguration.class) - .zipTreeArtifact(); - if (genSrcJar.isPresent() && zipTreeArtifact) { - for (Action action : genJarTreeArtifactCreationActions(ruleContext)) { - ruleContext.registerAction(action); - } - } common = common( ruleContext, j2ObjcSource.getObjcSrcs(), @@ -274,59 +265,17 @@ } private List<Artifact> genJarOutputs(RuleContext ruleContext) { - boolean zipTreeArtifact = ruleContext - .getFragment(J2ObjcConfiguration.class) - .zipTreeArtifact(); - - if (zipTreeArtifact) { - return ImmutableList.of( - j2ObjcGenJarSourceZip(ruleContext), - j2ObjcGenJarSourceZipManifest(ruleContext), - j2ObjcGenJarHeaderZip(ruleContext), - j2ObjcGenJarHeaderZipManifest(ruleContext)); - } else { - return ImmutableList.of( - j2ObjcGenJarTranslatedSourceFiles(ruleContext), - j2objcGenJarTranslatedHeaderFiles(ruleContext)); - } + return ImmutableList.of( + j2ObjcGenJarTranslatedSourceFiles(ruleContext), + j2objcGenJarTranslatedHeaderFiles(ruleContext)); } private List<String> genJarFlags(RuleContext ruleContext) { - boolean zipTreeArtifact = ruleContext.getFragment(J2ObjcConfiguration.class).zipTreeArtifact(); - - if (zipTreeArtifact) { - return ImmutableList.of( - "--output_gen_source_zip", j2ObjcGenJarSourceZip(ruleContext).getExecPathString(), - "--output_gen_header_zip", j2ObjcGenJarHeaderZip(ruleContext).getExecPathString()); - } else { - return ImmutableList.of( - "--output_gen_source_dir", - j2ObjcGenJarTranslatedSourceFiles(ruleContext).getExecPathString(), - "--output_gen_header_dir", - j2objcGenJarTranslatedHeaderFiles(ruleContext).getExecPathString()); - } - } - - private List<Action> genJarTreeArtifactCreationActions(RuleContext ruleContext) { - Artifact sourceFiles = j2ObjcGenJarTranslatedSourceFiles(ruleContext); - Artifact headerFiles = j2objcGenJarTranslatedHeaderFiles(ruleContext); - - ImmutableList.Builder<Action> actions = ImmutableList.builder(); - actions.add(new PopulateTreeArtifactAction( - ruleContext.getActionOwner(), - j2ObjcGenJarSourceZip(ruleContext), - j2ObjcGenJarSourceZipManifest(ruleContext), - sourceFiles, - ruleContext.getExecutablePrerequisite("$zipper", Mode.HOST))); - - actions.add(new PopulateTreeArtifactAction( - ruleContext.getActionOwner(), - j2ObjcGenJarHeaderZip(ruleContext), - j2ObjcGenJarHeaderZipManifest(ruleContext), - headerFiles, - ruleContext.getExecutablePrerequisite("$zipper", Mode.HOST))); - - return actions.build(); + return ImmutableList.of( + "--output_gen_source_dir", + j2ObjcGenJarTranslatedSourceFiles(ruleContext).getExecPathString(), + "--output_gen_header_dir", + j2objcGenJarTranslatedHeaderFiles(ruleContext).getExecPathString()); } private void createJ2ObjcTranspilationAction(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcCommandLineOptions.java index ad76187..efd1d11 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcCommandLineOptions.java
@@ -58,13 +58,6 @@ ) public boolean annotationProcessingEnabled; - @Option(name = "experimental_zip_tree_artifact", - defaultValue = "true", - category = "undocumented", - help = "Whether to enable zipping/unzipping implementation of tree artifact creation" - ) - public boolean zipTreeArtifact; - @Override public void addAllLabels(Multimap<String, Label> labelMap) {} }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java index 458e2bb..da3fe1a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java
@@ -78,7 +78,6 @@ private final boolean removeDeadCode; private final boolean explicitJreDeps; private final boolean annotationProcessingEnabled; - private final boolean zipTreeArtifact; J2ObjcConfiguration(J2ObjcCommandLineOptions j2ObjcOptions) { this.removeDeadCode = j2ObjcOptions.removeDeadCode; @@ -88,7 +87,6 @@ .addAll(J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS) .build(); this.annotationProcessingEnabled = j2ObjcOptions.annotationProcessingEnabled; - this.zipTreeArtifact = j2ObjcOptions.zipTreeArtifact; } /** @@ -126,13 +124,6 @@ return annotationProcessingEnabled; } - /** - * Returns whether to enable the zipping/unzipping implementation of tree artifact creation. - */ - public boolean zipTreeArtifact() { - return zipTreeArtifact; - } - @Override public void reportInvalidOptions(EventHandler reporter, BuildOptions buildOptions) { if (!Collections.disjoint(translationFlags, J2OBJC_BLACKLISTED_TRANSLATION_FLAGS)) {
diff --git a/tools/j2objc/j2objc_wrapper.py b/tools/j2objc/j2objc_wrapper.py index 58fe587..800cac3 100755 --- a/tools/j2objc/j2objc_wrapper.py +++ b/tools/j2objc/j2objc_wrapper.py
@@ -181,47 +181,6 @@ f.write(compiled_archive_file_path + ':' + objc_file + '\n') -def GenerateZipAndManifestForObjcFiles(objc_files, - tmp_objc_file_root, - zip_path, - suffix, - zip_factory=zipfile.ZipFile, - file_open=open): - """Zips up the ObjC sources from gen jar and writes a manifest file. - - Args: - objc_files: The list of ObjC sources to zip up. - tmp_objc_file_root: The temporary directory that contains the ObjC files - to zip. - zip_path: The output path of the zip file. - suffix: The suffix of the files to zip. Can be either .m or .h. - zip_factory: The factory method to create zip file objects. - file_open: The method to open a file. - Returns: - None. - """ - # We use zipfile.ZIP_STORED to create a zip file without compression. - zf = zip_factory(zip_path, 'w', zipfile.ZIP_STORED) - files_zip = [os.path.splitext(objc_file)[0] + suffix - for objc_file in objc_files] - - for file_to_zip in files_zip: - file_path = os.path.join(tmp_objc_file_root, file_to_zip) - with file_open(file_path, 'r') as opened_file: - file_content = opened_file.read() - # We set the entry modification time to the first day of 1980, to avoid - # zip output indeterminism. Also note that the zip format does not allow - # entry timestamp before 1980. - zip_entry_info = zipfile.ZipInfo(file_to_zip, _CONST_DATE_TIME) - zf.writestr(zip_entry_info, file_content) - zf.close() - - manifest_file = os.path.splitext(zip_path)[0] + '.txt' - with file_open(manifest_file, 'w') as f: - for file_to_zip in files_zip: - f.write(file_to_zip + '\n') - - def _ParseArgs(j2objc_args): """Separate arguments passed to J2ObjC into source files and J2ObjC flags. @@ -361,7 +320,6 @@ def PostJ2ObjcFileProcessing(normal_objc_files, genjar_objc_files, tmp_objc_file_root, final_objc_file_root, j2objc_source_paths, gen_src_jar, - output_gen_source_zip, output_gen_header_zip, output_gen_source_dir, output_gen_header_dir): """Performs cleanups on ObjC files and moves them to final output location. @@ -372,10 +330,6 @@ final_objc_file_root: The final output root. j2objc_source_paths: The source paths used by J2ObjC. gen_src_jar: The path of the gen srcjar. - output_gen_source_zip: The final output zip of ObjC source files generated - from gen srcjar. Maybe null. - output_gen_header_zip: The final output zip of ObjC header files generated - from gen srcjar. Maybe null. output_gen_source_dir: The final output directory of ObjC source files translated from gen srcjar. Maybe null. output_gen_header_dir: The final output directory of ObjC header files @@ -396,20 +350,6 @@ final_objc_file_root, '.h') - if output_gen_source_zip: - GenerateZipAndManifestForObjcFiles( - genjar_objc_files, - tmp_objc_file_root, - output_gen_source_zip, - '.m') - - if output_gen_header_zip: - GenerateZipAndManifestForObjcFiles( - genjar_objc_files, - tmp_objc_file_root, - output_gen_header_zip, - '.h') - if output_gen_source_dir: CopyObjcFileToFinalOutputRoot( genjar_objc_files, @@ -503,14 +443,6 @@ required=False, help='The jar containing Java sources generated by annotation processor.') parser.add_argument( - '--output_gen_source_zip', - required=False, - help='The output zip of ObjC source files translated from the gen srcjar') - parser.add_argument( - '--output_gen_header_zip', - required=False, - help='The output zip of ObjC header files translated from the gen srcjar') - parser.add_argument( '--output_gen_source_dir', required=False, help='The output directory of ObjC source files translated from the gen' @@ -567,8 +499,6 @@ args.objc_file_path, j2objc_source_paths, args.gen_src_jar, - args.output_gen_source_zip, - args.output_gen_header_zip, args.output_gen_source_dir, args.output_gen_header_dir)