aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
index dc7326d56e..3b09fc991f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/LegacyCompilationSupport.java
@@ -44,6 +44,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
+import com.google.devtools.build.lib.actions.CommandLineExpansionException;
import com.google.devtools.build.lib.analysis.OutputGroupProvider;
import com.google.devtools.build.lib.analysis.PrerequisiteArtifacts;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
@@ -590,9 +591,17 @@ public class LegacyCompilationSupport extends CompilationSupport {
}
private StrippingType getStrippingType(CommandLine commandLine) {
- return Iterables.contains(commandLine.arguments(), "-dynamiclib")
- ? StrippingType.DYNAMIC_LIB
- : StrippingType.DEFAULT;
+ try {
+ return Iterables.contains(commandLine.arguments(), "-dynamiclib")
+ ? StrippingType.DYNAMIC_LIB
+ : StrippingType.DEFAULT;
+ } catch (CommandLineExpansionException e) {
+ // TODO(b/64941219): This code should be rewritten to not expand the command line
+ // in the analysis phase
+ // This can't actually happen, because the command lines used by this class do
+ // not throw.
+ throw new AssertionError("Cannot fail to expand command line but did.", e);
+ }
}
private void registerLinkAction(
@@ -789,7 +798,7 @@ public class LegacyCompilationSupport extends CompilationSupport {
}
@Override
- public Iterable<String> arguments() {
+ public Iterable<String> arguments() throws CommandLineExpansionException {
return ImmutableList.of(Joiner.on(' ').join(original.arguments()));
}
}