From 162d5b276e1539b1acc44afcd4a4ccadcf99023a Mon Sep 17 00:00:00 2001 From: Googler Date: Fri, 12 Jun 2015 15:53:47 +0000 Subject: Allow private header files in the srcs attribute of objc_* rules. This uses CppModuleMap and CppModuleMapAction to generate clang module maps for the target and its transitive dependencies. clang enforces private header usage through these maps. Right now module maps are interpreted but modules aren't enabled. RELNOTES: Allow private header files in the srcs attribute of objc_* rules. -- MOS_MIGRATED_REVID=95844137 --- .../build/lib/rules/objc/IntermediateArtifacts.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (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 9e1372e8d4..6cc286dcbc 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 @@ -16,10 +16,13 @@ package com.google.devtools.build.lib.rules.objc; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.Root; import com.google.devtools.build.lib.analysis.AnalysisEnvironment; import com.google.devtools.build.lib.analysis.AnalysisUtils; +import com.google.devtools.build.lib.rules.cpp.CppFileTypes; +import com.google.devtools.build.lib.rules.cpp.CppModuleMap; import com.google.devtools.build.lib.syntax.Label; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.PathFragment; @@ -29,7 +32,7 @@ import com.google.devtools.build.lib.vfs.PathFragment; */ // TODO(bazel-team): This should really be named DerivedArtifacts as it contains methods for // final as well as intermediate artifacts. -final class IntermediateArtifacts { +public final class IntermediateArtifacts { /** * Extension used on the temporary dsym bundle location. Must end in {@code .dSYM} for dsymutil @@ -270,4 +273,13 @@ final class IntermediateArtifacts { public Artifact runnerScript() { return appendExtension("_runner.sh"); } + + /** + * {@link CppModuleMap} used to enforce proper usage of private headers. + */ + public CppModuleMap moduleMap() { + Artifact mapFile = + appendExtension(Iterables.getOnlyElement(CppFileTypes.CPP_MODULE_MAP.getExtensions())); + return new CppModuleMap(mapFile, ownerLabel.toString()); + } } -- cgit v1.2.3