diff --git a/.gitignore b/.gitignore index 8fbc80a82ce0be..06f4d0ff0e6c49 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,25 @@ /.classpath /.factorypath /.idea/ -/base_workspace/* +/base_workspace/bazel-bin +/base_workspace/bazel-genfiles +/base_workspace/bazel-out +/base_workspace/bazel-base_workspace +/base_workspace/bazel-testlogs +/base_workspace/examples +/base_workspace/tools +/base_workspace/third_party +/base_workspace/src /bazel.iml +/tools/jdk/jdk +/tools/objc/*.jar +/tools/objc/actoolwrapper.sh +/tools/objc/environment_plist.sh +/tools/objc/ibtoolwrapper.sh +/tools/objc/momctoolwrapper.sh +/tools/objc/momcwrapper.sh +/tools/objc/realpath +/tools/objc/StdRedirect.dylib +/tools/objc/swiftstdlibtoolwrapper.sh +/tools/objc/swiftstdlibtoolzip.sh +/tools/objc/xcrunwrapper.sh diff --git a/compile.sh b/compile.sh index 2b23064916dd59..58103488d4fb4e 100755 --- a/compile.sh +++ b/compile.sh @@ -32,6 +32,7 @@ function usage() { echo " General purpose commands:" >&2 echo " build = compile,tools,init (default)" >&2 echo " compile = compile a Bazel binary for usage" >&2 + echo " tools = compile and install tooling for Bazel" >&2 echo " init = initialize the base workspace" >&2 echo " Commands for developers:" >&2 echo " all = build,determinism,test" >&2 @@ -41,15 +42,17 @@ function usage() { } function parse_options() { - local keywords="(build|compile|init|all|determinism|bootstrap|test)" + local keywords="(build|compile|tools|init|all|determinism|bootstrap|test)" COMMANDS="${1:-build}" [[ "${COMMANDS}" =~ ^$keywords(,$keywords)*$ ]] || usage "$@" DO_COMPILE= + DO_TOOLS_COMPILATION= DO_CHECKSUM= DO_FULL_CHECKSUM=1 DO_TESTS= DO_BASE_WORKSPACE_INIT= [[ "${COMMANDS}" =~ (compile|build|all) ]] && DO_COMPILE=1 + [[ "${COMMANDS}" =~ (tools|build|all) ]] && DO_TOOLS_COMPILATION=1 [[ "${COMMANDS}" =~ (init|build|all) ]] && DO_BASE_WORKSPACE_INIT=1 [[ "${COMMANDS}" =~ (bootstrap|determinism|all) ]] && DO_CHECKSUM=1 [[ "${COMMANDS}" =~ (bootstrap) ]] && DO_FULL_CHECKSUM= @@ -85,11 +88,29 @@ if [ "${EMBED_LABEL-x}" = "x" ]; then EMBED_LABEL="head (@${git_sha1:-non-git})" fi -if [[ $PLATFORM == "darwin" ]] && \ - xcodebuild -showsdks 2> /dev/null | grep -q '\-sdk iphonesimulator'; then - EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS-} --define IPHONE_SDK=1" -fi source scripts/bootstrap/bootstrap.sh +if [ $DO_TOOLS_COMPILATION ]; then + if [[ $PLATFORM == "darwin" ]]; then + bazel_bootstrap //src/tools/xcode/actoolwrapper:actoolwrapper tools/objc/actoolwrapper.sh 0755 + bazel_bootstrap //src/tools/xcode/ibtoolwrapper:ibtoolwrapper tools/objc/ibtoolwrapper.sh 0755 + bazel_bootstrap //src/tools/xcode/momcwrapper:momcwrapper tools/objc/momcwrapper.sh 0755 + bazel_bootstrap //src/tools/xcode/swiftstdlibtoolwrapper:swiftstdlibtoolwrapper tools/objc/swiftstdlibtoolzip.sh 0755 + bazel_bootstrap //src/tools/xcode/xcrunwrapper:xcrunwrapper tools/objc/xcrunwrapper.sh 0755 + bazel_bootstrap //src/objc_tools/bundlemerge:bundlemerge_deploy.jar \ + tools/objc/precomp_bundlemerge_deploy.jar + bazel_bootstrap //src/objc_tools/plmerge:plmerge_deploy.jar \ + tools/objc/precomp_plmerge_deploy.jar + bazel_bootstrap //src/objc_tools/xcodegen:xcodegen_deploy.jar \ + tools/objc/precomp_xcodegen_deploy.jar + if xcodebuild -showsdks 2> /dev/null | grep -q '\-sdk iphonesimulator'; then + bazel_bootstrap //src/tools/xcode/stdredirect:StdRedirect.dylib \ + tools/objc/StdRedirect.dylib 0755 + fi + bazel_bootstrap //src/tools/xcode/realpath:realpath tools/objc/realpath 0755 + bazel_bootstrap //src/tools/xcode/environment:environment_plist \ + tools/objc/environment_plist.sh 0755 + fi +fi if [ $DO_COMPILE ]; then new_step 'Building Bazel with Bazel' diff --git a/scripts/bootstrap/bootstrap.sh b/scripts/bootstrap/bootstrap.sh index 94f0bff60feba6..2ffae0d0786fca 100755 --- a/scripts/bootstrap/bootstrap.sh +++ b/scripts/bootstrap/bootstrap.sh @@ -34,8 +34,7 @@ fi --javabuilder_top=//src/java_tools/buildjar:bootstrap_deploy.jar \ --genclass_top=//src/java_tools/buildjar:bootstrap_genclass_deploy.jar \ --ijar_top=//third_party/ijar \ - --strategy=Javac=worker --worker_quit_after_build \ - ${EXTRA_BAZEL_ARGS-}"} + --strategy=Javac=worker --worker_quit_after_build"} function bazel_bootstrap() { local mode=${3:-"0644"} diff --git a/src/BUILD b/src/BUILD index da36181f774eb7..1904986cec155a 100644 --- a/src/BUILD +++ b/src/BUILD @@ -66,25 +66,6 @@ genrule( """, ) -filegroup( - name = "darwin_tools", - srcs = [ - "//src/tools/xcode/actoolwrapper:actoolwrapper", - "//src/tools/xcode/ibtoolwrapper:ibtoolwrapper", - "//src/tools/xcode/momcwrapper:momcwrapper", - "//src/tools/xcode/swiftstdlibtoolwrapper:swiftstdlibtoolwrapper", - "//src/tools/xcode/environment:environment_plist", - "//src/tools/xcode/xcrunwrapper:xcrunwrapper", - "//src/objc_tools/bundlemerge:bundlemerge_deploy.jar", - "//src/objc_tools/plmerge:plmerge_deploy.jar", - "//src/objc_tools/xcodegen:xcodegen_deploy.jar", - "//src/tools/xcode/realpath:realpath", - ] + select({ - ":iphonesdk": ["//src/tools/xcode/stdredirect:StdRedirect.dylib"], - "//conditions:default": [], - }), -) - genrule( name = "embedded_tools", srcs = [ @@ -102,11 +83,7 @@ genrule( "//src/java_tools/singlejar:SingleJar_deploy.jar", "//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/genclass:GenClass_deploy.jar", "//third_party/ijar", - ] + select({ - ":darwin": [":darwin_tools"], - ":darwin_x86_64": [":darwin_tools"], - "//conditions:default": [], - }), + ], outs = ["embedded_tools.zip"], cmd = "$(location :create_embedded_tools.sh) $@ $(SRCS)", ) @@ -168,12 +145,6 @@ config_setting( visibility = ["//visibility:public"], ) -config_setting( - name = "iphonesdk", - values = {"define": "IPHONE_SDK=1"}, - visibility = ["//visibility:public"], -) - config_setting( name = "freebsd", values = {"cpu": "freebsd"}, diff --git a/src/create_embedded_tools.sh b/src/create_embedded_tools.sh index e0faa3a1e19744..742b2ecf8da8a6 100755 --- a/src/create_embedded_tools.sh +++ b/src/create_embedded_tools.sh @@ -32,10 +32,6 @@ for i in $*; do *SingleJar_deploy.jar) OUTPUT_PATH=tools/jdk/SingleJar_deploy.jar ;; *GenClass_deploy.jar) OUTPUT_PATH=tools/jdk/GenClass_deploy.jar ;; *ijar) OUTPUT_PATH=tools/jdk/ijar ;; - *src/objc_tools/*) OUTPUT_PATH=tools/objc/precomp_${i##*/} ;; - *xcode*StdRedirect.dylib) OUTPUT_PATH=tools/objc/StdRedirect.dylib ;; - *xcode*realpath) OUTPUT_PATH=tools/objc/realpath ;; - *src/tools/xcode/*) OUTPUT_PATH=tools/objc/${i##*/}.sh ;; *) OUTPUT_PATH=$(echo $i | sed 's_^.*bazel-out/[^/]*/bin/__') ;; esac diff --git a/src/tools/xcode/actoolwrapper/BUILD b/src/tools/xcode/actoolwrapper/BUILD index 76c75329847508..79bfdd6edae373 100644 --- a/src/tools/xcode/actoolwrapper/BUILD +++ b/src/tools/xcode/actoolwrapper/BUILD @@ -1,4 +1,4 @@ -package(default_visibility = ["//src:__subpackages__"]) +package(default_visibility = ["//src/test:__subpackages__"]) filegroup( name = "srcs", diff --git a/src/tools/xcode/ibtoolwrapper/BUILD b/src/tools/xcode/ibtoolwrapper/BUILD index bb00f72fa2471a..434132b366b4e2 100644 --- a/src/tools/xcode/ibtoolwrapper/BUILD +++ b/src/tools/xcode/ibtoolwrapper/BUILD @@ -1,4 +1,4 @@ -package(default_visibility = ["//src:__subpackages__"]) +package(default_visibility = ["//src/test:__subpackages__"]) filegroup( name = "srcs", diff --git a/src/tools/xcode/momcwrapper/BUILD b/src/tools/xcode/momcwrapper/BUILD index dd959d10196ec2..61acf80960d1c9 100644 --- a/src/tools/xcode/momcwrapper/BUILD +++ b/src/tools/xcode/momcwrapper/BUILD @@ -1,4 +1,4 @@ -package(default_visibility = ["//src:__subpackages__"]) +package(default_visibility = ["//src/test:__subpackages__"]) filegroup( name = "srcs", diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/BUILD b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD index ecbe656476a778..1a98848a4bcf89 100644 --- a/src/tools/xcode/swiftstdlibtoolwrapper/BUILD +++ b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD @@ -1,4 +1,4 @@ -package(default_visibility = ["//src:__subpackages__"]) +package(default_visibility = ["//src/test:__subpackages__"]) filegroup( name = "srcs", diff --git a/src/tools/xcode/xcrunwrapper/BUILD b/src/tools/xcode/xcrunwrapper/BUILD index e3dbf20a281787..e8ea8594a8bb47 100644 --- a/src/tools/xcode/xcrunwrapper/BUILD +++ b/src/tools/xcode/xcrunwrapper/BUILD @@ -1,4 +1,4 @@ -package(default_visibility = ["//src:__subpackages__"]) +package(default_visibility = ["//src/test:__subpackages__"]) filegroup( name = "srcs",