Run the versioner as part of the build.

Running this periodically and checking in the results is not working
out, since the result is just that I'm having to spend a lot of time
cleaning up the headers every time I need to update them in the NDK.

Run the versioner as part of the build instead. This way bionic
header changes behave like the rest of the NDK headers and will
affect NDK builds in the platform *immediately*.

Remove the preupload hook for the versioner since it's part of the
normal build now.

The versioner's dependencies directory needs to be moved because
soong won't let us try to do things outside our module's directory
(in this case libc).

Unfortunately this means we need to build the versioner for Darwin,
because we now need it to perform a platform build.

Test: make checkbuild
Bug: None
Change-Id: Icdab8a962354d9e945072dc3f806baea376c8db4
This commit is contained in:
Dan Albert 2017-02-15 17:18:01 -08:00
parent 3f76dadf15
commit 45715b2a88
35 changed files with 21 additions and 90 deletions

View file

@ -1,3 +1,2 @@
[Hook Scripts]
versioner = tools/versioner/preupload.sh
notice = tools/update_notice.sh

View file

@ -2012,15 +2012,12 @@ cc_object {
defaults: ["crt_defaults"],
}
// The following module lives in prebuilts/ndk because we need to preprocess the
// headers to include ifdef guards for __ANDROID_API__. Update with
// bionic/tools/update_headers.sh.
// ndk_headers {
// name: "common_libc",
// from: "include",
// to: "",
// srcs: ["include/**/*.h"],
// }
preprocessed_ndk_headers {
name: "common_libc",
from: "include",
to: "",
license: "NOTICE",
}
ndk_headers {
name: "libc_uapi",

View file

@ -0,0 +1 @@
../../arch-arm/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-arm

View file

@ -0,0 +1 @@
../../arch-arm64/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-arm64

View file

@ -0,0 +1 @@
../../../../external/clang/lib/Headers/

View file

@ -0,0 +1 @@
../../kernel/android/uapi/

View file

@ -0,0 +1 @@
../../kernel/uapi/

View file

@ -0,0 +1 @@
../../arch-mips/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-mips

View file

@ -0,0 +1 @@
../../arch-mips64/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-mips

View file

@ -0,0 +1 @@
../../arch-x86/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-x86/

View file

@ -0,0 +1 @@
../../arch-x86_64/include/

View file

@ -0,0 +1 @@
../../kernel/uapi/asm-x86/

View file

@ -1,53 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
which versioner >/dev/null 2>&1
if [ $? -ne 0 ]; then
>&2 echo "versioner not in path; run mma in $DIR/versioner"
exit 1
fi
VERSION=$(git rev-parse --short HEAD)
git diff-index --quiet HEAD
DIRTY=$?
git branch -r --contains HEAD | grep -q aosp/master
SUBMITTED=$?
if [ $DIRTY -ne 0 ]; then
>&2 echo "Warning: bionic has uncommitted changes"
VERSION="${VERSION}-dirty"
elif [ $SUBMITTED -ne 0 ]; then
>&2 echo "Warning: current HEAD does not exist in aosp/master"
VERSION="${VERSION}-unsubmitted"
fi
PREBUILTS_DIR=$ANDROID_BUILD_TOP/prebuilts/ndk
BRANCH_NAME=$(git -C $PREBUILTS_DIR symbolic-ref --short -q HEAD)
if [ $? -ne 0 ]; then
BRANCH_NAME=update-bionic-headers-$VERSION
echo "prebuilts/ndk has detached head; creating branch $BRANCH_NAME"
repo start $BRANCH_NAME $PREBUILTS_DIR
else
echo "prebuilts/ndk already on branch $BRANCH_NAME"
fi
HEADERS_INSTALL=$PREBUILTS_DIR/headers
if [ -d "$HEADERS_INSTALL" ]; then
git -C $PREBUILTS_DIR rm -r --ignore-unmatch $HEADERS_INSTALL
if [ -d $HEADERS_INSTALL ]; then
rm -r $HEADERS_INSTALL
fi
fi
versioner -p versioner/platforms versioner/current versioner/dependencies \
-o $HEADERS_INSTALL
if [ $? -ne 0 ]; then
>&2 echo "Header preprocessing failed"
exit 1
fi
cp ../libc/NOTICE $PREBUILTS_DIR
git -C $PREBUILTS_DIR add $HEADERS_INSTALL $PREBUILTS_DIR/NOTICE
git -C $PREBUILTS_DIR commit -m "Update bionic headers to $VERSION."

View file

@ -1 +0,0 @@
../../../../libc/arch-arm/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-arm

View file

@ -1 +0,0 @@
../../../../libc/arch-arm64/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-arm64

View file

@ -1 +0,0 @@
../../../../../external/clang/lib/Headers

View file

@ -1 +0,0 @@
../../../../libc/kernel/android/uapi

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi

View file

@ -1 +0,0 @@
../../../../libc/arch-mips/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-mips

View file

@ -1 +0,0 @@
../../../../libc/arch-mips64/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-mips

View file

@ -1 +0,0 @@
../../../../libc/arch-x86/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-x86

View file

@ -1 +0,0 @@
../../../../libc/arch-x86_64/include

View file

@ -1 +0,0 @@
../../../../libc/kernel/uapi/asm-x86

View file

@ -1,9 +0,0 @@
#!/bin/bash
if ! which versioner > /dev/null; then
echo "versioner not found (lunch and mma in bionic)"
exit 1
fi
versioner -r arm -r arm64
exit $?

View file

@ -41,9 +41,6 @@ cc_binary_host {
"-fno-rtti",
],
},
darwin: {
enabled: false,
},
windows: {
enabled: false,
},