//
// 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.
genrule {
name: "font-resources-public",
out: ["values/public.xml"],
cmd: "mkdir -p $(genDir)/values; echo '" +
" " +
" " +
" " +
" ' > $(out)",
}
genrule {
name: "font-resources-compile-public",
tools: ["aapt2"],
srcs: [
":font-resources-public",
],
out: ["values_public.arsc.flat"],
cmd: "$(location aapt2) compile $(in) -o $(genDir)",
}
genrule {
name: "font-resources-config",
out: ["values/config.xml"],
cmd: "mkdir -p $(genDir)/values; echo '" +
" " +
" plh-go-sans" +
" plh-go-sans-text" +
" ' > $(out)",
}
genrule {
name: "font-resources-compile-config",
tools: ["aapt2"],
srcs: [
":font-resources-config",
],
out: ["values_config.arsc.flat"],
cmd: "$(location aapt2) compile $(in) -o $(genDir)",
}
genrule {
name: "font-manifest",
out: ["FontAndroidManifest.xml"],
cmd: "echo ' ' > $(out)",
}
genrule {
name: "font-resources-apk",
tools: ["aapt2"],
// The first input file in the list must be the manifest
srcs: [
":font-manifest",
":font-resources-compile-public",
":font-resources-compile-config",
],
out: ["font-resources.apk"],
cmd: "$(location aapt2) link -o $(out) --manifest $(in)",
}
genrule {
name: "font-resources-arsc",
srcs: [":font-resources-apk"],
out: ["font_resources.arsc"],
cmd: "mkdir -p $(genDir)/font-resources-arsc && " +
"unzip -x $(in) resources.arsc -d $(genDir)/font-resources-arsc && " +
"mkdir -p $$(dirname $(out)) && " +
"mv $(genDir)/font-resources-arsc/resources.arsc $(out) && " +
"echo 'Created $(out)'",
}