From 2e2a8eb83aaac135f3e5452d2f7cc82ed05e40b5 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 16:13:10 +0800 Subject: [PATCH 01/14] Create .mill-version --- .mill-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .mill-version diff --git a/.mill-version b/.mill-version new file mode 100644 index 0000000..17efad1 --- /dev/null +++ b/.mill-version @@ -0,0 +1 @@ +0.12.0-RC1 From cdbd260adefe3eb8fe3e26e86c9dc21878ae6737 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 16:57:06 +0800 Subject: [PATCH 02/14] . --- mill | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mill b/mill index 41278e8..d03a045 100755 --- a/mill +++ b/mill @@ -7,7 +7,7 @@ set -e if [ -z "${DEFAULT_MILL_VERSION}" ] ; then - DEFAULT_MILL_VERSION=0.11.11 + DEFAULT_MILL_VERSION=0.11.12 fi if [ -z "$MILL_VERSION" ] ; then @@ -53,7 +53,9 @@ if [ -z "$MILL_MAIN_CLI" ] ; then fi MILL_FIRST_ARG="" -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then + + # first arg is a long flag for "--interactive" or starts with "-i" +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then # Need to preserve the first position of those listed options MILL_FIRST_ARG=$1 shift From 6f390d2de2dced2bc1718df91a224d16e8058169 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 16:58:55 +0800 Subject: [PATCH 03/14] . --- build.sc | 6 +++--- docs/generateDocs.sc | 2 +- scalasql/test/src/WorldSqlTests.scala | 4 ++-- scalasql/test/src/utils/TestChecker.scala | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sc b/build.sc index ce5623b..4d988c3 100644 --- a/build.sc +++ b/build.sc @@ -212,13 +212,13 @@ trait ScalaSql extends Common{ common => val generatedCodeHeader = "[//]: # (GENERATED SOURCES, DO NOT EDIT DIRECTLY)" def generateTutorial() = T.command { generateDocs.generateTutorial( - os.pwd / "scalasql" / "test" / "src" / "WorldSqlTests.scala", - os.pwd / "docs" / "tutorial.md" + T.workspace / "scalasql" / "test" / "src" / "WorldSqlTests.scala", + T.workspace / "docs" / "tutorial.md" ) } def generateReference() = T.command { generateDocs.generateReference( - os.pwd / "docs" / "reference.md", + T.workspace / "docs" / "reference.md", (sources, config) => mill.scalalib.scalafmt.ScalafmtWorkerModule .worker() diff --git a/docs/generateDocs.sc b/docs/generateDocs.sc index d32b96a..6de3fd7 100644 --- a/docs/generateDocs.sc +++ b/docs/generateDocs.sc @@ -25,7 +25,7 @@ def generateTutorial(sourcePath: os.Path, destPath: os.Path) = { case ("", _) => outputLines.append("") case (s"// +INCLUDE $rest", _) => - os.read.lines(os.pwd / os.SubPath(rest)).foreach(outputLines.append) + os.read.lines(mill.api.WorkspaceRoot.workspaceRoot / os.SubPath(rest)).foreach(outputLines.append) case (s"//$rest", false) => outputLines.append(rest.stripPrefix(" ")) diff --git a/scalasql/test/src/WorldSqlTests.scala b/scalasql/test/src/WorldSqlTests.scala index 0bc472d..aa5b7f8 100644 --- a/scalasql/test/src/WorldSqlTests.scala +++ b/scalasql/test/src/WorldSqlTests.scala @@ -127,8 +127,8 @@ object WorldSqlTests extends TestSuite { ) val db = dbClient.getAutoCommitClientConnection - db.updateRaw(os.read(os.pwd / "scalasql" / "test" / "resources" / "world-schema.sql")) - db.updateRaw(os.read(os.pwd / "scalasql" / "test" / "resources" / "world-data.sql")) + db.updateRaw(os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / "world-schema.sql")) + db.updateRaw(os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / "world-data.sql")) // We use `dbClient.getAutoCommitClientConnection` in order to create a client that // will automatically run every SQL command in a new transaction and commit it. For // the majority of examples in this page, the exact transaction configuration doesn't diff --git a/scalasql/test/src/utils/TestChecker.scala b/scalasql/test/src/utils/TestChecker.scala index bc1b846..6d4fd6c 100644 --- a/scalasql/test/src/utils/TestChecker.scala +++ b/scalasql/test/src/utils/TestChecker.scala @@ -19,10 +19,10 @@ class TestChecker( val autoCommitConnection = dbClient.getAutoCommitClientConnection def reset() = { autoCommitConnection.updateRaw( - os.read(os.pwd / "scalasql" / "test" / "resources" / testSchemaFileName) + os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / testSchemaFileName) ) autoCommitConnection.updateRaw( - os.read(os.pwd / "scalasql" / "test" / "resources" / testDataFileName) + os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / testDataFileName) ) } From 7648445abf37221bdb822e78fd1fb3de5a537881 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 17:16:23 +0800 Subject: [PATCH 04/14] . --- .github/workflows/build.yml | 4 ++++ scalasql/test/src/WorldSqlTests.scala | 4 ++-- scalasql/test/src/utils/TestChecker.scala | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5376e7a..85c6f9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,10 @@ name: ci on: push: + branches: + - master + tags: + - '*' pull_request: branches: - main diff --git a/scalasql/test/src/WorldSqlTests.scala b/scalasql/test/src/WorldSqlTests.scala index aa5b7f8..218a585 100644 --- a/scalasql/test/src/WorldSqlTests.scala +++ b/scalasql/test/src/WorldSqlTests.scala @@ -127,8 +127,8 @@ object WorldSqlTests extends TestSuite { ) val db = dbClient.getAutoCommitClientConnection - db.updateRaw(os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / "world-schema.sql")) - db.updateRaw(os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / "world-data.sql")) + db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-schema.sql")) + db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-data.sql")) // We use `dbClient.getAutoCommitClientConnection` in order to create a client that // will automatically run every SQL command in a new transaction and commit it. For // the majority of examples in this page, the exact transaction configuration doesn't diff --git a/scalasql/test/src/utils/TestChecker.scala b/scalasql/test/src/utils/TestChecker.scala index 6d4fd6c..7f97d80 100644 --- a/scalasql/test/src/utils/TestChecker.scala +++ b/scalasql/test/src/utils/TestChecker.scala @@ -19,10 +19,10 @@ class TestChecker( val autoCommitConnection = dbClient.getAutoCommitClientConnection def reset() = { autoCommitConnection.updateRaw( - os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / testSchemaFileName) + os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / testSchemaFileName) ) autoCommitConnection.updateRaw( - os.read(os.Path("MILL_TEST_RESOURCE_FOLDER") / testDataFileName) + os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / testDataFileName) ) } From b08e6a87b409bb32def9035f1c6155d555fedc2c Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 17:58:53 +0800 Subject: [PATCH 05/14] . --- build.sc | 1 + docs/generateDocs.sc | 2 +- scalasql/test/src/UtestFramework.scala | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sc b/build.sc index 4d988c3..ffe0d3c 100644 --- a/build.sc +++ b/build.sc @@ -67,6 +67,7 @@ trait ScalaSql extends Common{ common => def testFramework = "scalasql.UtestFramework" def forkArgs = Seq("-Duser.timezone=Asia/Singapore") + def forkEnv = Map("MILL_WORKSPACE_ROOT" -> T.workspace) } private def indent(code: Iterable[String]): String = diff --git a/docs/generateDocs.sc b/docs/generateDocs.sc index 6de3fd7..04b66a8 100644 --- a/docs/generateDocs.sc +++ b/docs/generateDocs.sc @@ -49,7 +49,7 @@ def generateTutorial(sourcePath: os.Path, destPath: os.Path) = { } def generateReference(dest: os.Path, scalafmtCallback: (Seq[os.Path], os.Path) => Unit) = { def dropExprPrefix(s: String) = s.split('.').drop(2).mkString(".") - val records = upickle.default.read[Seq[Record]](os.read.stream(os.pwd / "out" / "recordedTests.json")) + val records = upickle.default.read[Seq[Record]](os.read.stream(mill.api.WorkspaceRoot.workspaceRoot / "out" / "recordedTests.json")) val suiteDescriptions = upickle.default.read[Map[String, String]](os.read.stream(os.pwd / "out" / "recordedSuiteDescriptions.json")) .map{case (k, v) => (dropExprPrefix(k), v)} diff --git a/scalasql/test/src/UtestFramework.scala b/scalasql/test/src/UtestFramework.scala index e443d04..de1d809 100644 --- a/scalasql/test/src/UtestFramework.scala +++ b/scalasql/test/src/UtestFramework.scala @@ -26,12 +26,13 @@ class UtestFramework extends utest.runner.Framework { } override def teardown() = { println("Tearing down CustomFramework " + recordedTests.size) + val workspaceRoot = os.Path(sys.env("MILL_WORKSPACE_ROOT")) os.write.over( - os.pwd / "out" / "recordedTests.json", + workspaceRoot / "out" / "recordedTests.json", upickle.default.write(UtestFramework.recordedTests, indent = 4) ) os.write.over( - os.pwd / "out" / "recordedSuiteDescriptions.json", + workspaceRoot / "out" / "recordedSuiteDescriptions.json", upickle.default.write(UtestFramework.recordedSuiteDescriptions, indent = 4) ) recordedTests.clear() From 4d5edd860cd9d7bdea4808fe9c3ad30b457b8e1c Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 17:59:30 +0800 Subject: [PATCH 06/14] . --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index ffe0d3c..18357a2 100644 --- a/build.sc +++ b/build.sc @@ -67,7 +67,7 @@ trait ScalaSql extends Common{ common => def testFramework = "scalasql.UtestFramework" def forkArgs = Seq("-Duser.timezone=Asia/Singapore") - def forkEnv = Map("MILL_WORKSPACE_ROOT" -> T.workspace) + def forkEnv = Map("MILL_WORKSPACE_ROOT" -> T.workspace.toString()) } private def indent(code: Iterable[String]): String = From 334fabed64aa56968fdc71be8590411510a11fbf Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 18:07:11 +0800 Subject: [PATCH 07/14] . --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85c6f9e..91176a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: distribution: 'temurin' java-version: 17 - - run: ./mill -i "__.test" + generateTutorial + generateReference && git diff --exit-code + - run: ./mill -i "__.test" && ./mill -i generateTutorial + generateReference && git diff --exit-code check-scalafix: runs-on: ubuntu-latest From e3e5881e38bbe863fd5170490a07f233381a2497 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 18:13:58 +0800 Subject: [PATCH 08/14] . --- docs/generateDocs.sc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/generateDocs.sc b/docs/generateDocs.sc index 04b66a8..5a1e6ef 100644 --- a/docs/generateDocs.sc +++ b/docs/generateDocs.sc @@ -50,13 +50,13 @@ def generateTutorial(sourcePath: os.Path, destPath: os.Path) = { def generateReference(dest: os.Path, scalafmtCallback: (Seq[os.Path], os.Path) => Unit) = { def dropExprPrefix(s: String) = s.split('.').drop(2).mkString(".") val records = upickle.default.read[Seq[Record]](os.read.stream(mill.api.WorkspaceRoot.workspaceRoot / "out" / "recordedTests.json")) - val suiteDescriptions = upickle.default.read[Map[String, String]](os.read.stream(os.pwd / "out" / "recordedSuiteDescriptions.json")) + val suiteDescriptions = upickle.default.read[Map[String, String]](os.read.stream(mill.api.WorkspaceRoot.workspaceRoot / "out" / "recordedSuiteDescriptions.json")) .map{case (k, v) => (dropExprPrefix(k), v)} val rawScalaStrs = records.flatMap(r => Seq(r.queryCodeString) ++ r.resultCodeString) val formattedScalaStrs = { val tmps = rawScalaStrs.map(os.temp(_, suffix = ".scala")) - scalafmtCallback(tmps, os.pwd / ".scalafmt.conf") + scalafmtCallback(tmps, mill.api.WorkspaceRoot.workspaceRoot / ".scalafmt.conf") tmps.map(os.read(_).trim) } From adfc428e7902dbd3e3c8b08307650feff028868c Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 9 Sep 2024 21:27:02 +0800 Subject: [PATCH 09/14] . --- docs/tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 34cd47f..79f25b3 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -134,8 +134,8 @@ val dbClient = new DbClient.Connection( ) val db = dbClient.getAutoCommitClientConnection -db.updateRaw(os.read(os.pwd / "scalasql" / "test" / "resources" / "world-schema.sql")) -db.updateRaw(os.read(os.pwd / "scalasql" / "test" / "resources" / "world-data.sql")) +db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-schema.sql")) +db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-data.sql")) ``` We use `dbClient.getAutoCommitClientConnection` in order to create a client that From 95bc5090e1655ece0441e9e3924b29dfe0e53982 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Fri, 4 Oct 2024 20:24:18 +0800 Subject: [PATCH 10/14] Update .mill-version --- .mill-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mill-version b/.mill-version index 17efad1..570985f 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.12.0-RC1 +0.12.0-RC3 From a3c3eac3784edab5aab0809e651852a954bafaad Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Tue, 22 Oct 2024 07:23:50 +0800 Subject: [PATCH 11/14] Update .mill-version --- .mill-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mill-version b/.mill-version index 570985f..53cf705 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.12.0-RC3 +0.12.0-RC3-102-b8217f From d0b6bd9b243156d8fccabf1b3a71025756f7c26e Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Tue, 22 Oct 2024 07:51:23 +0800 Subject: [PATCH 12/14] . --- docs/tutorial.md | 4 ++-- scalasql/test/src/WorldSqlTests.scala | 4 ++-- scalasql/test/src/utils/TestChecker.scala | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 79f25b3..ba10f6a 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -134,8 +134,8 @@ val dbClient = new DbClient.Connection( ) val db = dbClient.getAutoCommitClientConnection -db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-schema.sql")) -db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-data.sql")) +db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "world-schema.sql")) +db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "world-data.sql")) ``` We use `dbClient.getAutoCommitClientConnection` in order to create a client that diff --git a/scalasql/test/src/WorldSqlTests.scala b/scalasql/test/src/WorldSqlTests.scala index 218a585..5433f70 100644 --- a/scalasql/test/src/WorldSqlTests.scala +++ b/scalasql/test/src/WorldSqlTests.scala @@ -127,8 +127,8 @@ object WorldSqlTests extends TestSuite { ) val db = dbClient.getAutoCommitClientConnection - db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-schema.sql")) - db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / "world-data.sql")) + db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "world-schema.sql")) + db.updateRaw(os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "world-data.sql")) // We use `dbClient.getAutoCommitClientConnection` in order to create a client that // will automatically run every SQL command in a new transaction and commit it. For // the majority of examples in this page, the exact transaction configuration doesn't diff --git a/scalasql/test/src/utils/TestChecker.scala b/scalasql/test/src/utils/TestChecker.scala index 7f97d80..86f31ec 100644 --- a/scalasql/test/src/utils/TestChecker.scala +++ b/scalasql/test/src/utils/TestChecker.scala @@ -19,10 +19,10 @@ class TestChecker( val autoCommitConnection = dbClient.getAutoCommitClientConnection def reset() = { autoCommitConnection.updateRaw( - os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / testSchemaFileName) + os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / testSchemaFileName) ) autoCommitConnection.updateRaw( - os.read(os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) / testDataFileName) + os.read(os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / testDataFileName) ) } From eec35fab965e9a82c3f3fa7504be7fe99e730515 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Tue, 22 Oct 2024 07:57:03 +0800 Subject: [PATCH 13/14] . --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 18357a2..94cb573 100644 --- a/build.sc +++ b/build.sc @@ -1,7 +1,7 @@ import $file.docs.generateDocs import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` import $ivy.`com.github.lolgab::mill-mima::0.1.0` -import $ivy.`com.goyeau::mill-scalafix::0.4.0` +import $ivy.`com.goyeau::mill-scalafix::0.4.2` import de.tobiasroeser.mill.vcs.version.VcsVersion import com.goyeau.mill.scalafix.ScalafixModule import mill._, scalalib._, publish._ From 4037bcaa13d89d5515c6b7ab4831a3dc8292fd76 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Thu, 24 Oct 2024 07:27:49 +0800 Subject: [PATCH 14/14] Update .mill-version --- .mill-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mill-version b/.mill-version index 53cf705..ac454c6 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.12.0-RC3-102-b8217f +0.12.0