aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-12-19 16:58:42 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-12-19 18:56:06 +0000
commitb9f914fa56a00530d38b597dc853aad50d1decfb (patch)
tree85cc1b5ed6bce7b0c265aabfe353ef5c83cfbe00 /src/main
parentcd4cc09fa6ef96380a3d0888f825dfd1dbada651 (diff)
Make Bazel build dot
This change has several parts, it: * Adds a "make" repository rule, which runs ./configure && make on a repository. * Modifies the tar.gz decompressor to restore timestamps. This was an issue with dot, as make examines the timestamp to determine if files need to be rebuilt. Because Bazel was not preserving the archive's timestamp, it was rebuilding things that it did not need to (and, I think, exposed some bugs in dot's Makefile). * Actually add dot as an external repository. I made the dot-graph target manual, so it won't be downloaded/built by the default //... target. * Remove dot scrubbing from the Bazel export process. * Added some names to download_and_extract params, because it's really annoying to only be able to reference them positionally. -- PiperOrigin-RevId: 142452055 MOS_MIGRATED_REVID=142452055
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java10
2 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
index c76bf58b5b..55cd813d47 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
@@ -22,6 +22,7 @@ import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
+import java.util.Date;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
@@ -78,6 +79,11 @@ public abstract class CompressedTarFunction implements Decompressor {
Files.copy(
tarStream, filename.getPathFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
filename.chmod(entry.getMode());
+
+ // This can only be done on real files, not links, or it will skip the reader to
+ // the next "real" file to try to find the mod time info.
+ Date lastModified = entry.getLastModifiedDate();
+ filename.setLastModifiedTime(lastModified.getTime());
}
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
index 70e8a9f7d6..c20da5a8d9 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkRepositoryContext.java
@@ -527,7 +527,8 @@ public class SkylarkRepositoryContext {
@ParamType(type = String.class),
@ParamType(type = SkylarkList.class, generic1 = String.class),
},
- doc = "List of mirror URLs referencing the same file."
+ doc = "List of mirror URLs referencing the same file.",
+ named = true
),
@Param(
name = "output",
@@ -538,7 +539,8 @@ public class SkylarkRepositoryContext {
},
doc =
"path to the directory where the archive will be unpacked,"
- + " relative to the repository directory."
+ + " relative to the repository directory.",
+ defaultValue = "''"
),
@Param(
name = "sha256",
@@ -570,9 +572,9 @@ public class SkylarkRepositoryContext {
named = true,
doc =
"a directory prefix to strip from the extracted files."
- + "\nMany archives contain a top-level directory that contains alfiles in"
+ + "\nMany archives contain a top-level directory that contains all files in the"
+ " archive. Instead of needing to specify this prefix over and over in the"
- + " <code>build_file</code>, this field can be used to strip it extracted"
+ + " <code>build_file</code>, this field can be used to strip it from extracted"
+ " files."
),
}