Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: mojo/tools/mojob.sh

Issue 668603003: Mojo: mojob.sh: Add support for gn, and remove support for gyp and shared library (component) build… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/mojob.sh
diff --git a/mojo/tools/mojob.sh b/mojo/tools/mojob.sh
index 2b82d082e734b42b34190226216cd30f7fc68d0d..7092c791f696995a5e2109b721a7f6a375404b56 100755
--- a/mojo/tools/mojob.sh
+++ b/mojo/tools/mojob.sh
@@ -20,34 +20,37 @@ command should be one of:
test - Run unit tests (does not build).
perftest - Run perf tests (does not build).
pytest - Run Python unit tests (does not build).
- gyp - Run gyp for mojo (does not sync).
- gypall - Run gyp for all of chromium (does not sync).
- sync - Sync using gclient (does not run gyp).
+ gn - Run gn for mojo (does not sync).
+ sync - Sync using gclient (does not run gn).
show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do:
\$ eval \`mojo/tools/mojob.sh show-bash-alias\`
-option (which will only apply to following commands) should be one of:
- Build/test options (specified before build/test/perftest):
- --debug - Build/test in Debug mode.
- --release - Build/test in Release mode.
- --debug-and-release - Build/test in both Debug and Release modes (default).
- Compiler options (specified before gyp):
- --clang - Use clang (default).
- --gcc - Use gcc.
- Component options:
- --shared Build components as shared libraries (default).
- --static Build components as static libraries.
- Use goma:
- --use-goma - Use goma if \$GOMA_DIR is set or \$HOME/goma exists (default).
- --no-use-goma - Do not use goma.
+option (which will only apply to commands which follow) should be one of:
+ General options (specify before everything):
+ --debug / --release / --debug-and-release - Debug (default) build /
+ Release build / Debug and Release builds.
+ gn options (specify before gn):
+ --clang / --gcc - Use clang (default) / gcc.
+ --use-goma / --no-use-goma - Use goma (if \$GOMA_DIR is set or \$HOME/goma
+ exists; default) / don't use goma.
Note: It will abort on the first failure (if any).
EOF
}
+get_gn_arg_value() {
+ grep -m 1 "^[[:space:]]*\<$2\>" "$1/args.gn" | \
+ sed -n 's/.* = "\?\([^"]*\)"\?$/\1/p'
+}
+
do_build() {
echo "Building in out/$1 ..."
- if [ "$GOMA" = "auto" -a -v GOMA_DIR ]; then
+ if [ "$(get_gn_arg_value "out/$1" use_goma)" = "true" ]; then
+ # Use the configured goma directory.
+ local goma_dir="$(get_gn_arg_value "out/$1" goma_dir)"
+ echo "Ensuring goma (in ${goma_dir}) started ..."
+ "${goma_dir}/goma_ctl.py" ensure_start
+
ninja -j 1000 -l 100 -C "out/$1" mojo || exit 1
else
ninja -C "out/$1" mojo || exit 1
@@ -68,24 +71,14 @@ do_perftests() {
do_pytests() {
echo "Running python tests in out/$1 ..."
python mojo/tools/run_mojo_python_tests.py || exit 1
- # TODO(qsr) Remove this test when the component build is not supported
- # anymore.
- if [ -f "out/$1/python/mojo/system.so" ]; then
- python mojo/tools/run_mojo_python_bindings_tests.py \
- "--build-dir=out/$1" || exit 1
- fi
-}
-
-do_gyp() {
- local gyp_defines="$(make_gyp_defines)"
- echo "Running gyp for mojo with GYP_DEFINES=$gyp_defines ..."
- GYP_DEFINES="$gyp_defines" build/gyp_chromium mojo/mojo.gyp || exit 1
+ python mojo/tools/run_mojo_python_bindings_tests.py "--build-dir=out/$1" || \
+ exit 1
}
-do_gypall() {
- local gyp_defines="$(make_gyp_defines)"
- echo "Running gyp for everything with GYP_DEFINES=$gyp_defines ..."
- GYP_DEFINES="$gyp_defines" build/gyp_chromium || exit 1
+do_gn() {
+ local gn_args="$(make_gn_args $1)"
+ echo "Running gn with --args=\"${gn_args}\" ..."
+ gn gen --args="${gn_args}" "out/$1"
}
do_sync() {
@@ -94,67 +87,43 @@ do_sync() {
}
# Valid values: Debug, Release, or Debug_and_Release.
-BUILD_TEST_TYPE=Debug_and_Release
+BUILD_TYPE=Debug_and_Release
should_do_Debug() {
- test "$BUILD_TEST_TYPE" = Debug -o "$BUILD_TEST_TYPE" = Debug_and_Release
+ test "$BUILD_TYPE" = Debug -o "$BUILD_TYPE" = Debug_and_Release
}
should_do_Release() {
- test "$BUILD_TEST_TYPE" = Release -o "$BUILD_TEST_TYPE" = Debug_and_Release
+ test "$BUILD_TYPE" = Release -o "$BUILD_TYPE" = Debug_and_Release
}
# Valid values: clang or gcc.
COMPILER=clang
-# Valid values: shared or static.
-COMPONENT=shared
# Valid values: auto or disabled.
GOMA=auto
-make_gyp_defines() {
- local options=()
- # Always include these options.
- options+=("use_aura=1")
+make_gn_args() {
+ local args=()
case "$COMPILER" in
clang)
- options+=("clang=1")
+ args+=("is_clang=true")
;;
gcc)
- options+=("clang=0")
- ;;
- esac
- case "$COMPONENT" in
- shared)
- options+=("component=shared_library")
- ;;
- static)
- options+=("component=static_library")
+ args+=("is_clang=false")
;;
esac
case "$GOMA" in
auto)
if [ -v GOMA_DIR ]; then
- options+=("use_goma=1" "gomadir=\"${GOMA_DIR}\"")
+ args+=("use_goma=true" "goma_dir=\"${GOMA_DIR}\"")
+ elif [ -d "${HOME}/goma" ]; then
+ args+=("use_goma=true" "goma_dir=\"${HOME}/goma\"")
else
- options+=("use_goma=0")
+ args+=("use_goma=false")
fi
;;
disabled)
- options+=("use_goma=0")
+ args+=("use_goma=false")
;;
esac
- echo "${options[*]}"
-}
-
-set_goma_dir_if_necessary() {
- if [ "$GOMA" = "auto" -a ! -v GOMA_DIR ]; then
- if [ -d "${HOME}/goma" ]; then
- GOMA_DIR="${HOME}/goma"
- fi
- fi
-}
-
-start_goma_if_necessary() {
- if [ "$GOMA" = "auto" -a -v GOMA_DIR ]; then
- "${GOMA_DIR}/goma_ctl.py" ensure_start
- fi
+ echo "${args[*]}"
}
# We're in src/mojo/tools. We want to get to src.
@@ -173,8 +142,6 @@ for arg in "$@"; do
exit 0
;;
build)
- set_goma_dir_if_necessary
- start_goma_if_necessary
should_do_Debug && do_build Debug
should_do_Release && do_build Release
;;
@@ -190,13 +157,9 @@ for arg in "$@"; do
should_do_Debug && do_pytests Debug
should_do_Release && do_pytests Release
;;
- gyp)
- set_goma_dir_if_necessary
- do_gyp
- ;;
- gypall)
- set_goma_dir_if_necessary
- do_gypall
+ gn)
+ should_do_Debug && do_gn Debug
+ should_do_Release && do_gn Release
;;
sync)
do_sync
@@ -212,13 +175,13 @@ for arg in "$@"; do
;;
# Options ------------------------------------------------------------------
--debug)
- BUILD_TEST_TYPE=Debug
+ BUILD_TYPE=Debug
;;
--release)
- BUILD_TEST_TYPE=Release
+ BUILD_TYPE=Release
;;
--debug-and-release)
- BUILD_TEST_TYPE=Debug_and_Release
+ BUILD_TYPE=Debug_and_Release
;;
--clang)
COMPILER=clang
@@ -226,12 +189,6 @@ for arg in "$@"; do
--gcc)
COMPILER=gcc
;;
- --shared)
- COMPONENT=shared
- ;;
- --static)
- COMPONENT=static
- ;;
--use-goma)
GOMA=auto
;;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698