Add symlinks to third_party/ and tools/ to base_workspace
While attempting to clean up the Bazel examples, I noticed that the example
tests don't actually work because they expect a third_party directory. We could
link third_party/ from the top-level bazel directory, but then we'd have
crossing symlinks (base_workspace/tools->tools and
third_party->base_workspace/third_party). Linking everything in one direction
seemed like a better option, but alternative suggestions are welcome.
--
MOS_MIGRATED_REVID=86703332
diff --git a/.gitignore b/.gitignore
index e340510..daa603d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,8 @@
/output/
/bazel-*
/fromhost/
-/base_workspace/tools/jdk/jdk
-/base_workspace/tools/java/ijar
-/base_workspace/tools/java/JavaBuilder_deploy.jar
-/base_workspace/tools/java/SingleJar_deploy.jar
-/tools
+/base_workspace/tools/
+/tools/jdk/jdk
+/tools/java/ijar
+/tools/java/JavaBuilder_deploy.jar
+/tools/java/SingleJar_deploy.jar
diff --git a/compile.sh b/compile.sh
index 87eb5b8..fde544c 100755
--- a/compile.sh
+++ b/compile.sh
@@ -64,8 +64,9 @@
fi
}
-# Create a tools symlink so we can run the Bazel bootstrap.
-rm -f tools && ln -s base_workspace/tools tools
+# Create symlinks so we can use tools from the base_workspace.
+rm -f base_workspace/tools && ln -s $(pwd)/tools base_workspace/tools
+rm -f base_workspace/third_party && ln -s $(pwd)/third_party base_workspace/third_party
mkdir -p fromhost
cat << EOF > fromhost/BUILD
@@ -181,7 +182,6 @@
test -z "$JAVA_HOME" && fail "JDK not found, please set \$JAVA_HOME."
rm -f tools/jdk/jdk && ln -s "${JAVA_HOME}" tools/jdk/jdk
-
JAVAC="${JAVA_HOME}/bin/javac"
[[ -x $JAVAC ]] \
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java b/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java
index 8c80d7d..3302d33 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java
@@ -91,7 +91,7 @@
scratchFile(rootDirectory.getRelative("devtools/blaze/rules/BUILD").getPathString());
scratchFile(rootDirectory.getRelative("rules/BUILD").getPathString());
copySkylarkFilesIfExist("devtools/blaze/rules/staging", "devtools/blaze/rules/staging");
- copySkylarkFilesIfExist("devtools/blaze/bazel/base_workspace/tools/build_rules", "rules");
+ copySkylarkFilesIfExist("devtools/blaze/bazel/tools/build_rules", "rules");
}
private void copySkylarkFilesIfExist(String from, String to) throws IOException {
diff --git a/base_workspace/tools/BUILD b/tools/BUILD
similarity index 100%
rename from base_workspace/tools/BUILD
rename to tools/BUILD
diff --git a/base_workspace/tools/build_rules/genproto.bzl b/tools/build_rules/genproto.bzl
similarity index 100%
rename from base_workspace/tools/build_rules/genproto.bzl
rename to tools/build_rules/genproto.bzl
diff --git a/base_workspace/tools/build_rules/go_rules.bzl b/tools/build_rules/go_rules.bzl
similarity index 100%
rename from base_workspace/tools/build_rules/go_rules.bzl
rename to tools/build_rules/go_rules.bzl
diff --git a/base_workspace/tools/build_rules/java_rules_oss.bzl b/tools/build_rules/java_rules_oss.bzl
similarity index 100%
rename from base_workspace/tools/build_rules/java_rules_oss.bzl
rename to tools/build_rules/java_rules_oss.bzl
diff --git a/base_workspace/tools/build_rules/py_rules.bzl b/tools/build_rules/py_rules.bzl
similarity index 100%
rename from base_workspace/tools/build_rules/py_rules.bzl
rename to tools/build_rules/py_rules.bzl
diff --git a/base_workspace/tools/cpp/BUILD b/tools/cpp/BUILD
similarity index 99%
rename from base_workspace/tools/cpp/BUILD
rename to tools/cpp/BUILD
index b3f32c9..af72b66 100644
--- a/base_workspace/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -21,8 +21,8 @@
filegroup(
name = "toolchain",
srcs = [
- ":cc-compiler-local",
":cc-compiler-darwin",
+ ":cc-compiler-local",
":empty",
],
)
diff --git a/base_workspace/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
similarity index 100%
rename from base_workspace/tools/cpp/CROSSTOOL
rename to tools/cpp/CROSSTOOL
diff --git a/base_workspace/tools/cpp/empty.cc b/tools/cpp/empty.cc
similarity index 100%
rename from base_workspace/tools/cpp/empty.cc
rename to tools/cpp/empty.cc
diff --git a/base_workspace/tools/defaults/BUILD b/tools/defaults/BUILD
similarity index 100%
rename from base_workspace/tools/defaults/BUILD
rename to tools/defaults/BUILD
diff --git a/base_workspace/tools/genrule/BUILD b/tools/genrule/BUILD
similarity index 100%
rename from base_workspace/tools/genrule/BUILD
rename to tools/genrule/BUILD
diff --git a/base_workspace/tools/genrule/genrule-setup.sh b/tools/genrule/genrule-setup.sh
similarity index 100%
rename from base_workspace/tools/genrule/genrule-setup.sh
rename to tools/genrule/genrule-setup.sh
diff --git a/base_workspace/tools/go/BUILD b/tools/go/BUILD
similarity index 100%
rename from base_workspace/tools/go/BUILD
rename to tools/go/BUILD
diff --git a/base_workspace/tools/go/generate_test_main.go b/tools/go/generate_test_main.go
similarity index 100%
rename from base_workspace/tools/go/generate_test_main.go
rename to tools/go/generate_test_main.go
diff --git a/base_workspace/tools/jdk/BUILD b/tools/jdk/BUILD
similarity index 100%
rename from base_workspace/tools/jdk/BUILD
rename to tools/jdk/BUILD
diff --git a/base_workspace/tools/test/BUILD b/tools/test/BUILD
similarity index 100%
rename from base_workspace/tools/test/BUILD
rename to tools/test/BUILD
diff --git a/base_workspace/tools/test/test-setup.sh b/tools/test/test-setup.sh
similarity index 100%
rename from base_workspace/tools/test/test-setup.sh
rename to tools/test/test-setup.sh