diff options
author | Googler <noreply@google.com> | 2017-05-03 11:03:56 +0200 |
---|---|---|
committer | Ivan Gavrilovic <gavra@google.com> | 2017-05-03 17:35:58 +0100 |
commit | 806b9ea57b39682285557e163f59c67d040c13c2 (patch) | |
tree | 9f62b328f16a7309a5d4f6e0d5944f4a0e344785 | |
parent | 885bce7f8d296b091d15c0007a7716f01c3fee33 (diff) | |
download | desugar-806b9ea57b39682285557e163f59c67d040c13c2.tar.gz |
Option for try-with-resources runtime classes
Add flag to disable output of the runtime classes
necessary to support the try-with-resources feature
on older devices.
RELNOTES: n/a
PiperOrigin-RevId: 154933632
GitOrigin-RevId: fd6c97061906a38a1b4b3500d0cf3829e4d45725
Change-Id: I0f2fcbd4f7dc16b1cd5a1e6b62b0f9f95bec9854
-rw-r--r-- | java/com/google/devtools/build/android/desugar/Desugar.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/com/google/devtools/build/android/desugar/Desugar.java b/java/com/google/devtools/build/android/desugar/Desugar.java index ca7032e..3877307 100644 --- a/java/com/google/devtools/build/android/desugar/Desugar.java +++ b/java/com/google/devtools/build/android/desugar/Desugar.java @@ -171,6 +171,16 @@ class Desugar { public boolean desugarTryWithResourcesIfNeeded; @Option( + name = "desugar_try_with_resources_omit_runtime_classes", + defaultValue = "false", + category = "misc", + help = + "Omits the runtime classes necessary to support try-with-resources from the output. " + + "This property has effect only if --desugar_try_with_resources_if_needed is used." + ) + public boolean desugarTryWithResourcesOmitRuntimeClasses; + + @Option( name = "copy_bridges_from_classpath", defaultValue = "false", category = "misc", @@ -306,7 +316,9 @@ class Desugar { } private void copyThrowableExtensionClass(OutputFileProvider outputFileProvider) { - if (!outputJava7 || !options.desugarTryWithResourcesIfNeeded) { + if (!outputJava7 + || !options.desugarTryWithResourcesIfNeeded + || options.desugarTryWithResourcesOmitRuntimeClasses) { // try-with-resources statements are okay in the output jar. return; } |