Add skip-sdk-check to extract_apks
Add skip-sdk-check to skip checking the SDK version when extracting an APK/APEX from an App Set Bundle. This can be used when the platform SDK version is not defined and the APEXs/APKs use SHA based SDK versions. This check should not be set to true for non Beta dessert releases Bug: 274518686 Test: # Add SHA targeting modules to platform m SOONG_SKIP_APPSET_SDK_CHECK=true #Build Passes m SOONG_SKIP_APPSET_SDK_CHECK=false #Build Fails m #No config supplied, build fails Change-Id: I1919437d3410f09c991e1de39031bd88e1f8246a
This commit is contained in:
parent
94d107020a
commit
51645ff23e
5 changed files with 18 additions and 5 deletions
|
@ -35,11 +35,12 @@ var (
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `rm -rf "$out" && ` +
|
Command: `rm -rf "$out" && ` +
|
||||||
`${extract_apks} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
|
`${extract_apks} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
|
||||||
`-sdk-version=${sdk-version} -abis=${abis} -screen-densities=all -extract-single ` +
|
`-sdk-version=${sdk-version} -skip-sdk-check=${skip-sdk-check} -abis=${abis} ` +
|
||||||
|
`-screen-densities=all -extract-single ` +
|
||||||
`${in}`,
|
`${in}`,
|
||||||
CommandDeps: []string{"${extract_apks}"},
|
CommandDeps: []string{"${extract_apks}"},
|
||||||
},
|
},
|
||||||
"abis", "allow-prereleased", "sdk-version")
|
"abis", "allow-prereleased", "sdk-version", "skip-sdk-check")
|
||||||
)
|
)
|
||||||
|
|
||||||
type prebuilt interface {
|
type prebuilt interface {
|
||||||
|
@ -845,6 +846,7 @@ func (p *prebuiltApexExtractorModule) GenerateAndroidBuildActions(ctx android.Mo
|
||||||
"abis": strings.Join(abis, ","),
|
"abis": strings.Join(abis, ","),
|
||||||
"allow-prereleased": strconv.FormatBool(proptools.BoolDefault(p.properties.Prerelease, defaultAllowPrerelease)),
|
"allow-prereleased": strconv.FormatBool(proptools.BoolDefault(p.properties.Prerelease, defaultAllowPrerelease)),
|
||||||
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
|
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
|
||||||
|
"skip-sdk-check": strconv.FormatBool(ctx.Config().IsEnvTrue("SOONG_SKIP_APPSET_SDK_CHECK")),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ type TargetConfig struct {
|
||||||
abis map[android_bundle_proto.Abi_AbiAlias]int
|
abis map[android_bundle_proto.Abi_AbiAlias]int
|
||||||
allowPrereleased bool
|
allowPrereleased bool
|
||||||
stem string
|
stem string
|
||||||
|
skipSdkCheck bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// An APK set is a zip archive. An entry 'toc.pb' describes its contents.
|
// An APK set is a zip archive. An entry 'toc.pb' describes its contents.
|
||||||
|
@ -322,6 +323,12 @@ type sdkVersionTargetingMatcher struct {
|
||||||
|
|
||||||
func (m sdkVersionTargetingMatcher) matches(config TargetConfig) bool {
|
func (m sdkVersionTargetingMatcher) matches(config TargetConfig) bool {
|
||||||
const preReleaseVersion = 10000
|
const preReleaseVersion = 10000
|
||||||
|
// TODO (b274518686) This check should only be used while SHA based targeting is active
|
||||||
|
// Once we have switched to an SDK version, this can be changed to throw an error if
|
||||||
|
// it was accidentally set
|
||||||
|
if config.skipSdkCheck == true {
|
||||||
|
return true
|
||||||
|
}
|
||||||
if m.SdkVersionTargeting == nil {
|
if m.SdkVersionTargeting == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -572,7 +579,7 @@ func (s screenDensityFlagValue) Set(densityList string) error {
|
||||||
func processArgs() {
|
func processArgs() {
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Fprintln(os.Stderr, `usage: extract_apks -o <output-file> [-zip <output-zip-file>] `+
|
fmt.Fprintln(os.Stderr, `usage: extract_apks -o <output-file> [-zip <output-zip-file>] `+
|
||||||
`-sdk-version value -abis value `+
|
`-sdk-version value -abis value [-skip-sdk-check]`+
|
||||||
`-screen-densities value {-stem value | -extract-single} [-allow-prereleased] `+
|
`-screen-densities value {-stem value | -extract-single} [-allow-prereleased] `+
|
||||||
`[-apkcerts <apkcerts output file> -partition <partition>] <APK set>`)
|
`[-apkcerts <apkcerts output file> -partition <partition>] <APK set>`)
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
|
@ -585,6 +592,7 @@ func processArgs() {
|
||||||
"'all' or comma-separated list of screen density names (NODPI LDPI MDPI TVDPI HDPI XHDPI XXHDPI XXXHDPI)")
|
"'all' or comma-separated list of screen density names (NODPI LDPI MDPI TVDPI HDPI XHDPI XXHDPI XXXHDPI)")
|
||||||
flag.BoolVar(&targetConfig.allowPrereleased, "allow-prereleased", false,
|
flag.BoolVar(&targetConfig.allowPrereleased, "allow-prereleased", false,
|
||||||
"allow prereleased")
|
"allow prereleased")
|
||||||
|
flag.BoolVar(&targetConfig.skipSdkCheck, "skip-sdk-check", false, "Skip the SDK version check")
|
||||||
flag.StringVar(&targetConfig.stem, "stem", "", "output entries base name in the output zip file")
|
flag.StringVar(&targetConfig.stem, "stem", "", "output entries base name in the output zip file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if (*outputFile == "") || len(flag.Args()) != 1 || *version == 0 ||
|
if (*outputFile == "") || len(flag.Args()) != 1 || *version == 0 ||
|
||||||
|
|
|
@ -142,6 +142,7 @@ func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
||||||
"allow-prereleased": strconv.FormatBool(proptools.Bool(as.properties.Prerelease)),
|
"allow-prereleased": strconv.FormatBool(proptools.Bool(as.properties.Prerelease)),
|
||||||
"screen-densities": screenDensities,
|
"screen-densities": screenDensities,
|
||||||
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
|
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
|
||||||
|
"skip-sdk-check": strconv.FormatBool(ctx.Config().IsEnvTrue("SOONG_SKIP_APPSET_SDK_CHECK")),
|
||||||
"stem": as.BaseModuleName(),
|
"stem": as.BaseModuleName(),
|
||||||
"apkcerts": as.apkcertsFile.String(),
|
"apkcerts": as.apkcertsFile.String(),
|
||||||
"partition": as.PartitionTag(ctx.DeviceConfig()),
|
"partition": as.PartitionTag(ctx.DeviceConfig()),
|
||||||
|
|
|
@ -89,6 +89,7 @@ func TestAndroidAppSet_Variants(t *testing.T) {
|
||||||
"allow-prereleased": "false",
|
"allow-prereleased": "false",
|
||||||
"screen-densities": "LDPI,XXHDPI",
|
"screen-densities": "LDPI,XXHDPI",
|
||||||
"sdk-version": "29",
|
"sdk-version": "29",
|
||||||
|
"skip-sdk-check": "false",
|
||||||
"stem": "foo",
|
"stem": "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -105,6 +106,7 @@ func TestAndroidAppSet_Variants(t *testing.T) {
|
||||||
"allow-prereleased": "false",
|
"allow-prereleased": "false",
|
||||||
"screen-densities": "all",
|
"screen-densities": "all",
|
||||||
"sdk-version": "30",
|
"sdk-version": "30",
|
||||||
|
"skip-sdk-check": "false",
|
||||||
"stem": "foo",
|
"stem": "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -131,13 +131,13 @@ var (
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `rm -rf "$out" && ` +
|
Command: `rm -rf "$out" && ` +
|
||||||
`${config.ExtractApksCmd} -o "${out}" -zip "${zip}" -allow-prereleased=${allow-prereleased} ` +
|
`${config.ExtractApksCmd} -o "${out}" -zip "${zip}" -allow-prereleased=${allow-prereleased} ` +
|
||||||
`-sdk-version=${sdk-version} -abis=${abis} ` +
|
`-sdk-version=${sdk-version} -skip-sdk-check=${skip-sdk-check} -abis=${abis} ` +
|
||||||
`--screen-densities=${screen-densities} --stem=${stem} ` +
|
`--screen-densities=${screen-densities} --stem=${stem} ` +
|
||||||
`-apkcerts=${apkcerts} -partition=${partition} ` +
|
`-apkcerts=${apkcerts} -partition=${partition} ` +
|
||||||
`${in}`,
|
`${in}`,
|
||||||
CommandDeps: []string{"${config.ExtractApksCmd}"},
|
CommandDeps: []string{"${config.ExtractApksCmd}"},
|
||||||
},
|
},
|
||||||
"abis", "allow-prereleased", "screen-densities", "sdk-version", "stem", "apkcerts", "partition", "zip")
|
"abis", "allow-prereleased", "screen-densities", "sdk-version", "skip-sdk-check", "stem", "apkcerts", "partition", "zip")
|
||||||
|
|
||||||
turbine, turbineRE = pctx.RemoteStaticRules("turbine",
|
turbine, turbineRE = pctx.RemoteStaticRules("turbine",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
|
|
Loading…
Reference in a new issue