diff options
author | Patrick Donelan <pdonelan@google.com> | 2016-11-21 02:08:47 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-11-21 19:40:36 +0000 |
commit | af25a98a7af734926f6d29187818ce4140b4f3e8 (patch) | |
tree | b1b380b63c32091d036e9753b92ea0a9cb5fe9b9 /src | |
parent | 75c88b8e0a7d793ccbe65efa20bde32007bd35ca (diff) |
Turn on j2objc's -g flag (source debugging) by default
Can be disabled via:
--j2objc_translation_flags=-g:none
--
MOS_MIGRATED_REVID=139738308
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java index da3fe1a1da..864eb9b0b9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.rules.objc; import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment; import com.google.devtools.build.lib.analysis.config.BuildOptions; @@ -25,7 +26,7 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventHandler; import java.util.Collections; -import java.util.Set; +import java.util.List; /** * A J2ObjC transpiler configuration fragment containing J2ObjC translation flags. @@ -35,21 +36,29 @@ import java.util.Set; @Immutable public class J2ObjcConfiguration extends Fragment { /** - * Always-on flags for J2ObjC translation. These flags will always be used for invoking the J2ObjC - * transpiler. See http://j2objc.org/docs/j2objc.html for flag documentation. + * Always-on flags for J2ObjC translation. These flags are always used when invoking the J2ObjC + * transpiler, and cannot be overriden by user-specified flags in {@link + * J2ObjcCommandLineOptions}. See http://j2objc.org/docs/j2objc.html for flag documentation. */ - private static final Set<String> J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS = ImmutableSet.of( + private static final List<String> J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS = ImmutableList.of( "-encoding", "UTF-8", "--doc-comments", "-XcombineJars"); /** - * Allowed flags for J2ObjC translation. See http://j2objc.org/docs/j2objc.html for flag + * Default flags for J2ObjC translation. These flags are used by default when invoking the J2ObjC + * transpiler, but can be overriden by user-specified flags in {@link J2ObjcCommandLineOptions}. + * See http://j2objc.org/docs/j2objc.html for flag documentation. + */ + private static final List<String> J2OBJC_DEFAULT_TRANSLATION_FLAGS = ImmutableList.of("-g"); + + /** + * Disallowed flags for J2ObjC translation. See http://j2objc.org/docs/j2objc.html for flag * documentation. */ - static final Set<String> J2OBJC_BLACKLISTED_TRANSLATION_FLAGS = - ImmutableSet.of("--prefixes", "--prefix", "-x"); + static final List<String> J2OBJC_BLACKLISTED_TRANSLATION_FLAGS = + ImmutableList.of("--prefixes", "--prefix", "-x"); static final String INVALID_TRANSLATION_FLAGS_MSG_TEMPLATE = "J2Objc translation flags: %s not supported. Unsupported flags are: %s"; @@ -74,7 +83,7 @@ public class J2ObjcConfiguration extends Fragment { } } - private final Set<String> translationFlags; + private final List<String> translationFlags; private final boolean removeDeadCode; private final boolean explicitJreDeps; private final boolean annotationProcessingEnabled; @@ -82,7 +91,8 @@ public class J2ObjcConfiguration extends Fragment { J2ObjcConfiguration(J2ObjcCommandLineOptions j2ObjcOptions) { this.removeDeadCode = j2ObjcOptions.removeDeadCode; this.explicitJreDeps = j2ObjcOptions.explicitJreDeps; - this.translationFlags = ImmutableSet.<String>builder() + this.translationFlags = ImmutableList.<String>builder() + .addAll(J2OBJC_DEFAULT_TRANSLATION_FLAGS) .addAll(j2ObjcOptions.translationFlags) .addAll(J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS) .build(); @@ -91,8 +101,9 @@ public class J2ObjcConfiguration extends Fragment { /** * Returns the translation flags used to invoke the J2ObjC transpiler. The returned flags contain - * both the always-on flags from {@link #J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS} and user-specified - * flags from {@link J2ObjcCommandLineOptions}. The set of valid flags can be found at + * the default flags from {@link #J2OBJC_DEFAULT_TRANSLATION_FLAGS}, user-specified flags from + * {@link J2ObjcCommandLineOptions}, and always-on flags from {@link + * #J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS}. The set of disallowed flags can be found at * {@link #J2OBJC_BLACKLISTED_TRANSLATION_FLAGS}. */ public Iterable<String> getTranslationFlags() { |