summaryrefslogtreecommitdiff
path: root/shared.sc
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-12-31 22:56:45 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-01-01 10:10:19 -0800
commitcf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1 (patch)
treef3897463b6f55019f2bbd59ba5cff73cf0fb571f /shared.sc
parent6996c01a391cb9aaa27268dd1f0cf0a1749ade21 (diff)
downloadmill-cf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1.tar.gz
mill-cf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1.tar.bz2
mill-cf5fb5fdfd477e0bb4ffa0e4fec3a8ec01bf5cf1.zip
Split Acyclic/Jawn/BetterFiles tests into their own `integration/` test suite.
Those tests now download a snapshot of the relevant git repo rather than vendoring the files, and use a bare `build.sc` instead of having the build object be included in the test classpath. Tests pass using `sbt integration/test`, but `mill integration.test` still doesn't work
Diffstat (limited to 'shared.sc')
-rw-r--r--shared.sc53
1 files changed, 31 insertions, 22 deletions
diff --git a/shared.sc b/shared.sc
index 579d6b20..a0061f65 100644
--- a/shared.sc
+++ b/shared.sc
@@ -100,35 +100,19 @@ def generateApplicativeTest(dir: Path) = {
)
}
-@main
-def generateSources(p: Path) = {
- generateApplyer(p)
- generateTarget(p)
- generateEval(p)
-}
-
-@main
-def generateTests(p: Path) = {
- generateApplicativeTest(p)
-}
+def unpackZip(zipDest: Path, url: String) = {
+ println(s"Unpacking zip $url into $zipDest")
+ mkdir(zipDest)
-@main
-def downloadBridgeSource(curlDest: Path, crossVersion: String) = {
- val v = crossVersion.split('.').dropRight(1).mkString(".")
- val url =
- s"http://repo1.maven.org/maven2/org/scala-sbt/compiler-bridge_$v/1.0.5/compiler-bridge_$v-1.0.5-sources.jar"
-
- mkdir(curlDest)
-
- val bytes = scalaj.http.Http.apply(url).asBytes.body
- val byteStream = new java.io.ByteArrayInputStream(bytes)
+ val bytes = scalaj.http.Http.apply(url).option(scalaj.http.HttpOptions.followRedirects(true)).asBytes
+ val byteStream = new java.io.ByteArrayInputStream(bytes.body)
val zipStream = new java.util.zip.ZipInputStream(byteStream)
while({
zipStream.getNextEntry match{
case null => false
case entry =>
if (!entry.isDirectory) {
- val dest = curlDest / RelPath(entry.getName)
+ val dest = zipDest / RelPath(entry.getName)
mkdir(dest / up)
val fileOut = new java.io.FileOutputStream(dest.toString)
val buffer = new Array[Byte](4096)
@@ -146,7 +130,32 @@ def downloadBridgeSource(curlDest: Path, crossVersion: String) = {
true
}
})()
+}
+@main
+def generateSources(p: Path) = {
+ generateApplyer(p)
+ generateTarget(p)
+ generateEval(p)
+}
+
+@main
+def generateTests(p: Path) = {
+ generateApplicativeTest(p)
+}
+@main
+def downloadBridgeSource(curlDest: Path, crossVersion: String) = {
+ val v = crossVersion.split('.').dropRight(1).mkString(".")
+ unpackZip(
+ curlDest,
+ s"http://repo1.maven.org/maven2/org/scala-sbt/compiler-bridge_$v/1.0.5/compiler-bridge_$v-1.0.5-sources.jar"
+ )
curlDest
}
+
+@main
+def downloadTestRepo(label: String, commit: String, dest: Path) = {
+ unpackZip(dest, s"https://github.com/$label/archive/$commit.zip")
+ dest
+} \ No newline at end of file