aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-07-11 09:12:07 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-11 09:13:21 -0700
commit29c43683db7dbcf437115bf46ae6fec723a9a29e (patch)
treeb6a058346da23e798f68b5b9e35064a090283d28 /src/main/java/com/google/devtools/build/lib/rules/objc
parent9b745a79653947c1830f906a12572d673420fecc (diff)
Simplify dSYM handling
- Previously we would zip the output of dsymutil and then proceed to unzip it. Due to the size of dSYM files, this could add a few seconds to all builds with dSYMs. - There's no need to have a DsymOutputType or even Info.plist as all we need is the DWARF symbol file; the dSYM is repackaged later on by the bundler. This change is synchronized with the CROSSTOOL and wrapped_clang via the `no_dsym_create_zip` feature, which Bazel sets on the CROSSTOOL to inform wrapped_clang that no zip file should be created for the dSYM. PiperOrigin-RevId: 204134986
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java80
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/DsymOutputType.java45
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java42
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java19
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java26
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcVariablesExtension.java38
8 files changed, 55 insertions, 206 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
index af4f975ce4..4defc829e3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
@@ -226,7 +226,10 @@ public class AppleBinary implements RuleConfiguredTargetFactory {
builder.addOutput(arch, OutputType.BITCODE_SYMBOLS, bitcodeSymbol);
}
if (childObjcConfig.generateDsym()) {
- Artifact dsymBinary = intermediateArtifacts.dsymSymbol(DsymOutputType.APP);
+ Artifact dsymBinary =
+ childObjcConfig.shouldStripBinary()
+ ? intermediateArtifacts.dsymSymbolForUnstrippedBinary()
+ : intermediateArtifacts.dsymSymbolForStrippedBinary();
builder.addOutput(arch, OutputType.DSYM_BINARY, dsymBinary);
}
if (childObjcConfig.generateLinkmap()) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
index ed95544092..f7e7a4a401 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
@@ -65,7 +65,6 @@ import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
import com.google.devtools.build.lib.analysis.PrerequisiteArtifacts;
import com.google.devtools.build.lib.analysis.RuleContext;
-import com.google.devtools.build.lib.analysis.ShToolchain;
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.CustomCommandLine.VectorArg;
@@ -149,7 +148,7 @@ public class CompilationSupport {
@VisibleForTesting
static final String OBJC_MODULE_CACHE_DIR_NAME = "_objc_module_cache";
-
+
@VisibleForTesting
static final String MODULES_CACHE_PATH_WARNING =
"setting '-fmodules-cache-path' manually in copts is unsupported";
@@ -212,6 +211,9 @@ public class CompilationSupport {
/** Enabled if this target generates debug symbols in a dSYM file. */
private static final String GENERATE_DSYM_FILE_FEATURE_NAME = "generate_dsym_file";
+ /** Always enabled to simplify dSYMs handling for newer Bazel versions. */
+ private static final String NO_DSYM_ZIPS_FEATURE_NAME = "no_dsym_create_zip";
+
/**
* Enabled if this target does not generate debug symbols.
*
@@ -547,6 +549,10 @@ public class CompilationSupport {
activatedCrosstoolSelectables.add(CppRuleClasses.PER_OBJECT_DEBUG_INFO);
}
+ // TODO(b/111205462): Remove this feature from here, CROSSTOOL, and wrapped_clang after the
+ // next release.
+ activatedCrosstoolSelectables.add(NO_DSYM_ZIPS_FEATURE_NAME);
+
activatedCrosstoolSelectables.add(XCODE_VERSION_FEATURE_NAME_PREFIX
+ XcodeConfig.getXcodeVersion(ruleContext).toStringWithMinimumComponents(2));
@@ -1102,7 +1108,6 @@ public class CompilationSupport {
* @param j2ObjcEntryClassProvider contains j2objc entry class information for dead code removal
* @param extraLinkArgs any additional arguments to pass to the linker
* @param extraLinkInputs any additional input artifacts to pass to the link action
- * @param dsymOutputType the file type of the dSYM bundle to be generated
* @return this compilation support
*/
CompilationSupport registerLinkActions(
@@ -1111,7 +1116,6 @@ public class CompilationSupport {
J2ObjcEntryClassProvider j2ObjcEntryClassProvider,
ExtraLinkArgs extraLinkArgs,
Iterable<Artifact> extraLinkInputs,
- DsymOutputType dsymOutputType,
CcToolchainProvider toolchain)
throws InterruptedException {
Iterable<Artifact> prunedJ2ObjcArchives =
@@ -1179,12 +1183,14 @@ public class CompilationSupport {
.addLinkopts(ImmutableList.copyOf(extraLinkArgs));
if (objcConfiguration.generateDsym()) {
- Artifact dsymBundleZip = intermediateArtifacts.tempDsymBundleZip(dsymOutputType);
+ Artifact dsymSymbol =
+ objcConfiguration.shouldStripBinary()
+ ? intermediateArtifacts.dsymSymbolForUnstrippedBinary()
+ : intermediateArtifacts.dsymSymbolForStrippedBinary();
extensionBuilder
- .setDsymBundleZip(dsymBundleZip)
+ .setDsymSymbol(dsymSymbol)
.addVariableCategory(VariableCategory.DSYM_VARIABLES);
- registerDsymActions(dsymOutputType);
- executableLinkAction.addActionOutput(dsymBundleZip);
+ executableLinkAction.addActionOutput(dsymSymbol);
}
if (objcConfiguration.generateLinkmap()) {
@@ -1344,58 +1350,6 @@ public class CompilationSupport {
return this;
}
- private PathFragment removeSuffix(PathFragment path, String suffix) {
- String name = path.getBaseName();
- Preconditions.checkArgument(
- name.endsWith(suffix), "expected %s to end with %s, but it does not", name, suffix);
- return path.replaceName(name.substring(0, name.length() - suffix.length()));
- }
-
- private CompilationSupport registerDsymActions(DsymOutputType dsymOutputType) {
- Artifact tempDsymBundleZip = intermediateArtifacts.tempDsymBundleZip(dsymOutputType);
- Artifact linkedBinary =
- objcConfiguration.shouldStripBinary()
- ? intermediateArtifacts.unstrippedSingleArchitectureBinary()
- : intermediateArtifacts.strippedSingleArchitectureBinary();
- Artifact debugSymbolFile = intermediateArtifacts.dsymSymbol(dsymOutputType);
- Artifact dsymPlist = intermediateArtifacts.dsymPlist(dsymOutputType);
-
- PathFragment dsymOutputDir = removeSuffix(tempDsymBundleZip.getExecPath(), ".temp.zip");
- PathFragment dsymPlistZipEntry = dsymPlist.getExecPath().relativeTo(dsymOutputDir);
- PathFragment debugSymbolFileZipEntry =
- debugSymbolFile
- .getExecPath()
- .replaceName(linkedBinary.getFilename())
- .relativeTo(dsymOutputDir);
-
- StringBuilder unzipDsymCommand =
- new StringBuilder()
- .append(
- String.format(
- "unzip -p %s %s > %s",
- tempDsymBundleZip.getExecPathString(),
- dsymPlistZipEntry,
- dsymPlist.getExecPathString()))
- .append(
- String.format(
- " && unzip -p %s %s > %s",
- tempDsymBundleZip.getExecPathString(),
- debugSymbolFileZipEntry,
- debugSymbolFile.getExecPathString()));
-
- PathFragment shExecutable = ShToolchain.getPathOrError(ruleContext);
- ruleContext.registerAction(
- new SpawnAction.Builder()
- .setMnemonic("UnzipDsym")
- .setShellCommand(shExecutable, unzipDsymCommand.toString())
- .addInput(tempDsymBundleZip)
- .addOutput(dsymPlist)
- .addOutput(debugSymbolFile)
- .build(ruleContext));
-
- return this;
- }
-
/**
* Returns all framework names to pass to the linker using {@code -framework} flags. For a
* framework in the directory foo/bar.framework, the name is "bar". Each framework is found
@@ -1575,7 +1529,7 @@ public class CompilationSupport {
// the symbol table from the unstripped binary.
return objcConfiguration.shouldStripBinary()
? intermediateArtifacts.unstrippedSingleArchitectureBinary()
- : intermediateArtifacts.strippedSingleArchitectureBinary();
+ : intermediateArtifacts.strippedSingleArchitectureBinary();
}
private static CommandLine symbolStripCommandLine(
@@ -1632,7 +1586,7 @@ public class CompilationSupport {
umbrellaHeader,
publicHeaders,
ImmutableList.<PathFragment>of()));
-
+
return this;
}
@@ -1692,7 +1646,7 @@ public class CompilationSupport {
return this;
}
-
+
/**
* Collector that, given a list of output artifacts, finds and registers coverage notes metadata
* for any compilation action.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/DsymOutputType.java b/src/main/java/com/google/devtools/build/lib/rules/objc/DsymOutputType.java
deleted file mode 100644
index 5ad1502e89..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/DsymOutputType.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.rules.objc;
-
-/**
- * Used as a descriptor of the expected type of the dSYM bundle that is output when building a rule.
- */
-enum DsymOutputType {
- /**
- * Specifies that the dSYM bundle should have an 'xctest' suffix, which is the expected type when
- * Xcode runs the tests.
- */
- TEST(".xctest.dSYM"),
-
- /**
- * Specifies that the dSYM bundle should have an 'app' suffix, which is the default type when
- * generating the bundle for debugging or for crash symbolication.
- */
- APP(".app.dSYM");
-
- private final String suffix;
-
- private DsymOutputType(String suffix) {
- this.suffix = suffix;
- }
-
- /**
- * Returns the suffix to be used by the dSYM bundle output.
- */
- String getSuffix() {
- return suffix;
- }
-}
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 4502556589..90b4695037 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
@@ -34,13 +34,6 @@ import com.google.devtools.build.lib.vfs.PathFragment;
public final class IntermediateArtifacts {
static final String LINKMAP_SUFFIX = ".linkmap";
- /**
- * Extension used for the zip archive containing dsym files and their associated plist. Note that
- * the archive's path less this extension corresponds to the expected directory for dsym files
- * relative to their binary.
- */
- static final String DSYM_ZIP_EXTENSION = ".temp.zip";
-
private final RuleContext ruleContext;
private final BuildConfiguration buildConfiguration;
private final String archiveFileNameSuffix;
@@ -322,36 +315,31 @@ public final class IntermediateArtifacts {
}
/**
- * The temp zipped debug symbol bundle file which contains debug symbols generated by dsymutil.
- */
- public Artifact tempDsymBundleZip(DsymOutputType dsymOutputType) {
- return appendExtension(dsymOutputType.getSuffix() + DSYM_ZIP_EXTENSION);
- }
-
- /**
- * Debug symbol plist generated for a linked binary.
+ * Debug symbol file generated for a stripped linked binary.
+ *
+ * <p>The name of the debug symbol file matches that of stripped binary plus that of the debug
+ * symbol file extension (.dwarf), so we must know if the binary has been stripped
+ * or not as that will modify its name.
*/
- public Artifact dsymPlist(DsymOutputType dsymOutputType) {
- return appendExtension(String.format("%s/Contents/Info.plist", dsymOutputType.getSuffix()));
+ public Artifact dsymSymbolForStrippedBinary() {
+ return dsymSymbol("bin");
}
/**
- * Debug symbol file generated for a linked binary.
+ * Debug symbol file generated for an unstripped linked binary.
+ *
+ * <p>The name of the debug symbol file matches that of unstripped binary plus that of the debug
+ * symbol file extension (.dwarf).
*/
- public Artifact dsymSymbol(DsymOutputType dsymOutputType) {
- return dsymSymbol(dsymOutputType, "bin");
+ public Artifact dsymSymbolForUnstrippedBinary() {
+ return dsymSymbol("bin_unstripped");
}
/**
* Debug symbol file generated for a linked binary, for a specific architecture.
*/
- public Artifact dsymSymbol(DsymOutputType dsymOutputType, String suffix) {
- return appendExtension(
- String.format(
- "%s/Contents/Resources/DWARF/%s_%s",
- dsymOutputType.getSuffix(),
- ruleContext.getLabel().getName(),
- suffix));
+ private Artifact dsymSymbol(String suffix) {
+ return appendExtension(String.format("_%s.dwarf", suffix));
}
/** Bitcode symbol map generated for a linked binary, for a specific architecture. */
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java
index ce853bd8b3..83d02c1874 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java
@@ -100,7 +100,7 @@ public class MultiArchBinarySupport {
* dylib symbols should be subtracted from this provider.
*/
abstract ObjcProvider objcLinkProvider();
-
+
/**
* Returns the {@link ObjcProvider} to propagate up to dependers; this will not have dylib
* symbols subtracted, thus signaling that this target is still responsible for those symbols.
@@ -184,7 +184,6 @@ public class MultiArchBinarySupport {
j2ObjcEntryClassProvider,
extraLinkArgs,
extraLinkInputs,
- DsymOutputType.APP,
dependencySpecificConfiguration.toolchain())
.validateAttributes();
ruleContext.assertNoErrors();
@@ -309,9 +308,6 @@ public class MultiArchBinarySupport {
.setAlwayslink(false)
.setLinkedBinary(intermediateArtifacts.strippedSingleArchitectureBinary());
- if (ObjcRuleClasses.objcConfiguration(ruleContext).generateDsym()) {
- commonBuilder.addDebugArtifacts(DsymOutputType.APP);
- }
return commonBuilder.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
index e7465bb3f2..6a31693cc4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
@@ -18,8 +18,6 @@ import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.ASSET_CATALOG;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.BUNDLE_FILE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.CC_LIBRARY;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DEBUG_SYMBOLS;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DEBUG_SYMBOLS_PLIST;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DEFINE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DYNAMIC_FRAMEWORK_DIR;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DYNAMIC_FRAMEWORK_FILE;
@@ -167,7 +165,6 @@ public final class ObjcCommon {
private boolean alwayslink;
private boolean hasModuleMap;
private Iterable<Artifact> extraImportLibraries = ImmutableList.of();
- private DsymOutputType dsymOutputType;
private Optional<Artifact> linkedBinary = Optional.absent();
private Optional<Artifact> linkmapFile = Optional.absent();
private Iterable<CcCompilationContext> depCcHeaderProviders = ImmutableList.of();
@@ -398,14 +395,6 @@ public final class ObjcCommon {
}
/**
- * Sets which type of dsym output this rule generated to be propagated to dependers.
- */
- Builder addDebugArtifacts(DsymOutputType dsymOutputType) {
- this.dsymOutputType = dsymOutputType;
- return this;
- }
-
- /**
* Sets a linkmap file generated by this rule to be propagated to dependers.
*/
Builder setLinkmapFile(Artifact linkmapFile) {
@@ -590,12 +579,6 @@ public final class ObjcCommon {
.addAll(LINKED_BINARY, linkedBinary.asSet())
.addAll(LINKMAP_FILE, linkmapFile.asSet());
- if (dsymOutputType != null) {
- objcProvider
- .add(DEBUG_SYMBOLS, intermediateArtifacts.dsymSymbol(dsymOutputType))
- .add(DEBUG_SYMBOLS_PLIST, intermediateArtifacts.dsymPlist(dsymOutputType));
- }
-
return new ObjcCommon(objcProvider.build(), compilationArtifacts, textualHeaders.build());
}
@@ -620,7 +603,7 @@ public final class ObjcCommon {
return false;
}
}
-
+
/**
* Returns {@code true} if the given rule context has a launch storyboard set.
*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java
index fd955b4e04..d67064750b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java
@@ -263,18 +263,6 @@ public final class ObjcProvider extends NativeInfo implements ObjcProviderApi<Ar
new Key<>(STABLE_ORDER, "nested_bundle", Bundling.class);
/**
- * Artifact containing information on debug symbols.
- */
- public static final Key<Artifact> DEBUG_SYMBOLS =
- new Key<>(STABLE_ORDER, "debug_symbols", Artifact.class);
-
- /**
- * Artifact containing the plist of the debug symbols.
- */
- public static final Key<Artifact> DEBUG_SYMBOLS_PLIST =
- new Key<>(STABLE_ORDER, "debug_symbols_plist", Artifact.class);
-
- /**
* Debug artifacts that should be exported by the top-level target.
*/
public static final Key<Artifact> EXPORTED_DEBUG_ARTIFACTS =
@@ -372,8 +360,6 @@ public final class ObjcProvider extends NativeInfo implements ObjcProviderApi<Ar
DEFINE,
DYNAMIC_FRAMEWORK_DIR,
DYNAMIC_FRAMEWORK_FILE,
- DEBUG_SYMBOLS,
- DEBUG_SYMBOLS_PLIST,
EXPORTED_DEBUG_ARTIFACTS,
FRAMEWORK_SEARCH_PATH_ONLY,
FORCE_LOAD_LIBRARY,
@@ -447,16 +433,6 @@ public final class ObjcProvider extends NativeInfo implements ObjcProviderApi<Ar
}
@Override
- public NestedSet<Artifact> debugSymbols() {
- return get(DEBUG_SYMBOLS);
- }
-
- @Override
- public NestedSet<Artifact> debugSymbolsPlist() {
- return get(DEBUG_SYMBOLS_PLIST);
- }
-
- @Override
public NestedSet<Artifact> exportedDebugArtifacts() {
return get(EXPORTED_DEBUG_ARTIFACTS);
}
@@ -986,7 +962,7 @@ public final class ObjcProvider extends NativeInfo implements ObjcProviderApi<Ar
}
return this;
}
-
+
/**
* Add all keys and values from the given provider, but propagate any normally-propagated items
* only to direct dependers of this ObjcProvider.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcVariablesExtension.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcVariablesExtension.java
index f7df33f755..876eea4e8c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcVariablesExtension.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcVariablesExtension.java
@@ -30,7 +30,6 @@ import com.google.devtools.build.lib.rules.apple.ApplePlatform;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.StringSequenceBuilder;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.VariablesExtension;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
import java.util.Set;
/** Build variable extensions for templating a toolchain for objc builds. */
@@ -62,7 +61,6 @@ class ObjcVariablesExtension implements VariablesExtension {
// dsym variables
static final String DSYM_PATH_VARIABLE_NAME = "dsym_path";
- static final String DSYM_BUNDLE_ZIP_VARIABLE_NAME = "dsym_bundle_zip";
// ARC variables. Mutually exclusive.
static final String OBJC_ARC_VARIABLE_NAME = "objc_arc";
@@ -79,7 +77,7 @@ class ObjcVariablesExtension implements VariablesExtension {
private final ImmutableSet<Artifact> forceLoadArtifacts;
private final ImmutableList<String> attributeLinkopts;
private final ImmutableSet<VariableCategory> activeVariableCategories;
- private final Artifact dsymBundleZip;
+ private final Artifact dsymSymbol;
private final Artifact linkmap;
private final Artifact bitcodeSymbolMap;
private boolean arcEnabled = true;
@@ -96,7 +94,7 @@ class ObjcVariablesExtension implements VariablesExtension {
ImmutableSet<Artifact> forceLoadArtifacts,
ImmutableList<String> attributeLinkopts,
ImmutableSet<VariableCategory> activeVariableCategories,
- Artifact dsymBundleZip,
+ Artifact dsymSymbol,
Artifact linkmap,
Artifact bitcodeSymbolMap,
boolean arcEnabled) {
@@ -111,7 +109,7 @@ class ObjcVariablesExtension implements VariablesExtension {
this.forceLoadArtifacts = forceLoadArtifacts;
this.attributeLinkopts = attributeLinkopts;
this.activeVariableCategories = activeVariableCategories;
- this.dsymBundleZip = dsymBundleZip;
+ this.dsymSymbol = dsymSymbol;
this.linkmap = linkmap;
this.bitcodeSymbolMap = bitcodeSymbolMap;
this.arcEnabled = arcEnabled;
@@ -236,11 +234,7 @@ class ObjcVariablesExtension implements VariablesExtension {
}
private void addDsymVariables(CcToolchainVariables.Builder builder) {
- builder.addStringVariable(
- DSYM_BUNDLE_ZIP_VARIABLE_NAME, dsymBundleZip.getShellEscapedExecPathString());
- builder.addStringVariable(
- DSYM_PATH_VARIABLE_NAME,
- FileSystemUtils.removeExtension(dsymBundleZip.getExecPath()).getPathString());
+ builder.addStringVariable(DSYM_PATH_VARIABLE_NAME, dsymSymbol.getShellEscapedExecPathString());
}
private void addLinkmapVariables(CcToolchainVariables.Builder builder) {
@@ -264,7 +258,7 @@ class ObjcVariablesExtension implements VariablesExtension {
private ImmutableSet<Artifact> forceLoadArtifacts;
private ImmutableList<String> libraryNames;
private ImmutableList<String> attributeLinkopts;
- private Artifact dsymBundleZip;
+ private Artifact dsymSymbol;
private Artifact linkmap;
private Artifact bitcodeSymbolMap;
private boolean arcEnabled = true;
@@ -313,34 +307,34 @@ class ObjcVariablesExtension implements VariablesExtension {
this.frameworkNames = Preconditions.checkNotNull(frameworkNames);
return this;
}
-
+
/** Sets binary input files to be passed to the linker with "-l" flags. */
public Builder setLibraryNames(ImmutableList<String> libraryNames) {
this.libraryNames = Preconditions.checkNotNull(libraryNames);
return this;
}
-
+
/** Sets artifacts to be passed to the linker with {@code -force_load}. */
public Builder setForceLoadArtifacts(ImmutableSet<Artifact> forceLoadArtifacts) {
this.forceLoadArtifacts = Preconditions.checkNotNull(forceLoadArtifacts);
return this;
}
-
+
/** Sets linkopts arising from rule attributes. */
public Builder setAttributeLinkopts(ImmutableList<String> attributeLinkopts) {
this.attributeLinkopts = Preconditions.checkNotNull(attributeLinkopts);
return this;
}
-
+
/** Sets the given {@link VariableCategory} as active for this extension. */
public Builder addVariableCategory(VariableCategory variableCategory) {
this.activeVariableCategoriesBuilder.add(Preconditions.checkNotNull(variableCategory));
return this;
}
- /** Sets the Artifact for the zipped dsym bundle. */
- public Builder setDsymBundleZip(Artifact dsymBundleZip) {
- this.dsymBundleZip = dsymBundleZip;
+ /** Sets the Artifact for the dsym symbol file. */
+ public Builder setDsymSymbol(Artifact dsymSymbol) {
+ this.dsymSymbol = dsymSymbol;
return this;
}
@@ -363,10 +357,10 @@ class ObjcVariablesExtension implements VariablesExtension {
}
public ObjcVariablesExtension build() {
-
+
ImmutableSet<VariableCategory> activeVariableCategories =
activeVariableCategoriesBuilder.build();
-
+
Preconditions.checkNotNull(ruleContext, "missing RuleContext");
Preconditions.checkNotNull(objcProvider, "missing ObjcProvider");
Preconditions.checkNotNull(buildConfiguration, "missing BuildConfiguration");
@@ -384,7 +378,7 @@ class ObjcVariablesExtension implements VariablesExtension {
Preconditions.checkNotNull(attributeLinkopts, "missing attribute linkopts");
}
if (activeVariableCategories.contains(VariableCategory.DSYM_VARIABLES)) {
- Preconditions.checkNotNull(dsymBundleZip, "missing dsym bundle zip artifact");
+ Preconditions.checkNotNull(dsymSymbol, "missing dsym symbol artifact");
}
if (activeVariableCategories.contains(VariableCategory.LINKMAP_VARIABLES)) {
Preconditions.checkNotNull(linkmap, "missing linkmap artifact");
@@ -405,7 +399,7 @@ class ObjcVariablesExtension implements VariablesExtension {
forceLoadArtifacts,
attributeLinkopts,
activeVariableCategories,
- dsymBundleZip,
+ dsymSymbol,
linkmap,
bitcodeSymbolMap,
arcEnabled);