Skip to content

Instantly share code, notes, and snippets.

@primiano
Last active December 11, 2015 18:43
Show Gist options
  • Save primiano/183b31f17801f34a32e2 to your computer and use it in GitHub Desktop.
Save primiano/183b31f17801f34a32e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
set -e
if [ "$(git status -s --untracked-files=no)" != "" ]; then
echo "You have unstaged changes. bail out"
exit 1
fi
function check_configuration {
CFGNAME="$1"
EXTRA_GYP_DEFINES="$2"
rm -rf out
mkdir out
(cd out; git init --quiet)
git checkout --quiet origin/master
GYP_DEFINES="$EXTRA_GYP_DEFINES $GYP_DEFINES" build/gyp_chromium
rm -rf out/gypfiles out/*/build.ninja
(cd out; git add -A; git commit --quiet -m tot; rm -rf *)
git checkout --quiet -
GYP_DEFINES="$EXTRA_GYP_DEFINES $GYP_DEFINES" build/gyp_chromium
rm -rf out/gypfiles out/*/build.ninja
echo "OUTPUT in $CFGNAME"
(cd out; git diff --word-diff=porcelain -U2 | grep -Pv '^~$') > "$CFGNAME.diff"
}
function check_configuration_gn {
CFGNAME="$1"
GN_ARGS="$2"
rm -rf out
mkdir -p out/gn
(cd out/gn; git init --quiet)
git checkout --quiet origin/master
echo "$GN_ARGS" > out/gn/args.gn
gn gen out/gn
rm out/gn/build.ninja.d out/gn/build.ninja
~/ninjasort.py out/gn
(cd out/gn; git add -A; git commit --quiet -m tot; rm -rf *)
git checkout --quiet -
echo "$GN_ARGS" > out/gn/args.gn
gn gen out/gn
~/ninjasort.py out/gn
rm out/gn/build.ninja.d out/gn/build.ninja
echo "OUTPUT in $CFGNAME"
(cd out/gn; git diff --word-diff=porcelain -U2 | grep -Pv '^~$' ) > "$CFGNAME.diff"
}
if [ "$(uname -s)" == "Linux" ]; then
check_configuration_gn "android_gn" 'target_os="android"'
check_configuration_gn "android_gn_comp" 'target_os="android"
is_component_build=true'
check_configuration_gn "linux_gn" 'is_debug=false'
check_configuration_gn "linux_gn_dbg" 'is_debug=true'
check_configuration_gn "linux_gn_comp" 'is_component_build=true'
check_configuration "linux_asan" "OS=linux asan=1"
check_configuration "linux_shared" "OS=linux component=shared_library"
# check_configuration "linux_static_noalloc" "OS=linux use_allocator=none"
# check_configuration "linux_shared_noalloc" "OS=linux use_allocator=none component=shared_library"
check_configuration "android_static" "OS=android"
check_configuration "android_shared" "OS=android component=shared_library"
check_configuration "linux_static" "OS=linux"
else
check_configuration_gn "mac_gn" ''
check_configuration_gn "mac_gn_comp" 'is_component_build=true'
check_configuration "mac_static" "OS=mac"
check_configuration "mac_shared" "OS=mac component=shared_library"
check_configuration "mac_noalloc_static" "OS=mac use_allocator=none"
check_configuration "mac_noalloc_shared" "OS=mac use_allocator=none component=shared_library"
# check_configuration "ios_static" "OS=ios"
# check_configuration "ios_shared" "OS=ios component=shared_library"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment