Skip to content

Commit

Permalink
Remove DynamicModeFlag and thus fix crash caused by passing --dynamic…
Browse files Browse the repository at this point in the history
…_mode=auto on the command line.

--
PiperOrigin-RevId: 147824992
MOS_MIGRATED_REVID=147824992
  • Loading branch information
lberki authored and dslomov committed Feb 17, 2017
1 parent 4afb4b5 commit 821ee9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.Attribute.SplitTransition;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.DynamicMode;
import com.google.devtools.build.lib.rules.cpp.CppOptions.DynamicModeConverter;
import com.google.devtools.build.lib.rules.cpp.CppOptions.DynamicModeFlag;
import com.google.devtools.common.options.Converter;
import com.google.devtools.common.options.Converters;
import com.google.devtools.common.options.EnumConverter;
Expand Down Expand Up @@ -250,7 +250,7 @@ public static class Options extends FragmentOptions {
+ "whether to link dynamically. 'fully' means all libraries will be linked "
+ "dynamically. 'off' means that all libraries will be linked in mostly static mode."
)
public DynamicModeFlag dynamicMode;
public DynamicMode dynamicMode;

// Label of filegroup combining all Android tools used as implicit dependencies of
// android_* rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,7 @@ protected CppConfiguration(CppConfigurationParameters params)
// TODO(bazel-team): implement dynamic linking with LIPO
this.dynamicMode = DynamicMode.OFF;
} else {
switch (cppOptions.dynamicMode) {
case DEFAULT:
this.dynamicMode = DynamicMode.DEFAULT; break;
case OFF: this.dynamicMode = DynamicMode.OFF; break;
case FULLY: this.dynamicMode = DynamicMode.FULLY; break;
default: throw new IllegalStateException("Invalid dynamicMode.");
}
this.dynamicMode = cppOptions.dynamicMode;
}

this.fdoZip = params.fdoZip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.devtools.build.lib.analysis.config.PerLabelOptions;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.DynamicMode;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.LibcTop;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.StripMode;
import com.google.devtools.build.lib.util.OptionsUtils;
Expand Down Expand Up @@ -69,21 +70,11 @@ public String getTypeDescription() {
}

/**
* The same as DynamicMode, but on command-line we also allow AUTO.
* Converter for {@link DynamicMode}
*/
public enum DynamicModeFlag {
OFF,
DEFAULT,
FULLY,
AUTO
}

/**
* Converter for DynamicModeFlag
*/
public static class DynamicModeConverter extends EnumConverter<DynamicModeFlag> {
public static class DynamicModeConverter extends EnumConverter<DynamicMode> {
public DynamicModeConverter() {
super(DynamicModeFlag.class, "dynamic mode");
super(DynamicMode.class, "dynamic mode");
}
}

Expand Down Expand Up @@ -226,7 +217,7 @@ public LipoModeConverter() {
+ "will be linked dynamically. 'off' means that all libraries will be linked "
+ "in mostly static mode."
)
public DynamicModeFlag dynamicMode;
public DynamicMode dynamicMode;

@Option(
name = "experimental_link_compile_output_separately",
Expand Down

0 comments on commit 821ee9b

Please sign in to comment.