Skip to content

Commit

Permalink
Automated [] rollback of commit 857cda2 and commit 790d2f6.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Broke non-Bazel projects on ci.bazel.io

Fixes bazelbuild#1168

*** Original change description ***

Move the runfiles for external repositories to under the x.runfiles/ directory

This also sets the Bazel workspace name to io_bazel_source.

Fixes bazelbuild#848.

Relevant to bazelbuild#1116, bazelbuild#1124,

RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles....

***

--
MOS_MIGRATED_REVID=120535721
  • Loading branch information
damienmg committed Apr 22, 2016
1 parent 8ed31f0 commit 9e4c78f
Show file tree
Hide file tree
Showing 63 changed files with 328 additions and 667 deletions.
2 changes: 0 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
workspace(name = "io_bazel")

load("/tools/build_defs/jsonnet/jsonnet", "jsonnet_repositories")
load("/tools/build_rules/rust/rust", "rust_repositories")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public static String convertStreamToString(InputStream is) throws Exception {
public void hello(String obj) throws Exception {
String greeting = "Hello";
try {
String greetFile = getRunfiles()
+ "/io_bazel/examples/java-skylark/src/main/resources/greeting.txt";
String greetFile = getRunfiles() + "/examples/java-skylark/src/main/resources/greeting.txt";
greeting = convertStreamToString(new FileInputStream(greetFile));
} catch (FileNotFoundException e) {
// use default.
Expand Down
3 changes: 2 additions & 1 deletion examples/shell/bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ set -eu

# This allows the script to be both a binary and a library script. If our binary has defined
# RUNFILES then we use it, otherwise we look for our own runfiles.
RUNFILES=${RUNFILES:-$0.runfiles/io_bazel}
RUNFILES=${RUNFILES:-$0.runfiles}

source "${RUNFILES}/examples/shell/lib.sh"

showfile

3 changes: 2 additions & 1 deletion examples/shell/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ set -eu

# This allows the script to be both a binary and a library script. If our binary has defined
# RUNFILES then we use it, otherwise we look for our own runfiles.
RUNFILES=${RUNFILES:-$0.runfiles/io_bazel}
RUNFILES=${RUNFILES:-$0.runfiles}

function showfile {
cat "${RUNFILES}/examples/shell/data/file.txt"
}

2 changes: 1 addition & 1 deletion scripts/bash_completion_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ source ${DIR}/testenv.sh || { echo "testenv.sh not found!" >&2; exit 1; }
: ${COMMAND_ALIASES:=bazel}

# Completion script
: ${COMPLETION:="$TEST_SRCDIR/io_bazel/scripts/bazel-complete.bash"}
: ${COMPLETION:="$TEST_SRCDIR/scripts/bazel-complete.bash"}

# Set this to test completion with package path (if enabled)
: ${PACKAGE_PATH_PREFIX:=}
Expand Down
4 changes: 2 additions & 2 deletions scripts/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
[ -z "$TEST_SRCDIR" ] && { echo "TEST_SRCDIR not set!" >&2; exit 1; }

# Load the unit-testing framework
source "${TEST_SRCDIR}/io_bazel/src/test/shell/unittest.bash" \
|| { echo "Failed to source unittest.bash" >&2; exit 1; }
source "${TEST_SRCDIR}/src/test/shell/unittest.bash" || \
{ echo "Failed to source unittest.bash" >&2; exit 1; }

set_up() {
mkdir -p $TEST_TMPDIR/workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ genrule(
outs = ["JavacBootclasspathLocations.java"],
cmd = """
declare -a paths=($(SRCS)) && paths=($${paths[@]#$(GENDIR)/}) &&
paths=($$(echo $${paths[@]} | sed s_external/__g)) &&
IFS=: &&
cat > $@ <<EOF
package com.google.devtools.build.java.bazel;
Expand Down Expand Up @@ -45,7 +44,7 @@ genrule(
srcs = ["//third_party/java/jdk/langtools:javac_jar"],
outs = ["JavaLangtoolsLocation.java"],
cmd = """
path=$(SRCS) && path=$${path#$(GENDIR)/} && path="io_bazel/$${path}" &&
path=$(SRCS) && path=$${path#$(GENDIR)/} &&
cat > $@ <<EOF
package com.google.devtools.build.java.bazel;
public class JavaLangtoolsLocation {
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/google/devtools/build/lib/actions/Artifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -497,21 +497,6 @@ public final PathFragment getRootRelativePath() {
return rootRelativePath;
}

/**
* For targets in external repositories, this returns the path the artifact live at in the
* runfiles tree. For local targets, it returns the rootRelativePath.
*/
public final PathFragment getRunfilesPath() {
PathFragment relativePath = rootRelativePath;
if (relativePath.segmentCount() > 1
&& relativePath.getSegment(0).equals(Label.EXTERNAL_PATH_PREFIX)) {
// Turn external/repo/foo into ../repo/foo.
relativePath = relativePath.relativeTo(Label.EXTERNAL_PATH_PREFIX);
relativePath = new PathFragment("..").getRelative(relativePath);
}
return relativePath;
}

/**
* Returns this.getExecPath().getPathString().
*/
Expand Down
Loading

0 comments on commit 9e4c78f

Please sign in to comment.