diff options
author | kmb <kmb@google.com> | 2018-02-26 13:56:47 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-26 13:58:04 -0800 |
commit | cc090ed9b8544deea7a7c5cab17b263926e8c48b (patch) | |
tree | de7990cdcf71994c1affb29b210c91d9e8985559 /src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java | |
parent | 8c72ffb4661b74ce0466d0fb68fe10af7bc54582 (diff) |
add binary flag for core library desugaring and gate existing configuration flags by it.
RELNOTES: None.
PiperOrigin-RevId: 187075897
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java index eee88027b4..0fad8c2e46 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java @@ -196,6 +196,15 @@ class Desugar { public boolean tolerateMissingDependencies; @Option( + name = "desugar_supported_core_libs", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = "Enable core library desugaring, which requires configuration with related flags." + ) + public boolean desugarCoreLibs; + + @Option( name = "desugar_interface_method_bodies_if_needed", defaultValue = "true", category = "misc", @@ -393,15 +402,14 @@ class Desugar { ImmutableSet.Builder<String> interfaceLambdaMethodCollector = ImmutableSet.builder(); ClassVsInterface interfaceCache = new ClassVsInterface(classpathReader); CoreLibrarySupport coreLibrarySupport = - options.rewriteCoreLibraryPrefixes.isEmpty() - && options.emulateCoreLibraryInterfaces.isEmpty() - ? null - : new CoreLibrarySupport( + options.desugarCoreLibs + ? new CoreLibrarySupport( rewriter, loader, - ImmutableList.copyOf(options.rewriteCoreLibraryPrefixes), - ImmutableList.copyOf(options.emulateCoreLibraryInterfaces), - options.retargetCoreLibraryMembers); + options.rewriteCoreLibraryPrefixes, + options.emulateCoreLibraryInterfaces, + options.retargetCoreLibraryMembers) + : null; desugarClassesInInput( inputFiles, @@ -900,6 +908,10 @@ class Desugar { for (Path path : options.bootclasspath) { checkArgument(!Files.isDirectory(path), "Bootclasspath entry must be a jar file: %s", path); } + checkArgument(!options.desugarCoreLibs + || !options.rewriteCoreLibraryPrefixes.isEmpty() + || !options.emulateCoreLibraryInterfaces.isEmpty(), + "--desugar_supported_core_libs requires specifying renamed and/or emulated core libraries"); return options; } |