blob: 1b0f99753ce61dc7f50c227a4dfeeef948b0e89e [file] [log] [blame]
// Copyright (C) 2024 The Android Open Source Project
//
// 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
default_team: "trendy_team_android_resources",
}
genrule {
name: "resource-flagging-test-app-compile",
tools: ["aapt2"],
srcs: [
"res/values/bools.xml",
"res/values/bools2.xml",
"res/values/ints.xml",
"res/values/strings.xml",
"res/values/styles.xml",
"res/layout/layout1.xml",
"res/layout/layout3.xml",
"res/flag(test.package.falseFlag)/values/bools.xml",
"res/flag(test.package.falseFlag)/layout/layout2.xml",
"res/flag(test.package.falseFlag)/drawable/removedpng.png",
"res/flag(test.package.trueFlag)/layout/layout3.xml",
"res/values/flag(test.package.trueFlag)/bools.xml",
"res/values/flag(!test.package.trueFlag)/bools.xml",
"res/values/flag(!test.package.falseFlag)/bools.xml",
],
out: [
"drawable_removedpng.(test.package.falseFlag).png.flat",
"values_bools.arsc.flat",
"values_bools.(test.package.falseFlag).arsc.flat",
"values_bools.(test.package.trueFlag).arsc.flat",
"values_bools.(!test.package.falseFlag).arsc.flat",
"values_bools.(!test.package.trueFlag).arsc.flat",
"values_bools2.arsc.flat",
"values_ints.arsc.flat",
"values_strings.arsc.flat",
"values_styles.arsc.flat",
"layout_layout1.xml.flat",
"layout_layout2.(test.package.falseFlag).xml.flat",
"layout_layout3.xml.flat",
"layout_layout3.(test.package.trueFlag).xml.flat",
],
cmd: "$(location aapt2) compile $(in) -o $(genDir) " +
"--feature-flags test.package.falseFlag:ro=false,test.package.trueFlag:ro=true",
}
genrule {
name: "resource-flagging-test-app-apk",
tools: ["aapt2"],
// The first input file in the list must be the manifest
srcs: [
"AndroidManifest.xml",
":resource-flagging-test-app-compile",
],
out: [
"resapp.apk",
],
cmd: "$(location aapt2) link -o $(out) --manifest $(in) " +
"-I $(location :current_android_jar) " +
"--feature-flags test.package.falseFlag:ro=false,test.package.trueFlag:ro=true",
tool_files: [":current_android_jar"],
}
genrule {
name: "resource-flagging-test-app-r-java",
tools: ["aapt2"],
// The first input file in the list must be the manifest
srcs: [
"AndroidManifest.xml",
":resource-flagging-test-app-compile",
],
out: [
"resource-flagging-java/com/android/intenal/flaggedresources/R.java",
],
cmd: "$(location aapt2) link -o $(genDir)/resapp.apk --java $(genDir)/resource-flagging-java --manifest $(in) " +
"-I $(location :current_android_jar) " +
"--feature-flags test.package.falseFlag:ro=false,test.package.trueFlag:ro=true",
tool_files: [":current_android_jar"],
}
java_genrule {
name: "resource-flagging-test-app-apk-as-resource",
srcs: [
":resource-flagging-test-app-apk",
],
out: ["apks_as_resources.res.zip"],
tools: ["soong_zip"],
cmd: "mkdir -p $(genDir)/res/raw && " +
"cp $(in) $(genDir)/res/raw/$$(basename $(in)) && " +
"$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
}