Merge "Rename jetifier property and add it to androidmk" am: 4ada982da9

am: 33938d3188

Change-Id: If3091a403e82cb0ca19d87f812e51d3257a119ed
This commit is contained in:
Colin Cross
2019-03-22 23:28:53 -07:00
committed by android-build-merger
4 changed files with 7 additions and 4 deletions

View File

@@ -201,6 +201,7 @@ func init() {
"LOCAL_DEX_PREOPT_GENERATE_PROFILE": "dex_preopt.profile_guided", "LOCAL_DEX_PREOPT_GENERATE_PROFILE": "dex_preopt.profile_guided",
"LOCAL_PRIVATE_PLATFORM_APIS": "platform_apis", "LOCAL_PRIVATE_PLATFORM_APIS": "platform_apis",
"LOCAL_JETIFIER_ENABLED": "jetifier",
}) })
} }

View File

@@ -631,12 +631,14 @@ include $(call all-makefiles-under,$(LOCAL_PATH))
LOCAL_SRC_FILES := test.jar LOCAL_SRC_FILES := test.jar
LOCAL_MODULE_CLASS := JAVA_LIBRARIES LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_STATIC_ANDROID_LIBRARIES := LOCAL_STATIC_ANDROID_LIBRARIES :=
LOCAL_JETIFIER_ENABLED := true
include $(BUILD_PREBUILT) include $(BUILD_PREBUILT)
`, `,
expected: ` expected: `
java_import { java_import {
jars: ["test.jar"], jars: ["test.jar"],
jetifier: true,
} }
`, `,
}, },

View File

@@ -446,7 +446,7 @@ type AARImportProperties struct {
Libs []string Libs []string
// if set to true, run Jetifier against .aar file. Defaults to false. // if set to true, run Jetifier against .aar file. Defaults to false.
Jetifier_enabled *bool Jetifier *bool
} }
type AARImport struct { type AARImport struct {
@@ -540,7 +540,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
aarName := ctx.ModuleName() + ".aar" aarName := ctx.ModuleName() + ".aar"
var aar android.Path var aar android.Path
aar = android.PathForModuleSrc(ctx, a.properties.Aars[0]) aar = android.PathForModuleSrc(ctx, a.properties.Aars[0])
if Bool(a.properties.Jetifier_enabled) { if Bool(a.properties.Jetifier) {
inputFile := aar inputFile := aar
aar = android.PathForModuleOut(ctx, "jetifier", aarName) aar = android.PathForModuleOut(ctx, "jetifier", aarName)
TransformJetifier(ctx, aar.(android.WritablePath), inputFile) TransformJetifier(ctx, aar.(android.WritablePath), inputFile)

View File

@@ -1726,7 +1726,7 @@ type ImportProperties struct {
Exclude_dirs []string Exclude_dirs []string
// if set to true, run Jetifier against .jar file. Defaults to false. // if set to true, run Jetifier against .jar file. Defaults to false.
Jetifier_enabled *bool Jetifier *bool
} }
type Import struct { type Import struct {
@@ -1771,7 +1771,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
outputFile := android.PathForModuleOut(ctx, "combined", jarName) outputFile := android.PathForModuleOut(ctx, "combined", jarName)
TransformJarsToJar(ctx, outputFile, "for prebuilts", jars, android.OptionalPath{}, TransformJarsToJar(ctx, outputFile, "for prebuilts", jars, android.OptionalPath{},
false, j.properties.Exclude_files, j.properties.Exclude_dirs) false, j.properties.Exclude_files, j.properties.Exclude_dirs)
if Bool(j.properties.Jetifier_enabled) { if Bool(j.properties.Jetifier) {
inputFile := outputFile inputFile := outputFile
outputFile = android.PathForModuleOut(ctx, "jetifier", jarName) outputFile = android.PathForModuleOut(ctx, "jetifier", jarName)
TransformJetifier(ctx, outputFile, inputFile) TransformJetifier(ctx, outputFile, inputFile)