aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-05-03 11:03:56 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-05-03 17:25:14 +0200
commitfd6c97061906a38a1b4b3500d0cf3829e4d45725 (patch)
treeb3ddbdf89e512400a0c35e207ff634e5a52fbb34 /src/tools
parent8598824a26434167108a5a4925a971b498af109f (diff)
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
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java14
1 files changed, 13 insertions, 1 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 ca7032e4bc..38773071a1 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
@@ -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;
}