Skip to content

Commit

Permalink
Consistent min API level for desugar and dexing
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 447922944
  • Loading branch information
sgjesse authored and copybara-github committed May 11, 2022
1 parent 4d382b7 commit f02e2fa
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private DexConsumer dexEntry(
builder
.setProgramConsumer(consumer)
.setMode(mode)
.setMinApiLevel(13) // H_MR2.
.setMinApiLevel(Constants.MIN_API_LEVEL)
.setDisableDesugaring(true)
.setIntermediate(true);
try (InputStream stream = zipFile.getInputStream(classEntry)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public static class Options extends OptionsBase {

@Option(
name = "min-sdk-version",
defaultValue = "1",
defaultValue = "13", // Same as Constants.MIN_API_LEVEL.
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
allowMultiple = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2020 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.android.r8;

/** Constants shared by desugaring and dexing. */
public class Constants {
// When changing this also change the defaultValue for min-sdk-version in CompatDx.java,
// CoreLibraryDesugaring and Desugar.java. The defaultValue for annotation parameters must be
// compile time constants, and a "public final String" value is rejected.
public static final int MIN_API_LEVEL = 13;

private Constants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static class DesugarOptions extends OptionsBase {

@Option(
name = "min_sdk_version",
defaultValue = "1",
defaultValue = "13", // Same as Constants.MIN_API_LEVEL.
category = "misc",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static class DesugarOptions extends OptionsBase {

@Option(
name = "min_sdk_version",
defaultValue = "1",
defaultValue = "13", // Same as Constants.MIN_API_LEVEL.
category = "misc",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
Expand Down

0 comments on commit f02e2fa

Please sign in to comment.