blob: 4866d2c83c71ea053a2a98db7cd100afe858fb24 [file] [log] [blame]
Jeremy Meyer16c83af2024-07-26 16:21:49 -07001// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16 // See: http://go/android-license-faq
17 // A large-scale-change added 'default_applicable_licenses' to import
18 // all of the 'license_kinds' from "frameworks_base_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["frameworks_base_license"],
22 default_team: "trendy_team_android_resources",
23}
24
25genrule {
26 name: "resource-flagging-test-app-compile",
27 tools: ["aapt2"],
28 srcs: [
29 "res/values/bools.xml",
30 "res/values/bools2.xml",
Jeremy Meyerd52bd682024-08-14 11:16:58 -070031 "res/values/ints.xml",
Jeremy Meyer16c83af2024-07-26 16:21:49 -070032 "res/values/strings.xml",
33 ],
34 out: [
35 "values_bools.arsc.flat",
36 "values_bools2.arsc.flat",
Jeremy Meyerd52bd682024-08-14 11:16:58 -070037 "values_ints.arsc.flat",
Jeremy Meyer16c83af2024-07-26 16:21:49 -070038 "values_strings.arsc.flat",
39 ],
40 cmd: "$(location aapt2) compile $(in) -o $(genDir) " +
41 "--feature-flags test.package.falseFlag:ro=false,test.package.trueFlag:ro=true",
42}
43
44genrule {
45 name: "resource-flagging-test-app-apk",
46 tools: ["aapt2"],
47 // The first input file in the list must be the manifest
48 srcs: [
49 "AndroidManifest.xml",
50 ":resource-flagging-test-app-compile",
51 ],
Jeremy Meyer423c0f52024-08-02 12:06:54 -070052 out: [
53 "resapp.apk",
54 ],
Jeremy Meyer16c83af2024-07-26 16:21:49 -070055 cmd: "$(location aapt2) link -o $(out) --manifest $(in)",
56}
57
Jeremy Meyer423c0f52024-08-02 12:06:54 -070058genrule {
59 name: "resource-flagging-test-app-r-java",
60 tools: ["aapt2"],
61 // The first input file in the list must be the manifest
62 srcs: [
63 "AndroidManifest.xml",
64 ":resource-flagging-test-app-compile",
65 ],
66 out: [
67 "resource-flagging-java/com/android/intenal/flaggedresources/R.java",
68 ],
69 cmd: "$(location aapt2) link -o $(genDir)/resapp.apk --java $(genDir)/resource-flagging-java --manifest $(in)",
70}
71
Jeremy Meyer16c83af2024-07-26 16:21:49 -070072java_genrule {
73 name: "resource-flagging-test-app-apk-as-resource",
74 srcs: [
75 ":resource-flagging-test-app-apk",
76 ],
77 out: ["apks_as_resources.res.zip"],
78 tools: ["soong_zip"],
79
80 cmd: "mkdir -p $(genDir)/res/raw && " +
81 "cp $(in) $(genDir)/res/raw/$$(basename $(in)) && " +
82 "$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
83}