blob: c456e5c296d2676b825326819e4cf3fb0ffe83d6 [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/layout/layout1.xml",
],
out: [
"values_bools.arsc.flat",
"values_bools2.arsc.flat",
"values_ints.arsc.flat",
"values_strings.arsc.flat",
"layout_layout1.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",
}