From 5da0dd559885e3175e28b9d4b11fc6408939f211 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 1 May 2017 19:00:58 +0200 Subject: Roll forward of https://github.com/bazelbuild/bazel/commit/5f31944b8942818aaf53571c76f5c6a9a9dafc72: Custom module map for j2objc_library Automated g4 rollback of commit e7fe50aa727df9ef0a3d37fa258d017971035515. *** Reason for rollback *** Roll forward. The bzl change is removed because it has to be submitted after next Blaze release. *** Original change description *** Automated g4 rollback of commit 5f31944b8942818aaf53571c76f5c6a9a9dafc72. *** Reason for rollback *** This caused some build breaks. *** Original change description *** Custom module map for j2objc_library PiperOrigin-RevId: 154726197 --- .../lib/rules/objc/IntermediateArtifacts.java | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java') diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java index 71cf24bc4e..ba324e670d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java @@ -23,6 +23,7 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.rules.cpp.CppCompileAction.DotdFile; import com.google.devtools.build.lib.rules.cpp.CppHelper; import com.google.devtools.build.lib.rules.cpp.CppModuleMap; +import com.google.devtools.build.lib.rules.cpp.CppModuleMap.UmbrellaHeaderStrategy; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.PathFragment; @@ -48,22 +49,38 @@ public final class IntermediateArtifacts { private final BuildConfiguration buildConfiguration; private final String archiveFileNameSuffix; private final String outputPrefix; + private final UmbrellaHeaderStrategy umbrellaHeaderStrategy; IntermediateArtifacts(RuleContext ruleContext, String archiveFileNameSuffix, String outputPrefix) { - this(ruleContext, archiveFileNameSuffix, outputPrefix, ruleContext.getConfiguration()); + this(ruleContext, archiveFileNameSuffix, outputPrefix, ruleContext.getConfiguration(), + UmbrellaHeaderStrategy.DO_NOT_GENERATE); } IntermediateArtifacts(RuleContext ruleContext, String archiveFileNameSuffix) { - this(ruleContext, archiveFileNameSuffix, "", ruleContext.getConfiguration()); + this(ruleContext, archiveFileNameSuffix, "", ruleContext.getConfiguration(), + UmbrellaHeaderStrategy.DO_NOT_GENERATE); } - + IntermediateArtifacts(RuleContext ruleContext, String archiveFileNameSuffix, - String outputPrefix, BuildConfiguration buildConfiguration) { + UmbrellaHeaderStrategy umbrellaHeaderStrategy) { + this(ruleContext, archiveFileNameSuffix, "", ruleContext.getConfiguration(), + umbrellaHeaderStrategy); + } + + IntermediateArtifacts(RuleContext ruleContext, String archiveFileNameSuffix, String outputPrefix, + BuildConfiguration buildConfiguration) { + this(ruleContext, archiveFileNameSuffix, outputPrefix, buildConfiguration, + UmbrellaHeaderStrategy.DO_NOT_GENERATE); + } + + IntermediateArtifacts(RuleContext ruleContext, String archiveFileNameSuffix, String outputPrefix, + BuildConfiguration buildConfiguration, UmbrellaHeaderStrategy umbrellaHeaderStrategy) { this.ruleContext = ruleContext; this.buildConfiguration = buildConfiguration; this.archiveFileNameSuffix = Preconditions.checkNotNull(archiveFileNameSuffix); this.outputPrefix = Preconditions.checkNotNull(outputPrefix); + this.umbrellaHeaderStrategy = umbrellaHeaderStrategy; } /** @@ -435,7 +452,15 @@ public final class IntermediateArtifacts { .replace(":", "_"); // To get Swift to pick up module maps, we need to name them "module.modulemap" and have their // parent directory in the module map search paths. - return new CppModuleMap(appendExtensionInGenfiles(".modulemaps/module.modulemap"), moduleName); + if (umbrellaHeaderStrategy == UmbrellaHeaderStrategy.GENERATE) { + return new CppModuleMap( + appendExtensionInGenfiles(".modulemaps/module.modulemap"), + appendExtensionInGenfiles(".modulemaps/umbrella.h"), + moduleName); + } else { + return new CppModuleMap( + appendExtensionInGenfiles(".modulemaps/module.modulemap"), moduleName); + } } /** -- cgit v1.2.3