Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Sep 10, 2024
1 parent 5badefe commit d91447b
Show file tree
Hide file tree
Showing 48 changed files with 221 additions and 221 deletions.
2 changes: 1 addition & 1 deletion build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ object Deps {
val junitInterface = ivy"com.github.sbt:junit-interface:0.13.3"
val commonsIO = ivy"commons-io:commons-io:2.16.1"
val log4j2Core = ivy"org.apache.logging.log4j:log4j-core:2.23.1"
val osLib = ivy"com.lihaoyi::os-lib:0.10.7-M1"
val osLib = ivy"com.lihaoyi::os-lib:0.10.7-M2"
val pprint = ivy"com.lihaoyi::pprint:0.9.0"
val mainargs = ivy"com.lihaoyi::mainargs:0.7.4"
val millModuledefsVersion = "0.11.0-M2"
Expand Down
16 changes: 8 additions & 8 deletions contrib/bloop/test/src/mill/contrib/bloop/BloopTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ object BloopTests extends TestSuite {

// Ensuring that bloop config generation didn't trigger compilation
assert(os.exists(workspaceOut / "scalaModule"))
assert(!os.exists(workspaceOut / "scalaModule" / "compile"))
assert(!os.exists(workspaceOut / "scalaModule/compile"))
assert(os.exists(workspaceOut / "scalaModule2"))
assert(!os.exists(workspaceOut / "scalaModule2" / "compile"))
assert(!os.exists(workspaceOut / "scalaModule2/compile"))
}

test("scalaModule") {
Expand All @@ -126,7 +126,7 @@ object BloopTests extends TestSuite {

assert(name == "scalaModule")
assert(workspaceDir == Some(workdir.wrapped))
assert(sources == List(workdir / "scalaModule" / "src"))
assert(sources == List(workdir / "scalaModule/src"))
assert(options.contains("-language:higherKinds"))
assert(version == "2.12.8")
assert(
Expand Down Expand Up @@ -171,7 +171,7 @@ object BloopTests extends TestSuite {
val mainModuleClasspath = scalaModuleConfig.project.classpath
assert(name == "scalaModule.test")
assert(workspaceDir == Some(workdir.wrapped))
assert(sources == List(workdir / "scalaModule" / "test" / "src"))
assert(sources == List(workdir / "scalaModule/test/src"))
assert(framework == "utest.runner.Framework")
assert(dep == "scalaModule")
assert(
Expand Down Expand Up @@ -228,7 +228,7 @@ object BloopTests extends TestSuite {

assert(name == "scalajsModule")
assert(workspaceDir == Some(workdir.wrapped))
assert(sources == List(workdir / "scalajsModule" / "src"))
assert(sources == List(workdir / "scalajsModule/src"))
assert(version == build.scalajsModule.sv)
assert(platform.config.emitSourceMaps)
assert(platform.config.kind == BloopConfig.ModuleKindJS.CommonJSModule)
Expand All @@ -237,7 +237,7 @@ object BloopTests extends TestSuite {
test("scalanativeModule") {
scalanativeModuleConfig match {
case None =>
val exists = os.exists(workdir / ".bloop" / "scalanativeModule.json")
val exists = os.exists(workdir / ".bloop/scalanativeModule.json")
assert(exists == false)
case Some(scalanativeModuleConfig) =>
val p = scalanativeModuleConfig.project
Expand All @@ -252,14 +252,14 @@ object BloopTests extends TestSuite {

assert(name == "scalanativeModule")
assert(workspaceDir == Some(workdir.wrapped))
assert(sources == List(workdir / "scalanativeModule" / "src"))
assert(sources == List(workdir / "scalanativeModule/src"))
assert(version == build.scalanativeModule.sv)
assert(platform.config.mode == BloopConfig.LinkerMode.Debug)
assert(platform.config.clang == clang.value.toNIO)
}
}
test("skipped") {
val exists = os.exists(workdir / ".bloop" / "skippedModule.json")
val exists = os.exists(workdir / ".bloop/skippedModule.json")
assert(exists == false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ object BuildInfoTests extends TestSuite {
val testModuleSourcesPath: Path = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "buildinfo"

def buildInfoSourcePath(eval: UnitTester) =
eval.outPath / "buildInfoSources.dest" / "foo" / "BuildInfo.scala"
eval.outPath / "buildInfoSources.dest/foo/BuildInfo.scala"

def buildInfoResourcePath(eval: UnitTester) =
eval.outPath / "buildInfoResources.dest" / "foo" / "BuildInfo.buildinfo.properties"
eval.outPath / "buildInfoResources.dest/foo/BuildInfo.buildinfo.properties"
def tests: Tests = Tests {

test("notCreateEmptySourcefile") - UnitTester(
Expand Down Expand Up @@ -144,9 +144,9 @@ object BuildInfoTests extends TestSuite {
val Right(result) = eval.apply(BuildInfoSettings.buildInfoSources)
val path = result.value.head.path

assert(os.exists(path / "foo" / "bar.scala"))
assert(os.exists(path / "foo/bar.scala"))

val found = os.read(path / "foo" / "bar.scala").replaceAll("(\r\n)|\r", "\n")
val found = os.read(path / "foo/bar.scala").replaceAll("(\r\n)|\r", "\n")
assert(found.contains("object bar"))
}

Expand Down Expand Up @@ -200,7 +200,7 @@ object BuildInfoTests extends TestSuite {
test("java-static") - UnitTester(BuildInfoJavaStatic, testModuleSourcesPath / "java").scoped {
eval =>
val runResult = eval.outPath / "hello-mill"
val generatedSrc = eval.outPath / "buildInfoSources.dest" / "foo" / "BuildInfo.java"
val generatedSrc = eval.outPath / "buildInfoSources.dest/foo/BuildInfo.java"
val Right(_) =
eval.apply(BuildInfoJavaStatic.run(T.task(Args(runResult.toString))))

Expand Down
2 changes: 1 addition & 1 deletion contrib/flyway/src/mill/contrib/flyway/FlywayModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait FlywayModule extends JavaModule {
def flywayUser: T[String] = T("")
def flywayPassword: T[String] = T("")
def flywayFileLocations: T[Seq[PathRef]] = T {
resources().map(pr => PathRef(pr.path / "db" / "migration", pr.quick))
resources().map(pr => PathRef(pr.path / "db/migration", pr.quick))
}

def flywayDriverDeps: T[Agg[Dep]]
Expand Down
4 changes: 2 additions & 2 deletions contrib/playlib/test/src/mill/playlib/PlayModuleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ object PlayModuleTests extends TestSuite with PlayTestSuite {
os.RelPath("views/html/main$.class"),
os.RelPath("views/html/main.class")
).map(
eval.outPath / "core" / scalaVersion / playVersion / "compile.dest" / "classes" / _
eval.outPath / "core" / scalaVersion / playVersion / "compile.dest/classes" / _
)
assert(
result.value.classes.path == eval.outPath / "core" / scalaVersion / playVersion / "compile.dest" / "classes",
result.value.classes.path == eval.outPath / "core" / scalaVersion / playVersion / "compile.dest/classes",
outputClassFiles.nonEmpty,
outputClassFiles.forall(expectedClassfiles.contains),
outputClassFiles.size == 15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ object PlaySingleApiModuleTests extends TestSuite with PlayTestSuite {
os.RelPath("router/RoutesPrefix$.class"),
os.RelPath("router/RoutesPrefix.class")
).map(
eval.outPath / "compile.dest" / "classes" / _
eval.outPath / "compile.dest/classes" / _
)
assert(
result.value.classes.path == eval.outPath / "compile.dest" / "classes",
result.value.classes.path == eval.outPath / "compile.dest/classes",
outputFiles.nonEmpty,
outputFiles.forall(expectedClassfiles.contains),
outputFiles.size == 11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ object PlaySingleModuleTests extends TestSuite with PlayTestSuite {
os.RelPath("views/html/main$.class"),
os.RelPath("views/html/main.class")
).map(
eval.outPath / "compile.dest" / "classes" / _
eval.outPath / "compile.dest/classes" / _
)
assert(
result.value.classes.path == eval.outPath / "compile.dest" / "classes",
result.value.classes.path == eval.outPath / "compile.dest/classes",
outputFiles.nonEmpty,
outputFiles.forall(expectedClassfiles.contains),
outputFiles.size == 15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ object TutorialTests extends TestSuite {
object TutorialWithSpecificSources extends TutorialBase {
object core extends TutorialModule {
override def scalaPBSources: T[Seq[PathRef]] = T.sources {
millSourcePath / "protobuf" / "tutorial" / "Tutorial.proto"
millSourcePath / "protobuf/tutorial/Tutorial.proto"
}

override def scalaPBSearchDeps = true
override def scalaPBIncludePath = Seq(
PathRef(millSourcePath / "protobuf" / "tutorial")
PathRef(millSourcePath / "protobuf/tutorial")
)
}
}

val resourcePath: os.Path = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER"))

def protobufOutPath(eval: UnitTester): os.Path =
eval.outPath / "core" / "compileScalaPB.dest" / "com" / "example" / "tutorial"
eval.outPath / "core/compileScalaPB.dest/com/example/tutorial"

def compiledSourcefiles: Seq[os.RelPath] = Seq[os.RelPath](
os.rel / "AddressBook.scala",
Expand Down Expand Up @@ -92,7 +92,7 @@ object TutorialTests extends TestSuite {
val expectedSourcefiles = compiledSourcefiles.map(outPath / _)

assert(
result.value.path == eval.outPath / "core" / "compileScalaPB.dest",
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 5,
Expand Down Expand Up @@ -123,7 +123,7 @@ object TutorialTests extends TestSuite {
).map(outPath / _)

assert(
result.value.path == eval.outPath / "core" / "compileScalaPB.dest",
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SonatypeCentralPublisher(
val (_, releases) = mappings.partition(_._1.isSnapshot)

val releaseGroups = releases.groupBy(_._1.group)
val wd = os.pwd / "out" / "publish-central"
val wd = os.pwd / "out/publish-central"
os.makeDir.all(wd)

singleBundleName.fold {
Expand Down
14 changes: 7 additions & 7 deletions contrib/twirllib/test/src/mill/twirllib/HelloWorldTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ trait HelloWorldTests extends TestSuite {

def resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER"))
def compileClassfiles: Seq[os.RelPath] = Seq[os.RelPath](
os.rel / "html" / "hello.template.scala",
os.rel / "html" / "wrapper.template.scala",
os.rel / "svg" / "test.template.scala"
os.rel / "html/hello.template.scala",
os.rel / "html/wrapper.template.scala",
os.rel / "svg/test.template.scala"
)

def expectedDefaultImports: Seq[String] = Seq(
Expand Down Expand Up @@ -85,11 +85,11 @@ trait HelloWorldTests extends TestSuite {

val outputFiles = os.walk(result.value.classes.path).filter(_.last.endsWith(".scala"))
val expectedClassfiles = compileClassfiles.map(
eval.outPath / "core" / "compileTwirl.dest" / _
eval.outPath / "core/compileTwirl.dest" / _
)

assert(
result.value.classes.path == eval.outPath / "core" / "compileTwirl.dest",
result.value.classes.path == eval.outPath / "core/compileTwirl.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedClassfiles.contains),
outputFiles.size == 3,
Expand Down Expand Up @@ -126,7 +126,7 @@ trait HelloWorldTests extends TestSuite {

val outputFiles = os.walk(result.value.classes.path).filter(_.last.endsWith(".scala"))
val expectedClassfiles = compileClassfiles.map(name =>
eval.outPath / "core" / "compileTwirl.dest" / name / os.RelPath.up / name.last.replace(
eval.outPath / "core/compileTwirl.dest" / name / os.RelPath.up / name.last.replace(
".template.scala",
"$$TwirlInclusiveDot.template.scala"
)
Expand All @@ -135,7 +135,7 @@ trait HelloWorldTests extends TestSuite {
println(s"outputFiles: $outputFiles")

assert(
result.value.classes.path == eval.outPath / "core" / "compileTwirl.dest",
result.value.classes.path == eval.outPath / "core/compileTwirl.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedClassfiles.contains),
outputFiles.size == 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object IntegrationTests extends TestSuite {
assert(res2.out.contains("Line Count: 17"))
assert(tester.out("lineCount").value[Int] == 17)

tester.modifyFile(tester.workspacePath / "src" / "foo" / "Foo.java", _ + "\n")
tester.modifyFile(tester.workspacePath / "src/foo/Foo.java", _ + "\n")

val res3 = tester.eval("run") // Additional newline forces recompile and increases line count
assert(res3.err.contains("compiling 1 Java source"))
Expand Down
2 changes: 1 addition & 1 deletion idea/src/mill/idea/GenIdeaImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ case class GenIdeaImpl(
)
),
// Tuple2(
// os.sub / "mill_modules" / "mill-build.iml",
// os.sub / "mill_modules/mill-build.iml",
// rootXmlTemplate(allBuildLibraries.flatMap(lib => libraryNames(lib)))
// ),
Tuple2(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ object AuxiliaryClassFilesTests extends UtestIntegrationTestSuite {
import tester._
assert(eval("app.jvm.compile").isSuccess)

val classes = workspacePath / "out" / "app" / "jvm" / "compile.dest" / "classes"
val classes = workspacePath / "out/app/jvm/compile.dest/classes"
val firstRun = os.list(classes).map(_.last)

os.remove(workspacePath / "app" / "src" / "foo.scala")
os.remove(workspacePath / "app/src/foo.scala")

assert(eval("app.jvm.compile").isSuccess)

Expand All @@ -28,14 +28,14 @@ object AuxiliaryClassFilesTests extends UtestIntegrationTestSuite {
test("compilation fails when deleting a class used by other files") - integrationTest {
tester =>
import tester._
os.write(workspacePath / "app" / "src" / "bar.scala", "object bar { println(foo) }")
os.write(workspacePath / "app/src/bar.scala", "object bar { println(foo) }")
val firstRunSuccessful = eval("app.jvm.compile")
assert(firstRunSuccessful.isSuccess)

val classes = workspacePath / "out" / "app" / "jvm" / "compile.dest" / "classes"
val classes = workspacePath / "out/app/jvm/compile.dest/classes"
val firstRun = os.list(classes).map(_.last)

os.remove(workspacePath / "app" / "src" / "foo.scala")
os.remove(workspacePath / "app/src/foo.scala")

val secondRunSuccessful = eval("app.jvm.compile")
assert(!secondRunSuccessful.isSuccess)
Expand All @@ -57,10 +57,10 @@ object AuxiliaryClassFilesTests extends UtestIntegrationTestSuite {
import tester._
assert(eval("app.native.compile").isSuccess)

val classes = workspacePath / "out" / "app" / "native" / "compile.dest" / "classes"
val classes = workspacePath / "out/app/native/compile.dest/classes"
val firstRun = os.list(classes).map(_.last)

os.remove(workspacePath / "app" / "src" / "foo.scala")
os.remove(workspacePath / "app/src/foo.scala")

assert(eval("app.native.compile").isSuccess)

Expand All @@ -75,10 +75,10 @@ object AuxiliaryClassFilesTests extends UtestIntegrationTestSuite {
import tester._
assert(eval("app.js.compile").isSuccess)

val classes = workspacePath / "out" / "app" / "js" / "compile.dest" / "classes"
val classes = workspacePath / "out/app/js/compile.dest/classes"
val firstRun = os.list(classes).map(_.last)

os.remove(workspacePath / "app" / "src" / "foo.scala")
os.remove(workspacePath / "app/src/foo.scala")

assert(eval("app.js.compile").isSuccess)

Expand Down
2 changes: 1 addition & 1 deletion integration/feature/init/src/MillInitTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object MillInitTests extends UtestIntegrationTestSuite {
test("Mill init works") - integrationTest { tester =>
import tester._
eval(("init", "com-lihaoyi/mill-scala-hello.g8", "--name=example")).isSuccess ==> true
val projFile = workspacePath / "example" / "build.sc"
val projFile = workspacePath / "example/build.sc"
assert(os.exists(projFile))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object ImportRepoTests extends UtestIntegrationTestSuite {
// ```
// and use it as additional repository
assert(eval("foo.resolvedIvyDeps").isSuccess)
val model = os.read(workspacePath / "out" / "mill-build" / "parseBuildFiles.json")
val model = os.read(workspacePath / "out/mill-build/parseBuildFiles.json")
assert(model.contains("""file:///tmp/testrepo""""))
}
}
Expand Down
6 changes: 3 additions & 3 deletions integration/ide/bloop/src/BloopTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ object BloopTests extends UtestIntegrationTestSuite {
import tester._
val installResult: Boolean = eval("mill.contrib.bloop.Bloop/install").isSuccess
assert(installResult)
assert(os.exists(workspacePath / ".bloop" / "root-module.json"))
assert(os.exists(workspacePath / ".bloop/root-module.json"))
}
test("mill-build module bloop config should be created") - integrationTest { tester =>
import tester._
val installResult: Boolean = eval("mill.contrib.bloop.Bloop/install").isSuccess
val millBuildJsonFile = workspacePath / ".bloop" / "mill-build-.json"
val millBuildJsonFile = workspacePath / ".bloop/mill-build-.json"
assert(installResult)
assert(os.exists(millBuildJsonFile))
}

test("mill-build config should contain build.mill source") - integrationTest { tester =>
import tester._
val millBuildJsonFile = workspacePath / ".bloop" / "mill-build-.json"
val millBuildJsonFile = workspacePath / ".bloop/mill-build-.json"
val installResult: Boolean = eval("mill.contrib.bloop.Bloop/install").isSuccess
val config = ujson.read(os.read.stream(millBuildJsonFile))
assert(installResult)
Expand Down
2 changes: 1 addition & 1 deletion integration/ide/bsp-modules/src/BspModulesTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object BspModulesTests extends UtestIntegrationTestSuite {
import tester._
val res = eval("validate")
assert(res.isSuccess)
val file = workspacePath / "out" / "validate.dest" / "transitive-modules.json"
val file = workspacePath / "out/validate.dest/transitive-modules.json"
assert(os.exists(file))
val readModules = os.read.lines(file).sorted
val expectedModules = Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object ScriptsInvalidationTests extends UtestIntegrationTestSuite {

// second run modifying script
modifyFile(
workspacePath / "b" / "inputD.mill",
workspacePath / "b/inputD.mill",
_.replace("""println("d")""", """System.out.println("d2")""")
)

Expand Down
Loading

0 comments on commit d91447b

Please sign in to comment.