Teach finalize-resources to understand if any flags were finalized, and if not, undo the unnecessary changes created by running finalize_res and not create a git commit. Test: finalize-platform/main finalize-resources # in an already finalized tree Bug: 481594013 Change-Id: I58ea696732772bef480aadcbf014f5d37bde2f95
55 lines
1.5 KiB
Bash
55 lines
1.5 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (C) 2026 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.
|
|
|
|
if grep -q '<public type="attr" name="zygotePreloadNativeLib"' "$TOP/frameworks/base/core/res/res/values/public-final.xml"; then
|
|
info "finalize-resources: already done, exit early"
|
|
return
|
|
fi
|
|
|
|
tmp=$(mktemp)
|
|
trap "rm -f $tmp" EXIT
|
|
m finalize_res
|
|
finalize_res \
|
|
"$TOP/frameworks/base/core/res/res/values/public-staging.xml" \
|
|
"$TOP/frameworks/base/core/res/res/values/public-final.xml" | tee $tmp
|
|
|
|
if grep -q -e '^0 resource(s) were finalized' $tmp; then
|
|
pushd "$TOP/frameworks/base"
|
|
git reset --hard
|
|
popd
|
|
return
|
|
fi
|
|
|
|
m update-api
|
|
|
|
git_commit \
|
|
frameworks/base \
|
|
<<EOF
|
|
Finalize resources for Android $MAJOR.$MINOR
|
|
|
|
CL generated by running these commands:
|
|
|
|
m finalize_res
|
|
finalize_res \\
|
|
\$(gettop)frameworks/base/core/res/res/values/public-staging.xml \\
|
|
\$(gettop)frameworks/base/core/res/res/values/public-final.xml
|
|
m update-api
|
|
|
|
Bug: $BUG
|
|
Test: N/A
|
|
Flag: NONE platform SDK finalization
|
|
EOF
|