diff --git a/.github/scripts/build-linux-aarch64-from-docker.sh b/.github/scripts/build-linux-aarch64-from-docker.sh index ad33bd5390..9c8c75b483 100755 --- a/.github/scripts/build-linux-aarch64-from-docker.sh +++ b/.github/scripts/build-linux-aarch64-from-docker.sh @@ -12,7 +12,7 @@ eval "$(cs java --env --jvm temurin:17 --jvm-index https://github.com/coursier/j git config --global --add safe.directory "$(pwd)" ./mill -i show 'cli[]'.nativeImage -./mill -i copyDefaultLauncher ./artifacts +./mill -i copyDefaultLauncher --directory ./artifacts if "true" == $(./mill -i ci.shouldPublish); then .github/scripts/generate-os-packages.sh fi diff --git a/.github/scripts/generate-docker-image.sh b/.github/scripts/generate-docker-image.sh index 3ff00ce82a..36c1380ccb 100755 --- a/.github/scripts/generate-docker-image.sh +++ b/.github/scripts/generate-docker-image.sh @@ -5,7 +5,7 @@ ROOT="$(cd "$(dirname "$0")/../.." && pwd)" WORKDIR="$ROOT/out/docker-workdir" mkdir -p "$WORKDIR" -./mill -i copyTo 'cli[]'.nativeImageStatic "$WORKDIR/scala-cli" 1>&2 +./mill -i copyTo --task 'cli[]'.nativeImageStatic --dest "$WORKDIR/scala-cli" 1>&2 cd "$WORKDIR" docker build -t scala-cli -f "$ROOT/.github/scripts/docker/ScalaCliDockerFile" . diff --git a/.github/scripts/generate-native-image.sh b/.github/scripts/generate-native-image.sh index f9a48629ce..16a2d8f865 100755 --- a/.github/scripts/generate-native-image.sh +++ b/.github/scripts/generate-native-image.sh @@ -15,7 +15,7 @@ if [[ "$OSTYPE" == "msys" ]]; then export GRAALVM_HOME="$JAVA_HOME" export PATH="$(pwd)/bin:$PATH" echo "PATH=$PATH" - ./mill.bat -i "$COMMAND" generate-native-image.bat "" + ./mill.bat -i "$COMMAND" --scriptDest generate-native-image.bat --imageDest "" ./generate-native-image.bat else if [ $# == "0" ]; then @@ -42,7 +42,7 @@ else esac fi - ./mill -i "$COMMAND" generate-native-image.sh "" + ./mill -i "$COMMAND" --scriptDest generate-native-image.sh --imageDest "" bash ./generate-native-image.sh "${CLEANUP[@]}" fi diff --git a/.github/scripts/generate-os-packages.sh b/.github/scripts/generate-os-packages.sh index 1b2181bc22..74fbb43909 100755 --- a/.github/scripts/generate-os-packages.sh +++ b/.github/scripts/generate-os-packages.sh @@ -34,17 +34,17 @@ launcher() { launcherName="scala" fi - "$mill" -i copyTo "$launcherMillCommand" "$launcherName" 1>&2 + "$mill" -i copyTo --task "$launcherMillCommand" --dest "$launcherName" 1>&2 echo "$launcherName" } version() { - "$mill" -i writePackageVersionTo scala-cli-version 1>&2 + "$mill" -i writePackageVersionTo --dest scala-cli-version 1>&2 cat scala-cli-version } shortVersion() { - "$mill" -i writeShortPackageVersionTo scala-cli-short-version 1>&2 + "$mill" -i writeShortPackageVersionTo --dest scala-cli-short-version 1>&2 cat scala-cli-short-version } @@ -89,7 +89,7 @@ generate_msi() { # Having the MSI automatically install Visual C++ redistributable when needed, # see https://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_vcredist.html - "$mill" -i ci.writeWixConfigExtra wix-visual-cpp-redist.xml + "$mill" -i ci.writeWixConfigExtra --dest wix-visual-cpp-redist.xml packager \ --msi \ diff --git a/.github/scripts/generate-slim-docker-image.sh b/.github/scripts/generate-slim-docker-image.sh index a648683fd4..1b818d0cac 100755 --- a/.github/scripts/generate-slim-docker-image.sh +++ b/.github/scripts/generate-slim-docker-image.sh @@ -5,7 +5,7 @@ ROOT="$(cd "$(dirname "$0")/../.." && pwd)" WORKDIR="$ROOT/out/docker-slim-workdir" mkdir -p "$WORKDIR" -./mill -i copyTo 'cli[]'.nativeImageMostlyStatic "$WORKDIR/scala-cli" 1>&2 +./mill -i copyTo --task 'cli[]'.nativeImageMostlyStatic --dest "$WORKDIR/scala-cli" 1>&2 cd "$WORKDIR" docker build -t scala-cli-slim -f "$ROOT/.github/scripts/docker/ScalaCliSlimDockerFile" . diff --git a/.github/scripts/publish-sdkman.sh b/.github/scripts/publish-sdkman.sh index 10e0985f9d..347aa4261e 100755 --- a/.github/scripts/publish-sdkman.sh +++ b/.github/scripts/publish-sdkman.sh @@ -10,7 +10,7 @@ set -eu version() { - "./mill" -i writePackageVersionTo scala-cli-version 1>&2 + "./mill" -i writePackageVersionTo --dest scala-cli-version 1>&2 cat scala-cli-version } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a818da4f8..4b32553e8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,10 @@ jobs: with: jvm: "temurin:17" - name: Copy launcher - run: ./mill -i copyJvmLauncher artifacts/ + run: ./mill -i copyJvmLauncher --directory artifacts/ if: runner.os == 'Linux' - name: Copy bootstrapped launcher - run: ./mill -i copyJvmBootstrappedLauncher artifacts/ + run: ./mill -i copyJvmBootstrappedLauncher --directory artifacts/ if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 if: runner.os == 'Linux' @@ -197,7 +197,7 @@ jobs: if: env.SHOULD_PUBLISH == 'true' run: .github/scripts/generate-os-packages.sh - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ + run: ./mill -i copyDefaultLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: linux-launchers @@ -413,7 +413,7 @@ jobs: if: env.SHOULD_PUBLISH == 'true' run: .github/scripts/generate-os-packages.sh - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ + run: ./mill -i copyDefaultLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: macos-launchers @@ -616,7 +616,7 @@ jobs: if: env.SHOULD_PUBLISH == 'true' run: .github/scripts/generate-os-packages.sh - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ + run: ./mill -i copyDefaultLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: macos-m1-launchers @@ -822,7 +822,7 @@ jobs: run: .github/scripts/generate-os-packages.sh shell: bash - name: Copy artifacts - run: ./mill -i copyDefaultLauncher artifacts/ + run: ./mill -i copyDefaultLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: windows-launchers @@ -1050,7 +1050,7 @@ jobs: run: .github/scripts/generate-native-image.sh mostly-static shell: bash - name: Copy artifacts - run: ./mill -i copyMostlyStaticLauncher artifacts/ + run: ./mill -i copyMostlyStaticLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: mostly-static-launchers @@ -1253,7 +1253,7 @@ jobs: run: .github/scripts/generate-native-image.sh static shell: bash - name: Copy artifacts - run: ./mill -i copyStaticLauncher artifacts/ + run: ./mill -i copyStaticLauncher --directory artifacts/ - uses: actions/upload-artifact@v3 with: name: static-launchers @@ -1551,7 +1551,7 @@ jobs: - name: Java Home run: echo "$JAVA_HOME" - name: Build Scala CLI - run: ./mill copyJvmLauncher build + run: ./mill copyJvmLauncher --directory build - name: Build Benchmark run: java -jar ./build/scala-cli --power package --standalone gcbenchmark/gcbenchmark.scala -o gc - name: Run Benchmark diff --git a/.mill-version b/.mill-version index bd0119f963..34a83616bb 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.11.12 +0.12.1 diff --git a/.scalafix.conf b/.scalafix.conf index 8c4c426699..9f7d64a06a 100644 --- a/.scalafix.conf +++ b/.scalafix.conf @@ -19,4 +19,5 @@ OrganizeImports { expandRelative = true groups = ["*", "re:javax?\\.", "scala."] groupedImports = AggressiveMerge + targetDialect = Scala3 } diff --git a/.scalafix3.conf b/.scalafix3.conf index e5a920e622..63c037bbdf 100644 --- a/.scalafix3.conf +++ b/.scalafix3.conf @@ -21,4 +21,5 @@ OrganizeImports { groups = ["*", "re:javax?\\.", "scala."] groupedImports = AggressiveMerge removeUnused = false # added for Scala 3 + targetDialect = Scala3 } diff --git a/build.sc b/build.mill.scala similarity index 94% rename from build.sc rename to build.mill.scala index 811d015c4c..6ae6ef1bfa 100644 --- a/build.sc +++ b/build.mill.scala @@ -1,9 +1,14 @@ +package build + +import $packages._ + import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION` import $ivy.`io.get-coursier::coursier-launcher:2.1.13` -import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.26` +import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.29` import $file.project.deps, deps.{Deps, Docker, InternalDeps, Java, Scala, TestDeps} -import $file.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule, organization} -import $file.project.settings, settings.{ +import build.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule, organization} +import build.project.settings +import build.project.settings.{ CliLaunchers, FormatNativeImageConf, HasTests, @@ -18,8 +23,8 @@ import $file.project.settings, settings.{ projectFileName, jvmPropertiesFileName } -import $file.project.deps, deps.customRepositories -import $file.project.website +import project.deps.customRepositories +import project.website import java.io.File import java.net.URL @@ -194,17 +199,17 @@ trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests object test extends ScalaCliTests with ScalaCliScalafixModule { def forkEnv = super.forkEnv() ++ extraEnv() ++ Seq( - "SCALA_CLI_EXAMPLES" -> (os.pwd / "examples").toString, - "SCALA_CLI_GIF_SCENARIOS" -> (os.pwd / "gifs" / "scenarios").toString, - "SCALA_CLI_WEBSITE_IMG" -> (os.pwd / "website" / "static" / "img").toString, - "SCALA_CLI_GIF_RENDERER_DOCKER_DIR" -> (os.pwd / "gifs").toString, - "SCALA_CLI_SVG_RENDERER_DOCKER_DIR" -> (os.pwd / "gifs" / "svg_render").toString + "SCALA_CLI_EXAMPLES" -> (T.workspace / "examples").toString, + "SCALA_CLI_GIF_SCENARIOS" -> (T.workspace / "gifs" / "scenarios").toString, + "SCALA_CLI_WEBSITE_IMG" -> (T.workspace / "website" / "static" / "img").toString, + "SCALA_CLI_GIF_RENDERER_DOCKER_DIR" -> (T.workspace / "gifs").toString, + "SCALA_CLI_SVG_RENDERER_DOCKER_DIR" -> (T.workspace / "gifs" / "svg_render").toString ) def resources = T.sources { // Adding markdown directories here, so that they're watched for changes in watch mode Seq( - PathRef(os.pwd / "website" / "docs" / "commands"), - PathRef(os.pwd / "website" / "docs" / "cookbooks") + PathRef(T.workspace / "website" / "docs" / "commands"), + PathRef(T.workspace / "website" / "docs" / "cookbooks") ) ++ super.resources() } } @@ -299,7 +304,7 @@ trait BuildMacros extends ScalaCliCrossSbtModule } def testNegativeCompilation() = T.command { - val base = os.pwd / "modules" / "build-macros" / "src" + val base = T.workspace / "modules" / "build-macros" / "src" val negativeTests = Seq( "MismatchedLeft.scala" -> Seq( "Found\\: +EE1".r, @@ -408,7 +413,7 @@ trait Core extends ScalaCliCrossSbtModule val testRunnerMainClass = `test-runner`(Scala.runnerScala3) .mainClass() .getOrElse(sys.error("No main class defined for test-runner")) - val runnerMainClass = runner(Scala.runnerScala3) + val runnerMainClass = build.runner(Scala.runnerScala3) .mainClass() .getOrElse(sys.error("No main class defined for runner")) val detailedVersionValue = @@ -438,9 +443,9 @@ trait Core extends ScalaCliCrossSbtModule | def testRunnerVersion = "${`test-runner`(Scala.runnerScala3).publishVersion()}" | def testRunnerMainClass = "$testRunnerMainClass" | - | def runnerOrganization = "${runner(Scala.runnerScala3).pomSettings().organization}" - | def runnerModuleName = "${runner(Scala.runnerScala3).artifactName()}" - | def runnerVersion = "${runner(Scala.runnerScala3).publishVersion()}" + | def runnerOrganization = "${build.runner(Scala.runnerScala3).pomSettings().organization}" + | def runnerModuleName = "${build.runner(Scala.runnerScala3).artifactName()}" + | def runnerVersion = "${build.runner(Scala.runnerScala3).publishVersion()}" | def runnerMainClass = "$runnerMainClass" | | def semanticDbPluginOrganization = "${Deps.semanticDbScalac.dep.module.organization @@ -618,13 +623,6 @@ trait Config extends ScalaCliCrossSbtModule def scalacOptions = T { super.scalacOptions() ++ Seq("-release", "8") } - - // Disabling Scalafix in 2.13 and 3, so that it doesn't remove - // some compatibility-related imports, that are actually only used - // in Scala 2.12. - def fix(args: String*) = - if (crossScalaVersion.startsWith("2.12.")) super.fix(args: _*) - else T.command(()) } trait Options extends ScalaCliCrossSbtModule with ScalaCliPublishModule with HasTests @@ -934,7 +932,8 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers mainClass = `scala3-graal-processor`(crossScalaVersion).finalMainClass(), classPath = `scala3-graal-processor`(crossScalaVersion).runClasspath().map(_.path), mainArgs = Seq(cache.toNIO.toString, classpath), - workingDir = os.pwd + workingDir = T.workspace, + streamOut = false ) val cp = res.out.trim() cp.split(File.pathSeparator).toSeq.map(p => PathRef(os.Path(p))) @@ -1009,8 +1008,8 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests val mostlyStaticDockerfile = os.rel / ".github" / "scripts" / "docker" / "ScalaCliSlimDockerFile" assert( - os.exists(os.pwd / mostlyStaticDockerfile), - s"Error: ${os.pwd / mostlyStaticDockerfile} not found" + os.exists(T.workspace / mostlyStaticDockerfile), + s"Error: ${T.workspace / mostlyStaticDockerfile} not found" ) val code = s"""package scala.cli.integration @@ -1114,7 +1113,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests val dir = Option(System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY")).getOrElse { sys.error("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY not set") } - val content = importedLauncher(dir) + val content = importedLauncher(T.workspace, dir) os.write( launcher, content, @@ -1131,7 +1130,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests val dir = Option(System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY")).getOrElse { sys.error("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY not set") } - val content = importedLauncher(dir) + val content = importedLauncher(T.workspace, dir) os.write(launcher, content, createFolders = true) } PathRef(launcher) @@ -1144,7 +1143,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests Option(System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY")).getOrElse { sys.error("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY not set") } - val content = importedLauncher(dir) + val content = importedLauncher(T.workspace, dir) os.write(launcher, content, createFolders = true) } PathRef(launcher) @@ -1275,12 +1274,13 @@ object `local-repo` extends LocalRepo { def publishSonatype(tasks: mill.main.Tasks[PublishModule.PublishData]) = T.command { publish.publishSonatype( data = define.Target.sequence(tasks.value)(), - log = T.ctx().log + log = T.ctx().log, + workspace = T.workspace ) } def copyTo(task: mill.main.Tasks[PathRef], dest: String) = T.command { - val destPath = os.Path(dest, os.pwd) + val destPath = os.Path(dest, T.workspace) if (task.value.length > 1) sys.error("Expected a single task") val ref = task.value.head() @@ -1289,7 +1289,7 @@ def copyTo(task: mill.main.Tasks[PathRef], dest: String) = T.command { } def writePackageVersionTo(dest: String) = T.command { - val destPath = os.Path(dest, os.pwd) + val destPath = os.Path(dest, T.workspace) val rawVersion = cli(Scala.defaultInternal).publishVersion() val version = if (rawVersion.contains("+")) rawVersion.stripSuffix("-SNAPSHOT") @@ -1298,15 +1298,15 @@ def writePackageVersionTo(dest: String) = T.command { } def writeShortPackageVersionTo(dest: String) = T.command { - val destPath = os.Path(dest, os.pwd) + val destPath = os.Path(dest, T.workspace) val rawVersion = cli(Scala.defaultInternal).publishVersion() val version = rawVersion.takeWhile(c => c != '-' && c != '+') os.write.over(destPath, version) } -def importedLauncher(directory: String = "artifacts"): Array[Byte] = { +def importedLauncher(workspace: os.Path, directory: String = "artifacts"): Array[Byte] = { val ext = if (Properties.isWin) ".zip" else ".gz" - val from = os.Path(directory, os.pwd) / s"scala-cli-${Upload.platformSuffix}$ext" + val from = os.Path(directory, workspace) / s"scala-cli-${Upload.platformSuffix}$ext" System.err.println(s"Importing launcher from $from") if (!os.exists(from)) sys.error(s"$from not found") @@ -1338,7 +1338,8 @@ def copyLauncher(directory: String = "artifacts") = T.command { nativeLauncher, directory, "scala-cli", - compress = true + compress = true, + wd = T.workspace ) } @@ -1346,7 +1347,7 @@ def copyJvmLauncher(directory: String = "artifacts") = T.command { val launcher = cli(Scala.defaultInternal).standaloneLauncher().path os.copy( launcher, - os.Path(directory, os.pwd) / s"scala-cli$platformExecutableJarExtension", + os.Path(directory, T.workspace) / s"scala-cli$platformExecutableJarExtension", createFolders = true, replaceExisting = true ) @@ -1355,7 +1356,7 @@ def copyJvmBootstrappedLauncher(directory: String = "artifacts") = T.command { val launcher = cliBootstrapped.jar().path os.copy( launcher, - os.Path(directory, os.pwd) / s"scala-cli.jar", + os.Path(directory, T.workspace) / s"scala-cli.jar", createFolders = true, replaceExisting = true ) @@ -1364,7 +1365,7 @@ def copyJvmBootstrappedLauncher(directory: String = "artifacts") = T.command { def uploadLaunchers(directory: String = "artifacts") = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val path = os.Path(directory, os.pwd) + val path = os.Path(directory, T.workspace) val launchers = os.list(path).filter(os.isFile(_)).map { path => path -> path.last } @@ -1415,7 +1416,8 @@ def copyMostlyStaticLauncher(directory: String = "artifacts") = T.command { directory, "scala-cli", compress = true, - suffix = "-mostly-static" + suffix = "-mostly-static", + wd = T.workspace ) } @@ -1426,7 +1428,8 @@ def copyStaticLauncher(directory: String = "artifacts") = T.command { directory, "scala-cli", compress = true, - suffix = "-static" + suffix = "-static", + wd = T.workspace ) } private def ghToken(): String = Option(System.getenv("UPLOAD_GH_TOKEN")).getOrElse { @@ -1468,7 +1471,7 @@ object ci extends Module { def updateScalaCliSetup() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target-scala-cli-setup" + val targetDir = T.workspace / "target-scala-cli-setup" val mainDir = targetDir / "scala-cli-setup" val setupScriptPath = mainDir / "src" / "main.ts" @@ -1497,7 +1500,7 @@ object ci extends Module { def updateStandaloneLauncher() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val scalaCliDir = targetDir / "scala-cli" val standaloneLauncherPath = scalaCliDir / "scala-cli.sh" val standaloneWindowsLauncherPath = scalaCliDir / "scala-cli.bat" @@ -1562,7 +1565,7 @@ object ci extends Module { def updateScalaCliBrewFormula() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val homebrewFormulaDir = targetDir / "homebrew-scala-cli" // clean target directory @@ -1582,11 +1585,11 @@ object ci extends Module { val arm64LauncherURL = s"https://github.com/Virtuslab/scala-cli/releases/download/v$version/scala-cli-aarch64-apple-darwin.gz" - val x86LauncherPath = os.Path("artifacts", os.pwd) / "scala-cli-x86_64-apple-darwin.gz" - val arm64LauncherPath = os.Path("artifacts", os.pwd) / "scala-cli-aarch64-apple-darwin.gz" + val x86LauncherPath = os.Path("artifacts", T.workspace) / "scala-cli-x86_64-apple-darwin.gz" + val arm64LauncherPath = os.Path("artifacts", T.workspace) / "scala-cli-aarch64-apple-darwin.gz" val (x86Sha256, arm64Sha256) = brewLaunchersSha(x86LauncherPath, arm64LauncherPath, targetDir) - val templateFormulaPath = os.pwd / ".github" / "scripts" / "scala-cli.rb.template" + val templateFormulaPath = T.workspace / ".github" / "scripts" / "scala-cli.rb.template" val template = os.read(templateFormulaPath) val updatedFormula = template @@ -1604,7 +1607,7 @@ object ci extends Module { def updateScalaExperimentalBrewFormula() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val homebrewFormulaDir = targetDir / "homebrew-scala-experimental" // clean homebrew-scala-experimental directory @@ -1624,11 +1627,11 @@ object ci extends Module { val arm64LauncherURL = s"https://github.com/Virtuslab/scala-cli/releases/download/v$version/scala-cli-aarch64-apple-darwin.gz" - val x86LauncherPath = os.Path("artifacts", os.pwd) / "scala-cli-x86_64-apple-darwin.gz" - val arm64LauncherPath = os.Path("artifacts", os.pwd) / "scala-cli-aarch64-apple-darwin.gz" + val x86LauncherPath = os.Path("artifacts", T.workspace) / "scala-cli-x86_64-apple-darwin.gz" + val arm64LauncherPath = os.Path("artifacts", T.workspace) / "scala-cli-aarch64-apple-darwin.gz" val (x86Sha256, arm64Sha256) = brewLaunchersSha(x86LauncherPath, arm64LauncherPath, targetDir) - val templateFormulaPath = os.pwd / ".github" / "scripts" / "scala.rb.template" + val templateFormulaPath = T.workspace / ".github" / "scripts" / "scala.rb.template" val template = os.read(templateFormulaPath) val updatedFormula = template @@ -1646,7 +1649,7 @@ object ci extends Module { def updateInstallationScript() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val packagesDir = targetDir / "scala-cli-packages" val installationScriptPath = packagesDir / "scala-setup.sh" @@ -1673,7 +1676,7 @@ object ci extends Module { def updateDebianPackages() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val packagesDir = targetDir / "scala-cli-packages" val debianDir = packagesDir / "debian" @@ -1691,7 +1694,7 @@ object ci extends Module { // copy deb package to repository os.copy( - os.Path("artifacts", os.pwd) / "scala-cli-x86_64-pc-linux.deb", + os.Path("artifacts", T.workspace) / "scala-cli-x86_64-pc-linux.deb", debianDir / s"scala-cli_$version.deb" ) @@ -1741,12 +1744,12 @@ object ci extends Module { def updateChocolateyPackage() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val packagesDir = os.pwd / "target" / "scala-cli-packages" - val chocoDir = os.pwd / ".github" / "scripts" / "choco" + val packagesDir = T.workspace / "target" / "scala-cli-packages" + val chocoDir = T.workspace / ".github" / "scripts" / "choco" val msiPackagePath = packagesDir / s"scala-cli_$version.msi" os.copy( - os.pwd / "artifacts" / "scala-cli-x86_64-pc-win32.msi", + T.workspace / "artifacts" / "scala-cli-x86_64-pc-win32.msi", msiPackagePath, createFolders = true ) @@ -1785,7 +1788,7 @@ object ci extends Module { def updateCentOsPackages() = T.command { val version = cli(Scala.defaultInternal).publishVersion() - val targetDir = os.pwd / "target" + val targetDir = T.workspace / "target" val packagesDir = targetDir / "scala-cli-packages" val centOsDir = packagesDir / "CentOS" @@ -1803,7 +1806,7 @@ object ci extends Module { // copy rpm package to repository os.copy( - os.Path("artifacts", os.pwd) / "scala-cli-x86_64-pc-linux.rpm", + os.Path("artifacts", T.workspace) / "scala-cli-x86_64-pc-linux.rpm", centOsDir / "Packages" / s"scala-cli_$version.rpm" ) @@ -1865,7 +1868,7 @@ object ci extends Module { .mkString(System.lineSeparator()) ) } - val destDir = os.Path(directory, os.pwd) + val destDir = os.Path(directory, T.workspace) os.copy(orig, destDir / distName, createFolders = true, replaceExisting = true) } def writeWixConfigExtra(dest: String = "wix-visual-cpp-redist.xml") = T.command { @@ -1908,7 +1911,7 @@ object ci extends Module { | | |""".stripMargin - val dest0 = os.Path(dest, os.pwd) + val dest0 = os.Path(dest, T.workspace) os.write.over(dest0, content.getBytes(Charset.defaultCharset()), createFolders = true) } def setShouldPublish() = T.command { @@ -1928,18 +1931,20 @@ object ci extends Module { "--ttl", "0" ) - val baseJavaHome = os.Path(command.!!.trim, os.pwd) + val baseJavaHome = os.Path(command.!!.trim, T.workspace) System.err.println(s"Initial Java home $baseJavaHome") - val destJavaHome = os.Path(dest, os.pwd) + val destJavaHome = os.Path(dest, T.workspace) os.copy(baseJavaHome, destJavaHome, createFolders = true) System.err.println(s"New Java home $destJavaHome") destJavaHome } def checkScalaVersions() = T.command { - website.checkMainScalaVersions(os.pwd / "website" / "docs" / "reference" / "scala-versions.md") + website.checkMainScalaVersions( + T.workspace / "website" / "docs" / "reference" / "scala-versions.md" + ) website.checkScalaJsVersions( - os.pwd / "website" / "docs" / "guides" / "advanced" / "scala-js.md" + T.workspace / "website" / "docs" / "guides" / "advanced" / "scala-js.md" ) } } diff --git a/modules/build/src/main/scala/scala/build/Bloop.scala b/modules/build/src/main/scala/scala/build/Bloop.scala index 50f109ebd5..8e7cf1def4 100644 --- a/modules/build/src/main/scala/scala/build/Bloop.scala +++ b/modules/build/src/main/scala/scala/build/Bloop.scala @@ -12,9 +12,9 @@ import java.io.{File, IOException} import scala.annotation.tailrec import scala.build.EitherCps.{either, value} import scala.build.errors.{BuildException, ModuleFormatError} -import scala.build.internal.CsLoggerUtil._ +import scala.build.internal.CsLoggerUtil.* import scala.concurrent.duration.FiniteDuration -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* object Bloop { diff --git a/modules/build/src/main/scala/scala/build/Build.scala b/modules/build/src/main/scala/scala/build/Build.scala index d22552c71c..c2bbcf8579 100644 --- a/modules/build/src/main/scala/scala/build/Build.scala +++ b/modules/build/src/main/scala/scala/build/Build.scala @@ -14,15 +14,15 @@ import scala.build.EitherCps.{either, value} import scala.build.Ops.* import scala.build.compiler.{ScalaCompiler, ScalaCompilerMaker} import scala.build.errors.* -import scala.build.input.VirtualScript.VirtualScriptNameRegex import scala.build.input.* +import scala.build.input.VirtualScript.VirtualScriptNameRegex import scala.build.internal.resource.ResourceMapper import scala.build.internal.{Constants, MainClass, Name, Util} -import scala.build.options.ScalaVersionUtil.asVersion import scala.build.options.* +import scala.build.options.ScalaVersionUtil.asVersion import scala.build.options.validation.ValidationException -import scala.build.postprocessing.LineConversion.scalaLineToScLineShift import scala.build.postprocessing.* +import scala.build.postprocessing.LineConversion.scalaLineToScLineShift import scala.collection.mutable.ListBuffer import scala.concurrent.duration.DurationInt import scala.util.control.NonFatal diff --git a/modules/build/src/main/scala/scala/build/CrossSources.scala b/modules/build/src/main/scala/scala/build/CrossSources.scala index c7e731752a..d41a239047 100644 --- a/modules/build/src/main/scala/scala/build/CrossSources.scala +++ b/modules/build/src/main/scala/scala/build/CrossSources.scala @@ -13,8 +13,8 @@ import scala.build.errors.{ MalformedDirectiveError, Severity } -import scala.build.input.ElementsUtils.* import scala.build.input.* +import scala.build.input.ElementsUtils.* import scala.build.internal.Constants import scala.build.internal.util.{RegexUtils, WarningMessages} import scala.build.options.{ diff --git a/modules/build/src/main/scala/scala/build/Project.scala b/modules/build/src/main/scala/scala/build/Project.scala index f6d793be82..c35a1e9cef 100644 --- a/modules/build/src/main/scala/scala/build/Project.scala +++ b/modules/build/src/main/scala/scala/build/Project.scala @@ -1,8 +1,8 @@ package scala.build -import _root_.bloop.config.{Config => BloopConfig, ConfigCodecs => BloopCodecs} -import _root_.coursier.{Dependency => CsDependency, core => csCore, util => csUtil} -import com.github.plokhotnyuk.jsoniter_scala.core.{writeToArray => writeAsJsonToArray} +import _root_.bloop.config.{Config as BloopConfig, ConfigCodecs as BloopCodecs} +import _root_.coursier.{Dependency as CsDependency, core as csCore, util as csUtil} +import com.github.plokhotnyuk.jsoniter_scala.core.writeToArray as writeAsJsonToArray import coursier.core.Classifier import java.io.ByteArrayOutputStream diff --git a/modules/build/src/main/scala/scala/build/ReplArtifacts.scala b/modules/build/src/main/scala/scala/build/ReplArtifacts.scala index 8077dab118..e89f69453d 100644 --- a/modules/build/src/main/scala/scala/build/ReplArtifacts.scala +++ b/modules/build/src/main/scala/scala/build/ReplArtifacts.scala @@ -3,11 +3,11 @@ package scala.build import coursier.cache.FileCache import coursier.core.{Repository, Version} import coursier.util.Task -import dependency._ +import dependency.* import scala.build.EitherCps.{either, value} import scala.build.errors.BuildException -import scala.build.internal.CsLoggerUtil._ +import scala.build.internal.CsLoggerUtil.* final case class ReplArtifacts( replArtifacts: Seq[(String, os.Path)], diff --git a/modules/build/src/main/scala/scala/build/bsp/BspClient.scala b/modules/build/src/main/scala/scala/build/bsp/BspClient.scala index fa6499053f..2b80ba79e9 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BspClient.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BspClient.scala @@ -1,7 +1,7 @@ package scala.build.bsp -import ch.epfl.scala.bsp4j.{ScalaAction, ScalaDiagnostic, ScalaTextEdit, ScalaWorkspaceEdit} import ch.epfl.scala.bsp4j as b +import ch.epfl.scala.bsp4j.{ScalaAction, ScalaDiagnostic, ScalaTextEdit, ScalaWorkspaceEdit} import com.google.gson.{Gson, JsonElement} import java.lang.Boolean as JBoolean diff --git a/modules/build/src/main/scala/scala/build/bsp/BspImpl.scala b/modules/build/src/main/scala/scala/build/bsp/BspImpl.scala index 9313ea8990..20399a33d1 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BspImpl.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BspImpl.scala @@ -11,8 +11,8 @@ import java.io.{InputStream, OutputStream} import java.util.UUID import java.util.concurrent.{CompletableFuture, Executor} -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.compiler.BloopCompiler import scala.build.errors.{ BuildException, diff --git a/modules/build/src/main/scala/scala/build/bsp/BspServer.scala b/modules/build/src/main/scala/scala/build/bsp/BspServer.scala index 95c85c0d11..a5c6c797f4 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BspServer.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BspServer.scala @@ -1,12 +1,12 @@ package scala.build.bsp -import ch.epfl.scala.bsp4j.{BuildClient, LogMessageParams, MessageType} import ch.epfl.scala.bsp4j as b +import ch.epfl.scala.bsp4j.{BuildClient, LogMessageParams, MessageType} import java.io.{File, PrintWriter, StringWriter} import java.net.URI -import java.util.concurrent.{CompletableFuture, TimeUnit} import java.util as ju +import java.util.concurrent.{CompletableFuture, TimeUnit} import scala.build.Logger import scala.build.internal.Constants diff --git a/modules/build/src/main/scala/scala/build/bsp/BuildClientForwardStubs.scala b/modules/build/src/main/scala/scala/build/bsp/BuildClientForwardStubs.scala index 3c586f717a..6ab18b56a0 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BuildClientForwardStubs.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BuildClientForwardStubs.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b trait BuildClientForwardStubs extends b.BuildClient { protected def forwardToOpt: Option[b.BuildClient] diff --git a/modules/build/src/main/scala/scala/build/bsp/BuildServerForwardStubs.scala b/modules/build/src/main/scala/scala/build/bsp/BuildServerForwardStubs.scala index 97c170f4d1..2a01bdc0e1 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BuildServerForwardStubs.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BuildServerForwardStubs.scala @@ -1,7 +1,7 @@ package scala.build.bsp +import ch.epfl.scala.bsp4j as b import ch.epfl.scala.bsp4j.{DependencyModulesParams, DependencyModulesResult} -import ch.epfl.scala.{bsp4j => b} import java.util.concurrent.CompletableFuture import java.util.function.BiFunction diff --git a/modules/build/src/main/scala/scala/build/bsp/BuildServerProxy.scala b/modules/build/src/main/scala/scala/build/bsp/BuildServerProxy.scala index 2cd444aec2..0ecfca3456 100644 --- a/modules/build/src/main/scala/scala/build/bsp/BuildServerProxy.scala +++ b/modules/build/src/main/scala/scala/build/bsp/BuildServerProxy.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSources.scala b/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSources.scala index 74cf3ce0f3..680ea12efb 100644 --- a/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSources.scala +++ b/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSources.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import scala.build.GeneratedSource import scala.build.input.Inputs diff --git a/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSourcesImpl.scala b/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSourcesImpl.scala index 4855cbf824..b5c511902f 100644 --- a/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSourcesImpl.scala +++ b/modules/build/src/main/scala/scala/build/bsp/HasGeneratedSourcesImpl.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import scala.build.GeneratedSource import scala.build.input.Inputs diff --git a/modules/build/src/main/scala/scala/build/bsp/JavaBuildServerForwardStubs.scala b/modules/build/src/main/scala/scala/build/bsp/JavaBuildServerForwardStubs.scala index e25bbd9d1d..b99e9c94c8 100644 --- a/modules/build/src/main/scala/scala/build/bsp/JavaBuildServerForwardStubs.scala +++ b/modules/build/src/main/scala/scala/build/bsp/JavaBuildServerForwardStubs.scala @@ -1,7 +1,7 @@ package scala.build.bsp +import ch.epfl.scala.bsp4j as b import ch.epfl.scala.bsp4j.{JavacOptionsParams, JavacOptionsResult} -import ch.epfl.scala.{bsp4j => b} import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildClient.scala b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildClient.scala index 1fa1d9fd8d..e6f33fab89 100644 --- a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildClient.scala +++ b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildClient.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b trait LoggingBuildClient extends b.BuildClient { protected def underlying: b.BuildClient diff --git a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServer.scala b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServer.scala index f05968fc51..ba6103baf0 100644 --- a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServer.scala +++ b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServer.scala @@ -1,7 +1,7 @@ package scala.build.bsp +import ch.epfl.scala.bsp4j as b import ch.epfl.scala.bsp4j.{DependencyModulesParams, DependencyModulesResult} -import ch.epfl.scala.{bsp4j => b} import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServerAll.scala b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServerAll.scala index f0d5985f33..b21a2b5248 100644 --- a/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServerAll.scala +++ b/modules/build/src/main/scala/scala/build/bsp/LoggingBuildServerAll.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/LoggingJavaBuildServer.scala b/modules/build/src/main/scala/scala/build/bsp/LoggingJavaBuildServer.scala index 658818cc3a..0fcd6e4254 100644 --- a/modules/build/src/main/scala/scala/build/bsp/LoggingJavaBuildServer.scala +++ b/modules/build/src/main/scala/scala/build/bsp/LoggingJavaBuildServer.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/LoggingScalaBuildServer.scala b/modules/build/src/main/scala/scala/build/bsp/LoggingScalaBuildServer.scala index d118f08984..52dc6898df 100644 --- a/modules/build/src/main/scala/scala/build/bsp/LoggingScalaBuildServer.scala +++ b/modules/build/src/main/scala/scala/build/bsp/LoggingScalaBuildServer.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/ScalaBuildServerForwardStubs.scala b/modules/build/src/main/scala/scala/build/bsp/ScalaBuildServerForwardStubs.scala index 12cb1c3265..219483fb9e 100644 --- a/modules/build/src/main/scala/scala/build/bsp/ScalaBuildServerForwardStubs.scala +++ b/modules/build/src/main/scala/scala/build/bsp/ScalaBuildServerForwardStubs.scala @@ -1,6 +1,6 @@ package scala.build.bsp -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/bsp/package.scala b/modules/build/src/main/scala/scala/build/bsp/package.scala index 5f3fe3e632..ac7f8139aa 100644 --- a/modules/build/src/main/scala/scala/build/bsp/package.scala +++ b/modules/build/src/main/scala/scala/build/bsp/package.scala @@ -1,7 +1,7 @@ package scala.build -import ch.epfl.scala.bsp4j.SourcesItem import ch.epfl.scala.bsp4j as b +import ch.epfl.scala.bsp4j.SourcesItem import java.util.concurrent.CompletableFuture diff --git a/modules/build/src/main/scala/scala/build/internal/JavaParserProxyBinary.scala b/modules/build/src/main/scala/scala/build/internal/JavaParserProxyBinary.scala index 1e196a61bc..908ce5be43 100644 --- a/modules/build/src/main/scala/scala/build/internal/JavaParserProxyBinary.scala +++ b/modules/build/src/main/scala/scala/build/internal/JavaParserProxyBinary.scala @@ -2,7 +2,7 @@ package scala.build.internal import coursier.cache.ArchiveCache import coursier.util.Task -import dependency._ +import dependency.* import java.util.function.Supplier diff --git a/modules/build/src/main/scala/scala/build/internal/Runner.scala b/modules/build/src/main/scala/scala/build/internal/Runner.scala index f1a6f7a780..2916f7b5c1 100644 --- a/modules/build/src/main/scala/scala/build/internal/Runner.scala +++ b/modules/build/src/main/scala/scala/build/internal/Runner.scala @@ -11,7 +11,7 @@ import java.nio.file.{Files, Path, Paths} import scala.build.EitherCps.{either, value} import scala.build.Logger -import scala.build.errors._ +import scala.build.errors.* import scala.build.internals.EnvVar import scala.build.testrunner.{AsmTestRunner, TestRunner} import scala.util.{Failure, Properties, Success} diff --git a/modules/build/src/main/scala/scala/build/postprocessing/SemanticdbProcessor.scala b/modules/build/src/main/scala/scala/build/postprocessing/SemanticdbProcessor.scala index 6830675681..b6814b47f6 100644 --- a/modules/build/src/main/scala/scala/build/postprocessing/SemanticdbProcessor.scala +++ b/modules/build/src/main/scala/scala/build/postprocessing/SemanticdbProcessor.scala @@ -7,7 +7,7 @@ import java.nio.charset.StandardCharsets import java.security.MessageDigest import scala.collection.mutable -import scala.meta.internal.semanticdb._ +import scala.meta.internal.semanticdb.* object SemanticdbProcessor { diff --git a/modules/build/src/main/scala/scala/build/preprocessing/CustomDirectivesReporter.scala b/modules/build/src/main/scala/scala/build/preprocessing/CustomDirectivesReporter.scala index 2381c160dc..79c012cfcd 100644 --- a/modules/build/src/main/scala/scala/build/preprocessing/CustomDirectivesReporter.scala +++ b/modules/build/src/main/scala/scala/build/preprocessing/CustomDirectivesReporter.scala @@ -1,6 +1,6 @@ package scala.build.preprocessing -import com.virtuslab.using_directives.custom.utils.{Position => DirectivePosition} +import com.virtuslab.using_directives.custom.utils.Position as DirectivePosition import com.virtuslab.using_directives.reporter.Reporter import scala.build.Position diff --git a/modules/build/src/main/scala/scala/build/preprocessing/DirectivesPreprocessor.scala b/modules/build/src/main/scala/scala/build/preprocessing/DirectivesPreprocessor.scala index 3006196cf4..f6dda8ebad 100644 --- a/modules/build/src/main/scala/scala/build/preprocessing/DirectivesPreprocessor.scala +++ b/modules/build/src/main/scala/scala/build/preprocessing/DirectivesPreprocessor.scala @@ -23,9 +23,9 @@ import scala.build.options.{ SuppressWarningOptions, WithBuildRequirements } +import scala.build.preprocessing.directives.* import scala.build.preprocessing.directives.DirectivesPreprocessingUtils.* import scala.build.preprocessing.directives.PartiallyProcessedDirectives.* -import scala.build.preprocessing.directives.* case class DirectivesPreprocessor( path: Either[String, os.Path], diff --git a/modules/build/src/main/scala/scala/build/preprocessing/ExtractedDirectives.scala b/modules/build/src/main/scala/scala/build/preprocessing/ExtractedDirectives.scala index 495933028b..9aa5789bd0 100644 --- a/modules/build/src/main/scala/scala/build/preprocessing/ExtractedDirectives.scala +++ b/modules/build/src/main/scala/scala/build/preprocessing/ExtractedDirectives.scala @@ -8,7 +8,7 @@ import com.virtuslab.using_directives.custom.model.{ UsingDirectives, Value } -import com.virtuslab.using_directives.custom.utils.ast._ +import com.virtuslab.using_directives.custom.utils.ast.* import scala.annotation.targetName import scala.build.errors.* diff --git a/modules/build/src/test/scala/scala/build/tests/TestUtil.scala b/modules/build/src/test/scala/scala/build/tests/TestUtil.scala index 9b583f2f73..05323ac8a9 100644 --- a/modules/build/src/test/scala/scala/build/tests/TestUtil.scala +++ b/modules/build/src/test/scala/scala/build/tests/TestUtil.scala @@ -12,7 +12,7 @@ object TestUtil { abstract class ScalaCliBuildSuite extends munit.FunSuite { extension (munitContext: BeforeEach | AfterEach) { def locationAbsolutePath: os.Path = - os.pwd / os.RelPath { + os.Path { (munitContext match { case beforeEach: BeforeEach => beforeEach.test case afterEach: AfterEach => afterEach.test diff --git a/modules/cli/src/main/scala/scala/cli/commands/CustomWindowsEnvVarUpdater.scala b/modules/cli/src/main/scala/scala/cli/commands/CustomWindowsEnvVarUpdater.scala index 2bb29ef292..9a11f3e844 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/CustomWindowsEnvVarUpdater.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/CustomWindowsEnvVarUpdater.scala @@ -1,6 +1,6 @@ package scala.cli.commands -import coursier.env._ +import coursier.env.* // Only using this instead of coursier.env.WindowsEnvVarUpdater for the "\u0000" striping thing, // that earlier version of the Scala CLI may have left behind. diff --git a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopJson.scala b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopJson.scala index 6b5c3d2f1d..41b340c693 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopJson.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopJson.scala @@ -1,7 +1,7 @@ package scala.cli.commands.bloop -import com.github.plokhotnyuk.jsoniter_scala.core._ -import com.github.plokhotnyuk.jsoniter_scala.macros._ +import com.github.plokhotnyuk.jsoniter_scala.core.* +import com.github.plokhotnyuk.jsoniter_scala.macros.* final case class BloopJson(javaOptions: List[String] = Nil) diff --git a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopOptions.scala index 376b8e9346..96d22a6696 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopOptions.scala @@ -2,7 +2,7 @@ package scala.cli.commands.bloop import caseapp.* -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* import scala.cli.commands.tags // format: off diff --git a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopStartOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopStartOptions.scala index 1bdb421c93..2578ca538b 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopStartOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/bloop/BloopStartOptions.scala @@ -2,7 +2,7 @@ package scala.cli.commands.bloop import caseapp.* -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* import scala.cli.commands.tags // format: off diff --git a/modules/cli/src/main/scala/scala/cli/commands/bsp/Bsp.scala b/modules/cli/src/main/scala/scala/cli/commands/bsp/Bsp.scala index 7c2595ac94..d28e46e90f 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/bsp/Bsp.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/bsp/Bsp.scala @@ -4,8 +4,8 @@ import caseapp.* import com.github.plokhotnyuk.jsoniter_scala.core.* import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.bsp.{BspReloadableOptions, BspThreads} import scala.build.errors.BuildException import scala.build.input.Inputs diff --git a/modules/cli/src/main/scala/scala/cli/commands/clean/CleanOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/clean/CleanOptions.scala index 36bbafc03e..47a57fc972 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/clean/CleanOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/clean/CleanOptions.scala @@ -3,7 +3,7 @@ package scala.cli.commands.clean import caseapp.* import scala.cli.ScalaCli.fullRunnerName -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* // format: off @HelpMessage(CleanOptions.helpMessage, "", CleanOptions.detailedHelpMessage) diff --git a/modules/cli/src/main/scala/scala/cli/commands/compile/CompileOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/compile/CompileOptions.scala index eaec64b49c..7962ef4906 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/compile/CompileOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/compile/CompileOptions.scala @@ -3,7 +3,7 @@ package scala.cli.commands.compile import caseapp.* import caseapp.core.help.Help -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* import scala.cli.commands.tags @HelpMessage(CompileOptions.helpMessage, "", CompileOptions.detailedHelpMessage) diff --git a/modules/cli/src/main/scala/scala/cli/commands/config/Config.scala b/modules/cli/src/main/scala/scala/cli/commands/config/Config.scala index f6b3f0dad2..d2c7ad3ed3 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/config/Config.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/config/Config.scala @@ -12,7 +12,7 @@ import scala.build.{Directories, Logger} import scala.cli.commands.publish.ConfigUtil.* import scala.cli.commands.shared.HelpGroup import scala.cli.commands.{ScalaCommand, SpecificationLevel} -import scala.cli.config._ +import scala.cli.config.* import scala.cli.util.ArgHelpers.* import scala.cli.util.ConfigDbUtils object Config extends ScalaCommand[ConfigOptions] { diff --git a/modules/cli/src/main/scala/scala/cli/commands/doc/Doc.scala b/modules/cli/src/main/scala/scala/cli/commands/doc/Doc.scala index abb5f5834e..68a647f99d 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/doc/Doc.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/doc/Doc.scala @@ -6,8 +6,8 @@ import dependency.* import java.io.File -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.compiler.{ScalaCompilerMaker, SimpleScalaCompilerMaker} import scala.build.errors.BuildException import scala.build.interactive.InteractiveFileOps diff --git a/modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala b/modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala index 02d1964c3b..a28524ec89 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala @@ -11,8 +11,8 @@ import coursier.util.{Artifact, Task} import java.io.{OutputStreamWriter, PrintStream} import java.nio.charset.{Charset, StandardCharsets} -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.errors.BuildException import scala.build.input.Inputs import scala.build.internal.Constants diff --git a/modules/cli/src/main/scala/scala/cli/commands/github/GitHubApi.scala b/modules/cli/src/main/scala/scala/cli/commands/github/GitHubApi.scala index 3e4cc0ac11..50958e338e 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/github/GitHubApi.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/github/GitHubApi.scala @@ -1,7 +1,7 @@ package scala.cli.commands.github -import com.github.plokhotnyuk.jsoniter_scala.core._ -import com.github.plokhotnyuk.jsoniter_scala.macros._ +import com.github.plokhotnyuk.jsoniter_scala.core.* +import com.github.plokhotnyuk.jsoniter_scala.macros.* import java.util.Base64 diff --git a/modules/cli/src/main/scala/scala/cli/commands/package0/Package.scala b/modules/cli/src/main/scala/scala/cli/commands/package0/Package.scala index cd2fe6cb74..6c3d84d32d 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/package0/Package.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/package0/Package.scala @@ -18,9 +18,9 @@ import java.nio.charset.StandardCharsets import java.nio.file.attribute.FileTime import java.util.zip.{ZipEntry, ZipOutputStream} +import scala.build.* import scala.build.EitherCps.{either, value} import scala.build.Ops.* -import scala.build.* import scala.build.errors.* import scala.build.interactive.InteractiveFileOps import scala.build.internal.Util.* diff --git a/modules/cli/src/main/scala/scala/cli/commands/packaging/Spark.scala b/modules/cli/src/main/scala/scala/cli/commands/packaging/Spark.scala index 3cd9f7165e..712a421a19 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/packaging/Spark.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/packaging/Spark.scala @@ -1,6 +1,6 @@ package scala.cli.commands.packaging -import dependency._ +import dependency.* object Spark { diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/KeyServer.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/KeyServer.scala index 0d84871860..b8f7701b7c 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/KeyServer.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/KeyServer.scala @@ -1,6 +1,6 @@ package scala.cli.commands.pgp -import sttp.client3._ +import sttp.client3.* import sttp.model.Uri object KeyServer { diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpCreate.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpCreate.scala index 3668b4c2fd..069a60f588 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpCreate.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpCreate.scala @@ -3,7 +3,7 @@ package scala.cli.commands.pgp import caseapp.core.RemainingArgs import caseapp.core.app.Command -import scala.cli.signing.commands.{PgpCreate => OriginalPgpCreate, PgpCreateOptions} +import scala.cli.signing.commands.{PgpCreate as OriginalPgpCreate, PgpCreateOptions} object PgpCreate extends PgpCommand[PgpCreateOptions] { override def names = PgpCommandNames.pgpCreate diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpKeyId.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpKeyId.scala index 8fdedefbeb..0307e0c882 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpKeyId.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpKeyId.scala @@ -3,7 +3,7 @@ package scala.cli.commands.pgp import caseapp.core.RemainingArgs import caseapp.core.app.Command -import scala.cli.signing.commands.{PgpKeyId => OriginalPgpKeyId, PgpKeyIdOptions} +import scala.cli.signing.commands.{PgpKeyId as OriginalPgpKeyId, PgpKeyIdOptions} object PgpKeyId extends PgpCommand[PgpKeyIdOptions] { override def names: List[List[String]] = PgpCommandNames.pgpKeyId diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPushOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPushOptions.scala index dd98b263f3..ba982583e2 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPushOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPushOptions.scala @@ -2,7 +2,7 @@ package scala.cli.commands.pgp import caseapp.* -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* // format: off final case class PgpPushOptions( diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpSign.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpSign.scala index 9a1ee6c19e..5d7e1fdf0c 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpSign.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpSign.scala @@ -3,7 +3,7 @@ package scala.cli.commands.pgp import caseapp.core.RemainingArgs import caseapp.core.app.Command -import scala.cli.signing.commands.{PgpSign => OriginalPgpSign, PgpSignOptions} +import scala.cli.signing.commands.{PgpSign as OriginalPgpSign, PgpSignOptions} object PgpSign extends PgpCommand[PgpSignOptions] { override def names = PgpCommandNames.pgpSign diff --git a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpVerify.scala b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpVerify.scala index 0838c60ff1..0abb53adea 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpVerify.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/pgp/PgpVerify.scala @@ -3,7 +3,7 @@ package scala.cli.commands.pgp import caseapp.core.RemainingArgs import caseapp.core.app.Command -import scala.cli.signing.commands.{PgpVerify => OriginalPgpVerify, PgpVerifyOptions} +import scala.cli.signing.commands.{PgpVerify as OriginalPgpVerify, PgpVerifyOptions} object PgpVerify extends PgpCommand[PgpVerifyOptions] { override def names = PgpCommandNames.pgpVerify diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/GitRepo.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/GitRepo.scala index 9486c21be1..e591a2fddf 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/GitRepo.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/GitRepo.scala @@ -3,7 +3,7 @@ package scala.cli.commands.publish import org.eclipse.jgit.api.Git import scala.build.Logger -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* import scala.util.{Properties, Using} object GitRepo { diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/OptionCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/OptionCheck.scala index 4091a4ed9f..bc64b35c0f 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/OptionCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/OptionCheck.scala @@ -1,7 +1,7 @@ package scala.cli.commands.publish import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions /** A check for missing options in [[PublishOptions]] */ diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/OptionChecks.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/OptionChecks.scala index 135def5a08..84ee411138 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/OptionChecks.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/OptionChecks.scala @@ -2,10 +2,10 @@ package scala.cli.commands.publish import coursier.cache.FileCache import coursier.util.Task -import sttp.client3._ +import sttp.client3.* import scala.build.Logger -import scala.cli.commands.publish.checks._ +import scala.cli.commands.publish.checks.* import scala.cli.config.ConfigDb object OptionChecks { diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/Publish.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/Publish.scala index c5f38e7385..3d4d636daa 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/Publish.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/Publish.scala @@ -23,15 +23,15 @@ import java.time.{Instant, LocalDateTime, ZoneOffset} import java.util.concurrent.Executors import java.util.function.Supplier +import scala.build.* import scala.build.EitherCps.{either, value} import scala.build.Ops.* -import scala.build.* import scala.build.compiler.ScalaCompilerMaker import scala.build.errors.{BuildException, CompositeBuildException, NoMainClassFoundError, Severity} import scala.build.input.Inputs import scala.build.internal.Util import scala.build.internal.Util.ScalaDependencyOps -import scala.build.options.publish.{Developer, License, Signer => PSigner, Vcs} +import scala.build.options.publish.{Developer, License, Signer as PSigner, Vcs} import scala.build.options.{ BuildOptions, ComputeVersion, diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ComputeVersionCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ComputeVersionCheck.scala index d8584fbfdb..b0cc76c2ac 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ComputeVersionCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ComputeVersionCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{GitRepo, OptionCheck, PublishSetupOptions} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/DeveloperCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/DeveloperCheck.scala index 1f2b9d58b9..cacde7f002 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/DeveloperCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/DeveloperCheck.scala @@ -3,8 +3,8 @@ package scala.cli.commands.publish.checks import scala.build.EitherCps.{either, value} import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} -import scala.cli.commands.publish.ConfigUtil._ +import scala.build.options.PublishOptions as BPublishOptions +import scala.cli.commands.publish.ConfigUtil.* import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions} import scala.cli.config.{ConfigDb, Keys} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/LicenseCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/LicenseCheck.scala index a8cac7069d..895a838831 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/LicenseCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/LicenseCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions} final case class LicenseCheck( diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/NameCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/NameCheck.scala index 7e7755097c..0fb31e6c35 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/NameCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/NameCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions} final case class NameCheck( diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/OrganizationCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/OrganizationCheck.scala index 93774f14be..c295f8e52e 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/OrganizationCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/OrganizationCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{GitRepo, OptionCheck, PublishSetupOptions} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PasswordCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PasswordCheck.scala index 11124682a0..73e418d0f1 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PasswordCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PasswordCheck.scala @@ -5,8 +5,8 @@ import java.net.URI import scala.build.EitherCps.{either, value} import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} -import scala.cli.commands.publish.ConfigUtil._ +import scala.build.options.PublishOptions as BPublishOptions +import scala.cli.commands.publish.ConfigUtil.* import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions, RepoParams, SetSecret} import scala.cli.config.{ConfigDb, Keys} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PgpSecretKeyCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PgpSecretKeyCheck.scala index 5b12ee4e56..25f4963b2b 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PgpSecretKeyCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/PgpSecretKeyCheck.scala @@ -10,9 +10,9 @@ import scala.build.Logger import scala.build.Ops.* import scala.build.errors.{BuildException, CompositeBuildException, MalformedCliInputError} import scala.build.internal.util.WarningMessages +import scala.build.options.PublishOptions as BPublishOptions import scala.build.options.publish.ConfigPasswordOption import scala.build.options.publish.ConfigPasswordOption.* -import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.config.ThrowawayPgpSecret import scala.cli.commands.pgp.{KeyServer, PgpProxyMaker} import scala.cli.commands.publish.ConfigUtil.* diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ScmCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ScmCheck.scala index 5e2f820768..82053da328 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ScmCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/ScmCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{GitRepo, OptionCheck, PublishSetupOptions} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UrlCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UrlCheck.scala index 7c0b5b5486..1e1a627b47 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UrlCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UrlCheck.scala @@ -2,7 +2,7 @@ package scala.cli.commands.publish.checks import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} +import scala.build.options.PublishOptions as BPublishOptions import scala.cli.commands.publish.{GitRepo, OptionCheck, PublishSetupOptions} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UserCheck.scala b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UserCheck.scala index 86e03195c2..207b81f8e3 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UserCheck.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/publish/checks/UserCheck.scala @@ -5,8 +5,8 @@ import java.net.URI import scala.build.EitherCps.{either, value} import scala.build.Logger import scala.build.errors.BuildException -import scala.build.options.{PublishOptions => BPublishOptions} -import scala.cli.commands.publish.ConfigUtil._ +import scala.build.options.PublishOptions as BPublishOptions +import scala.cli.commands.publish.ConfigUtil.* import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions, RepoParams, SetSecret} import scala.cli.config.{ConfigDb, Keys} import scala.cli.errors.MissingPublishOptionError diff --git a/modules/cli/src/main/scala/scala/cli/commands/repl/Repl.scala b/modules/cli/src/main/scala/scala/cli/commands/repl/Repl.scala index ea0dc10186..3b20599aea 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/repl/Repl.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/repl/Repl.scala @@ -10,8 +10,8 @@ import dependency.* import java.io.File import java.util.zip.ZipFile -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.errors.{ BuildException, CantDownloadAmmoniteError, diff --git a/modules/cli/src/main/scala/scala/cli/commands/run/Run.scala b/modules/cli/src/main/scala/scala/cli/commands/run/Run.scala index 68c2b2a86a..c2ab3b87b9 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/run/Run.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/run/Run.scala @@ -9,8 +9,8 @@ import java.util.Locale import java.util.concurrent.CompletableFuture import java.util.concurrent.atomic.AtomicReference -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.errors.BuildException import scala.build.input.{Inputs, ScalaCliInvokeData, SubCommand} import scala.build.internal.{Constants, Runner, ScalaJsLinkerConfig} diff --git a/modules/cli/src/main/scala/scala/cli/commands/run/SharedRunOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/run/SharedRunOptions.scala index 832207f2c3..19e1f3f7bf 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/run/SharedRunOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/run/SharedRunOptions.scala @@ -3,7 +3,7 @@ package scala.cli.commands.run import caseapp.* import caseapp.core.help.Help -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* import scala.cli.commands.tags // format: off diff --git a/modules/cli/src/main/scala/scala/cli/commands/setupide/SetupIde.scala b/modules/cli/src/main/scala/scala/cli/commands/setupide/SetupIde.scala index 1b3aa42ce3..c896d0017f 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/setupide/SetupIde.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/setupide/SetupIde.scala @@ -8,8 +8,8 @@ import com.google.gson.GsonBuilder import java.nio.charset.{Charset, StandardCharsets} -import scala.build.EitherCps.{either, value} import scala.build.* +import scala.build.EitherCps.{either, value} import scala.build.bsp.IdeInputs import scala.build.errors.{BuildException, WorkspaceError} import scala.build.input.{Inputs, OnDisk, Virtual, WorkspaceOrigin} diff --git a/modules/cli/src/main/scala/scala/cli/commands/shared/SharedOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/shared/SharedOptions.scala index 4d1d039099..0d103bb0bd 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/shared/SharedOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/shared/SharedOptions.scala @@ -17,9 +17,9 @@ import java.io.{File, InputStream} import java.nio.file.Paths import java.util.concurrent.atomic.AtomicBoolean +import scala.build.* import scala.build.EitherCps.{either, value} import scala.build.Ops.EitherOptOps -import scala.build.* import scala.build.compiler.{BloopCompilerMaker, ScalaCompilerMaker, SimpleScalaCompilerMaker} import scala.build.directives.DirectiveDescription import scala.build.errors.{AmbiguousPlatformError, BuildException, ConfigDbException, Severity} @@ -29,12 +29,12 @@ import scala.build.interactive.Interactive.{InteractiveAsk, InteractiveNop} import scala.build.internal.util.WarningMessages import scala.build.internal.{Constants, FetchExternalBinary, OsLibc, Util} import scala.build.internals.ConsoleUtils.ScalaCliConsole +import scala.build.options as bo import scala.build.options.ScalaVersionUtil.fileWithTtl0 import scala.build.options.{BuildOptions, ComputeVersion, Platform, ScalacOpt, ShadowingSeq} import scala.build.preprocessing.directives.ClasspathUtils.* import scala.build.preprocessing.directives.Toolkit.maxScalaNativeWarningMsg import scala.build.preprocessing.directives.{Python, Toolkit} -import scala.build.options as bo import scala.cli.ScalaCli import scala.cli.commands.publish.ConfigUtil.* import scala.cli.commands.shared.{ diff --git a/modules/cli/src/main/scala/scala/cli/commands/test/Test.scala b/modules/cli/src/main/scala/scala/cli/commands/test/Test.scala index 5592698087..b61b67ebe0 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/test/Test.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/test/Test.scala @@ -5,9 +5,9 @@ import caseapp.core.help.HelpFormat import java.nio.file.Path +import scala.build.* import scala.build.EitherCps.{either, value} import scala.build.Ops.* -import scala.build.* import scala.build.errors.{BuildException, CompositeBuildException} import scala.build.internal.{Constants, Runner} import scala.build.internals.ConsoleUtils.ScalaCliConsole diff --git a/modules/cli/src/main/scala/scala/cli/commands/test/TestOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/test/TestOptions.scala index 131ece4169..7307037965 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/test/TestOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/test/TestOptions.scala @@ -3,7 +3,7 @@ package scala.cli.commands.test import caseapp.* import caseapp.core.help.Help -import scala.cli.commands.shared._ +import scala.cli.commands.shared.* import scala.cli.commands.tags @HelpMessage(TestOptions.helpMessage, "", TestOptions.detailedHelpMessage) diff --git a/modules/cli/src/main/scala/scala/cli/commands/util/RunHadoop.scala b/modules/cli/src/main/scala/scala/cli/commands/util/RunHadoop.scala index 9ab521da57..5be02bc881 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/util/RunHadoop.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/util/RunHadoop.scala @@ -4,7 +4,7 @@ import scala.build.EitherCps.{either, value} import scala.build.errors.BuildException import scala.build.internal.Runner import scala.build.{Build, Logger} -import scala.cli.commands.package0.{Package => PackageCmd} +import scala.cli.commands.package0.Package as PackageCmd import scala.cli.commands.packaging.Spark object RunHadoop { diff --git a/modules/cli/src/main/scala/scala/cli/exportCmd/MillProject.scala b/modules/cli/src/main/scala/scala/cli/exportCmd/MillProject.scala index 7b31b08c01..6703cc1e94 100644 --- a/modules/cli/src/main/scala/scala/cli/exportCmd/MillProject.scala +++ b/modules/cli/src/main/scala/scala/cli/exportCmd/MillProject.scala @@ -3,7 +3,7 @@ package scala.cli.exportCmd import java.nio.charset.StandardCharsets import scala.build.options.ConfigMonoid -import scala.cli.util.SeqHelpers._ +import scala.cli.util.SeqHelpers.* import scala.reflect.NameTransformer import scala.util.Properties diff --git a/modules/cli/src/main/scala/scala/cli/internal/CliLogger.scala b/modules/cli/src/main/scala/scala/cli/internal/CliLogger.scala index fe91c52944..59fccb3796 100644 --- a/modules/cli/src/main/scala/scala/cli/internal/CliLogger.scala +++ b/modules/cli/src/main/scala/scala/cli/internal/CliLogger.scala @@ -1,11 +1,11 @@ package scala.cli.internal import bloop.rifle.BloopRifleLogger -import ch.epfl.scala.bsp4j.Location import ch.epfl.scala.bsp4j as b +import ch.epfl.scala.bsp4j.Location import coursier.cache.CacheLogger import coursier.cache.loggers.{FallbackRefreshDisplay, RefreshLogger} -import org.scalajs.logging.{Level => ScalaJsLevel, Logger => ScalaJsLogger, ScalaConsoleLogger} +import org.scalajs.logging.{Level as ScalaJsLevel, Logger as ScalaJsLogger, ScalaConsoleLogger} import java.io.PrintStream diff --git a/modules/cli/src/main/scala/scala/cli/internal/ScalaJsLinker.scala b/modules/cli/src/main/scala/scala/cli/internal/ScalaJsLinker.scala index b05183e67e..2a8f6bad31 100644 --- a/modules/cli/src/main/scala/scala/cli/internal/ScalaJsLinker.scala +++ b/modules/cli/src/main/scala/scala/cli/internal/ScalaJsLinker.scala @@ -4,8 +4,8 @@ import coursier.Repositories import coursier.cache.{ArchiveCache, FileCache} import coursier.core.Version import coursier.util.Task -import dependency._ -import org.scalajs.testing.adapter.{TestAdapterInitializer => TAI} +import dependency.* +import org.scalajs.testing.adapter.TestAdapterInitializer as TAI import java.io.{File, InputStream, OutputStream} diff --git a/modules/cli/src/main/scala/scala/cli/javaLauncher/JavaLauncherCli.scala b/modules/cli/src/main/scala/scala/cli/javaLauncher/JavaLauncherCli.scala index 375567a985..4f596a676a 100644 --- a/modules/cli/src/main/scala/scala/cli/javaLauncher/JavaLauncherCli.scala +++ b/modules/cli/src/main/scala/scala/cli/javaLauncher/JavaLauncherCli.scala @@ -7,7 +7,7 @@ import scala.build.errors.BuildException import scala.build.internal.{OsLibc, Runner} import scala.build.options.{BuildOptions, JavaOptions} import scala.cli.commands.shared.LoggingOptions -import scala.cli.javaLauncher.JavaLauncherCli.LauncherKind._ +import scala.cli.javaLauncher.JavaLauncherCli.LauncherKind.* object JavaLauncherCli { def runAndExit(remainingArgs: Seq[String]): Nothing = { diff --git a/modules/cli/src/main/scala/scala/cli/packaging/Library.scala b/modules/cli/src/main/scala/scala/cli/packaging/Library.scala index 9ba415b6b0..361b1cffa3 100644 --- a/modules/cli/src/main/scala/scala/cli/packaging/Library.scala +++ b/modules/cli/src/main/scala/scala/cli/packaging/Library.scala @@ -3,7 +3,7 @@ package scala.cli.packaging import java.io.OutputStream import java.nio.file.StandardOpenOption.{CREATE, TRUNCATE_EXISTING} import java.nio.file.attribute.FileTime -import java.util.jar.{Attributes => JarAttributes, JarOutputStream} +import java.util.jar.{Attributes as JarAttributes, JarOutputStream} import java.util.zip.{ZipEntry, ZipOutputStream} import scala.build.Build diff --git a/modules/cli/src/main/scala/scala/cli/util/ConfigPasswordOptionHelpers.scala b/modules/cli/src/main/scala/scala/cli/util/ConfigPasswordOptionHelpers.scala index e87baf6bd0..9b660b64d4 100644 --- a/modules/cli/src/main/scala/scala/cli/util/ConfigPasswordOptionHelpers.scala +++ b/modules/cli/src/main/scala/scala/cli/util/ConfigPasswordOptionHelpers.scala @@ -3,7 +3,7 @@ package scala.cli.util import scala.build.errors.BuildException import scala.build.options.publish.ConfigPasswordOption import scala.cli.commands.SpecificationLevel -import scala.cli.commands.publish.ConfigUtil._ +import scala.cli.commands.publish.ConfigUtil.* import scala.cli.config.{ConfigDb, Key, PasswordOption} import scala.cli.errors.MissingConfigEntryError diff --git a/modules/cli/src/test/scala/cli/commands/tests/ReplOptionsTests.scala b/modules/cli/src/test/scala/cli/commands/tests/ReplOptionsTests.scala index 00b2227480..565a5661aa 100644 --- a/modules/cli/src/test/scala/cli/commands/tests/ReplOptionsTests.scala +++ b/modules/cli/src/test/scala/cli/commands/tests/ReplOptionsTests.scala @@ -1,6 +1,6 @@ package scala.cli.commands.tests -import com.eed3si9n.expecty.Expecty.{assert => expect} +import com.eed3si9n.expecty.Expecty.assert as expect import scala.cli.commands.repl.{Repl, ReplOptions, SharedReplOptions} import scala.cli.commands.shared.{SharedOptions, SharedPythonOptions} diff --git a/modules/cli/src/test/scala/cli/commands/tests/RunOptionsTests.scala b/modules/cli/src/test/scala/cli/commands/tests/RunOptionsTests.scala index 3aa077bbcd..82ab8fdff4 100644 --- a/modules/cli/src/test/scala/cli/commands/tests/RunOptionsTests.scala +++ b/modules/cli/src/test/scala/cli/commands/tests/RunOptionsTests.scala @@ -1,6 +1,6 @@ package scala.cli.commands.tests -import com.eed3si9n.expecty.Expecty.{assert => expect} +import com.eed3si9n.expecty.Expecty.assert as expect import scala.cli.commands.run.{Run, RunOptions, SharedRunOptions} import scala.cli.commands.shared.{SharedOptions, SharedPythonOptions} diff --git a/modules/cli/src/test/scala/cli/tests/CachedBinaryTests.scala b/modules/cli/src/test/scala/cli/tests/CachedBinaryTests.scala index 2a758e8fa8..2475f86874 100644 --- a/modules/cli/src/test/scala/cli/tests/CachedBinaryTests.scala +++ b/modules/cli/src/test/scala/cli/tests/CachedBinaryTests.scala @@ -1,6 +1,6 @@ package scala.cli.tests -import com.eed3si9n.expecty.Expecty.{assert => expect} +import com.eed3si9n.expecty.Expecty.assert as expect import scala.build.options.{BuildOptions, InternalOptions} import scala.build.tests.util.BloopServer diff --git a/modules/core/src/main/scala/scala/build/Logger.scala b/modules/core/src/main/scala/scala/build/Logger.scala index 35b863aaee..574ce35b10 100644 --- a/modules/core/src/main/scala/scala/build/Logger.scala +++ b/modules/core/src/main/scala/scala/build/Logger.scala @@ -1,13 +1,13 @@ package scala.build import bloop.rifle.BloopRifleLogger -import org.scalajs.logging.{Logger => ScalaJsLogger, NullLogger} +import org.scalajs.logging.{Logger as ScalaJsLogger, NullLogger} import java.io.{OutputStream, PrintStream} import scala.build.errors.{BuildException, Diagnostic, Severity} import scala.build.internals.FeatureType -import scala.scalanative.{build => sn} +import scala.scalanative.build as sn trait Logger { def error(message: String): Unit diff --git a/modules/core/src/main/scala/scala/build/internals/CustomProgressBarRefreshDisplay.scala b/modules/core/src/main/scala/scala/build/internals/CustomProgressBarRefreshDisplay.scala index ea65dbb006..a5e9b27f31 100644 --- a/modules/core/src/main/scala/scala/build/internals/CustomProgressBarRefreshDisplay.scala +++ b/modules/core/src/main/scala/scala/build/internals/CustomProgressBarRefreshDisplay.scala @@ -4,7 +4,7 @@ package scala.build.internal // bars on screen import coursier.cache.internal.ConsoleDim -import coursier.cache.loggers._ +import coursier.cache.loggers.* import java.io.Writer import java.sql.Timestamp diff --git a/modules/core/src/main/scala/scala/build/internals/StableScalaVersion.scala b/modules/core/src/main/scala/scala/build/internals/StableScalaVersion.scala index 9eeb2ac387..192f41e7aa 100644 --- a/modules/core/src/main/scala/scala/build/internals/StableScalaVersion.scala +++ b/modules/core/src/main/scala/scala/build/internals/StableScalaVersion.scala @@ -1,7 +1,7 @@ package scala.build.internal -import com.github.plokhotnyuk.jsoniter_scala.core._ -import com.github.plokhotnyuk.jsoniter_scala.macros._ +import com.github.plokhotnyuk.jsoniter_scala.core.* +import com.github.plokhotnyuk.jsoniter_scala.macros.* import coursier.core.Version final case class StableScalaVersion( diff --git a/modules/directives/src/main/scala/scala/build/preprocessing/directives/ComputeVersion.scala b/modules/directives/src/main/scala/scala/build/preprocessing/directives/ComputeVersion.scala index a7281455f1..fd47132c41 100644 --- a/modules/directives/src/main/scala/scala/build/preprocessing/directives/ComputeVersion.scala +++ b/modules/directives/src/main/scala/scala/build/preprocessing/directives/ComputeVersion.scala @@ -12,7 +12,7 @@ import scala.build.directives.{ HasBuildOptions } import scala.build.errors.BuildException -import scala.build.options.{BuildOptions, ComputeVersion => cv, SourceGeneratorOptions} +import scala.build.options.{BuildOptions, ComputeVersion as cv, SourceGeneratorOptions} import scala.cli.commands.SpecificationLevel @DirectiveGroupName("Compute Version") diff --git a/modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala b/modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala index 40d782cb3c..e0236ec4fd 100644 --- a/modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala +++ b/modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala @@ -18,7 +18,7 @@ import scala.build.errors.{ import scala.build.preprocessing.Scoped import scala.cli.commands.SpecificationLevel import scala.deriving.* -import scala.quoted.{_, given} +import scala.quoted.{*, given} trait DirectiveHandler[+T] { self => def name: String diff --git a/modules/directives/src/main/scala/scala/build/preprocessing/directives/Packaging.scala b/modules/directives/src/main/scala/scala/build/preprocessing/directives/Packaging.scala index dca479380f..00c9623c02 100644 --- a/modules/directives/src/main/scala/scala/build/preprocessing/directives/Packaging.scala +++ b/modules/directives/src/main/scala/scala/build/preprocessing/directives/Packaging.scala @@ -11,7 +11,7 @@ import scala.build.errors.{ MalformedInputError, ModuleFormatError } -import scala.build.options._ +import scala.build.options.* import scala.build.options.packaging.{DockerOptions, NativeImageOptions} import scala.build.{Positioned, options} import scala.cli.commands.SpecificationLevel diff --git a/modules/directives/src/main/scala/scala/build/preprocessing/directives/PublishContextual.scala b/modules/directives/src/main/scala/scala/build/preprocessing/directives/PublishContextual.scala index 151e809eae..7305cef295 100644 --- a/modules/directives/src/main/scala/scala/build/preprocessing/directives/PublishContextual.scala +++ b/modules/directives/src/main/scala/scala/build/preprocessing/directives/PublishContextual.scala @@ -4,7 +4,7 @@ import scala.build.EitherCps.{either, value} import scala.build.Ops.* import scala.build.directives.* import scala.build.errors.{BuildException, CompositeBuildException, MalformedInputError} -import scala.build.options._ +import scala.build.options.* import scala.build.options.publish.ConfigPasswordOption import scala.build.{Positioned, options} import scala.cli.commands.SpecificationLevel diff --git a/modules/directives/src/main/scala/scala/build/preprocessing/directives/Toolkit.scala b/modules/directives/src/main/scala/scala/build/preprocessing/directives/Toolkit.scala index 22f5799a12..c3dc4ad56a 100644 --- a/modules/directives/src/main/scala/scala/build/preprocessing/directives/Toolkit.scala +++ b/modules/directives/src/main/scala/scala/build/preprocessing/directives/Toolkit.scala @@ -7,9 +7,9 @@ import scala.build.Positioned import scala.build.directives.* import scala.build.errors.BuildException import scala.build.internal.Constants +import scala.build.options.* import scala.build.options.BuildRequirements.ScopeRequirement import scala.build.options.WithBuildRequirements.* -import scala.build.options.* import scala.cli.commands.SpecificationLevel @DirectiveGroupName("Toolkit") diff --git a/modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala b/modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala index 521e3bb5c1..3a7c23a0df 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala @@ -1,7 +1,7 @@ package scala.cli.integration -import ch.epfl.scala.bsp4j.JvmTestEnvironmentParams import ch.epfl.scala.bsp4j as b +import ch.epfl.scala.bsp4j.JvmTestEnvironmentParams import com.eed3si9n.expecty.Expecty.expect import com.google.gson.{Gson, JsonElement} diff --git a/modules/integration/src/test/scala/scala/cli/integration/DocTestDefinitions.scala b/modules/integration/src/test/scala/scala/cli/integration/DocTestDefinitions.scala index b3a0b0a5a2..6b11c8d8ef 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/DocTestDefinitions.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/DocTestDefinitions.scala @@ -1,9 +1,9 @@ package scala.cli.integration import com.eed3si9n.expecty.Expecty.expect -import org.jsoup._ +import org.jsoup.* -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* abstract class DocTestDefinitions extends ScalaCliSuite with TestScalaVersionArgs { _: TestScalaVersion => diff --git a/modules/integration/src/test/scala/scala/cli/integration/ScalaCliSuite.scala b/modules/integration/src/test/scala/scala/cli/integration/ScalaCliSuite.scala index 9551a1d8a5..f249e3c862 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/ScalaCliSuite.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/ScalaCliSuite.scala @@ -6,11 +6,11 @@ import scala.concurrent.duration.{Duration, FiniteDuration} abstract class ScalaCliSuite extends munit.FunSuite { implicit class BeforeEachOpts(munitContext: BeforeEach) { - def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path) + def locationAbsolutePath: os.Path = os.Path(munitContext.test.location.path) } implicit class AfterEachOpts(munitContext: AfterEach) { - def locationAbsolutePath: os.Path = os.pwd / os.RelPath(munitContext.test.location.path) + def locationAbsolutePath: os.Path = os.Path(munitContext.test.location.path) } val testStartEndLogger: Fixture[Unit] = new Fixture[Unit]("files") { def apply(): Unit = () diff --git a/modules/integration/src/test/scala/scala/cli/integration/SparkTests212.scala b/modules/integration/src/test/scala/scala/cli/integration/SparkTests212.scala index 3b38af3b92..c8c9c74c59 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/SparkTests212.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/SparkTests212.scala @@ -5,7 +5,7 @@ import com.eed3si9n.expecty.Expecty.expect import java.io.File import java.util.Locale -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* import scala.util.Properties class SparkTests212 extends SparkTestDefinitions with Test212 { diff --git a/modules/integration/src/test/scala/scala/cli/integration/TestBspClient.scala b/modules/integration/src/test/scala/scala/cli/integration/TestBspClient.scala index dd128b37ea..733832b6c2 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/TestBspClient.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/TestBspClient.scala @@ -1,6 +1,6 @@ package scala.cli.integration -import ch.epfl.scala.{bsp4j => b} +import ch.epfl.scala.bsp4j as b import org.eclipse.lsp4j.jsonrpc import java.io.{InputStream, OutputStream} diff --git a/modules/options/src/main/scala/scala/build/Artifacts.scala b/modules/options/src/main/scala/scala/build/Artifacts.scala index 573dae3046..1beae8f494 100644 --- a/modules/options/src/main/scala/scala/build/Artifacts.scala +++ b/modules/options/src/main/scala/scala/build/Artifacts.scala @@ -4,7 +4,7 @@ import coursier.cache.FileCache import coursier.core.{Classifier, Module, ModuleName, Organization, Repository, Version} import coursier.error.ResolutionError import coursier.util.Task -import coursier.{Dependency => CsDependency, Fetch, Resolution, core => csCore, util => csUtil} +import coursier.{Dependency as CsDependency, Fetch, Resolution, core as csCore, util as csUtil} import dependency.* import java.net.URL diff --git a/modules/options/src/main/scala/scala/build/CoursierUtils.scala b/modules/options/src/main/scala/scala/build/CoursierUtils.scala index 078bff7719..fb16702a70 100644 --- a/modules/options/src/main/scala/scala/build/CoursierUtils.scala +++ b/modules/options/src/main/scala/scala/build/CoursierUtils.scala @@ -1,6 +1,6 @@ package scala.build -import coursier.core.{Dependency => CDependency, Module} +import coursier.core.{Dependency as CDependency, Module} import coursier.parse.{DependencyParser, ModuleParser} import dependency.{DependencyLike, NameAttributes} diff --git a/modules/options/src/main/scala/scala/build/actionable/ActionableDiagnostic.scala b/modules/options/src/main/scala/scala/build/actionable/ActionableDiagnostic.scala index d751a0a443..4bd5e7957c 100644 --- a/modules/options/src/main/scala/scala/build/actionable/ActionableDiagnostic.scala +++ b/modules/options/src/main/scala/scala/build/actionable/ActionableDiagnostic.scala @@ -1,6 +1,6 @@ package scala.build.actionable -import dependency._ +import dependency.* import scala.build.Position import scala.build.errors.Diagnostic.TextEdit diff --git a/modules/options/src/main/scala/scala/build/actionable/ActionablePreprocessor.scala b/modules/options/src/main/scala/scala/build/actionable/ActionablePreprocessor.scala index b410ceb59e..7fd35c0efa 100644 --- a/modules/options/src/main/scala/scala/build/actionable/ActionablePreprocessor.scala +++ b/modules/options/src/main/scala/scala/build/actionable/ActionablePreprocessor.scala @@ -1,6 +1,6 @@ package scala.build.actionable -import scala.build.Ops._ +import scala.build.Ops.* import scala.build.errors.{BuildException, CompositeBuildException, Diagnostic} import scala.build.options.BuildOptions diff --git a/modules/options/src/main/scala/scala/build/options/ClassPathOptions.scala b/modules/options/src/main/scala/scala/build/options/ClassPathOptions.scala index 76d886586d..be8a499d6e 100644 --- a/modules/options/src/main/scala/scala/build/options/ClassPathOptions.scala +++ b/modules/options/src/main/scala/scala/build/options/ClassPathOptions.scala @@ -1,6 +1,6 @@ package scala.build.options -import dependency._ +import dependency.* import scala.build.Positioned diff --git a/modules/options/src/main/scala/scala/build/options/JavaOptions.scala b/modules/options/src/main/scala/scala/build/options/JavaOptions.scala index 594a3055bc..0ec8181e14 100644 --- a/modules/options/src/main/scala/scala/build/options/JavaOptions.scala +++ b/modules/options/src/main/scala/scala/build/options/JavaOptions.scala @@ -6,7 +6,7 @@ import coursier.jvm.{JavaHome, JvmCache, JvmIndex} import coursier.util.Task import dependency.AnyDependency -import scala.build.internal.CsLoggerUtil._ +import scala.build.internal.CsLoggerUtil.* import scala.build.internal.OsLibc import scala.build.options.BuildOptions.JavaHomeInfo import scala.build.{Os, Position, Positioned} diff --git a/modules/options/src/main/scala/scala/build/options/PackageOptions.scala b/modules/options/src/main/scala/scala/build/options/PackageOptions.scala index 53cd58fdf0..fd76806a2e 100644 --- a/modules/options/src/main/scala/scala/build/options/PackageOptions.scala +++ b/modules/options/src/main/scala/scala/build/options/PackageOptions.scala @@ -1,7 +1,7 @@ package scala.build.options import scala.build.internal.Constants -import scala.build.options.packaging._ +import scala.build.options.packaging.* final case class PackageOptions( standalone: Option[Boolean] = None, diff --git a/modules/options/src/main/scala/scala/build/options/ScalaJsOptions.scala b/modules/options/src/main/scala/scala/build/options/ScalaJsOptions.scala index 8c56c0f0ba..22bb1bcc1d 100644 --- a/modules/options/src/main/scala/scala/build/options/ScalaJsOptions.scala +++ b/modules/options/src/main/scala/scala/build/options/ScalaJsOptions.scala @@ -1,7 +1,7 @@ package scala.build.options -import bloop.config.{Config => BloopConfig} -import dependency._ +import bloop.config.Config as BloopConfig +import dependency.* import java.util.Locale diff --git a/modules/options/src/main/scala/scala/build/options/ScalaNativeOptions.scala b/modules/options/src/main/scala/scala/build/options/ScalaNativeOptions.scala index 0857a0fd18..3491273869 100644 --- a/modules/options/src/main/scala/scala/build/options/ScalaNativeOptions.scala +++ b/modules/options/src/main/scala/scala/build/options/ScalaNativeOptions.scala @@ -1,13 +1,13 @@ package scala.build.options -import _root_.bloop.config.{Config => BloopConfig} -import dependency._ +import _root_.bloop.config.Config as BloopConfig +import dependency.* import java.nio.file.Paths import scala.build.internal.Constants +import scala.scalanative.build as sn import scala.scalanative.build.LTO -import scala.scalanative.{build => sn} enum ScalaNativeTarget: case Application, LibraryDynamic, LibraryStatic diff --git a/modules/scala3-graal/src/main/scala/scala/cli/graal/BytecodeProcessor.scala b/modules/scala3-graal/src/main/scala/scala/cli/graal/BytecodeProcessor.scala index 4026df2e46..39311c5128 100644 --- a/modules/scala3-graal/src/main/scala/scala/cli/graal/BytecodeProcessor.scala +++ b/modules/scala3-graal/src/main/scala/scala/cli/graal/BytecodeProcessor.scala @@ -1,12 +1,12 @@ package scala.cli.graal -import org.objectweb.asm._ +import org.objectweb.asm.* import java.io.{File, InputStream} import java.nio.file.{Files, StandardOpenOption} import java.util.jar.{Attributes, JarEntry, JarFile, JarOutputStream, Manifest} -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* object BytecodeProcessor { diff --git a/project/deps.sc b/project/deps.mill.scala similarity index 99% rename from project/deps.sc rename to project/deps.mill.scala index 3c211e619d..5aeb4cdac5 100644 --- a/project/deps.sc +++ b/project/deps.mill.scala @@ -1,3 +1,5 @@ +package build.project + import Deps.Versions import mill._ import scalalib._ @@ -92,7 +94,7 @@ object TestDeps { object InternalDeps { object Versions { - def mill = os.read(os.pwd / ".mill-version").trim + def mill = _root_.mill.main.BuildInfo.millVersion def lefouMillwRef = "166bcdf5741de8569e0630e18c3b2ef7e252cd96" } } diff --git a/project/package.mill.scala b/project/package.mill.scala new file mode 100644 index 0000000000..5aa711479c --- /dev/null +++ b/project/package.mill.scala @@ -0,0 +1 @@ +package build.project diff --git a/project/publish.sc b/project/publish/package.mill.scala similarity index 96% rename from project/publish.sc rename to project/publish/package.mill.scala index 4a305fe2a5..527a883cae 100644 --- a/project/publish.sc +++ b/project/publish/package.mill.scala @@ -1,6 +1,8 @@ +package build.project.publish + import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` import $ivy.`org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r` -import $file.settings, settings.{PublishLocalNoFluff, workspaceDirName} +import build.project.settings.{PublishLocalNoFluff, workspaceDirName} import de.tobiasroeser.mill.vcs.version._ import mill._, scalalib._ @@ -18,7 +20,7 @@ lazy val (ghOrg, ghName) = { val repos = { var git: Git = null try { - git = Git.open(os.pwd.toIO) + git = Git.open(os.Path(sys.env("MILL_WORKSPACE_ROOT")).toIO) git.remoteList().call().asScala.toVector } finally @@ -153,7 +155,8 @@ trait ScalaCliPublishModule extends PublishModule with PublishLocalNoFluff { def publishSonatype( data: Seq[PublishModule.PublishData], - log: mill.api.Logger + log: mill.api.Logger, + workspace: os.Path ): Unit = { val credentials = sys.env("SONATYPE_USERNAME") + ":" + sys.env("SONATYPE_PASSWORD") @@ -193,7 +196,7 @@ def publishSonatype( readTimeout = timeout.toMillis.toInt, connectTimeout = timeout.toMillis.toInt, log = log, - workspace = os.pwd, + workspace = workspace, env = sys.env, awaitTimeout = timeout.toMillis.toInt, stagingRelease = isRelease @@ -222,7 +225,7 @@ def setShouldPublish() = T.command { val charSet = Charset.defaultCharset() val nl = System.lineSeparator() os.write.append( - os.Path(envFile, os.pwd), + os.Path(envFile, T.workspace), s"SHOULD_PUBLISH=${shouldPublish()}$nl".getBytes(charSet) ) } diff --git a/project/settings.sc b/project/settings/package.mill.scala similarity index 90% rename from project/settings.sc rename to project/settings/package.mill.scala index b28ed46f4d..559dbae63a 100644 --- a/project/settings.sc +++ b/project/settings/package.mill.scala @@ -1,9 +1,12 @@ -import $ivy.`com.goyeau::mill-scalafix::0.3.1` -import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.26` +package build.project.settings -import $file.deps, - deps.{Deps, Docker, alpineVersion, buildCsVersion, buildCsM1Version, libsodiumVersion} -import $file.utils, utils.isArmArchitecture +import $ivy.`com.goyeau::mill-scalafix::0.4.2` +import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.29` +import $ivy.`io.get-coursier::coursier-launcher:2.1.14` + +import $file.project.deps, + deps.{Deps, Docker, alpineVersion, buildCsVersion, buildCsM1Version, libsodiumVersion, Scala} +import $file.project.utils, utils.isArmArchitecture import com.goyeau.mill.scalafix.ScalafixModule import de.tobiasroeser.mill.vcs.version.VcsVersion @@ -96,7 +99,7 @@ def cs: T[String] = T.persistent { case t: Throwable => throw new Exception(s"Error getting and extracting $url", t) } - val f = maybeFile.fold(ex => throw new Exception(ex), os.Path(_, os.pwd)) + val f = maybeFile.fold(ex => throw new Exception(ex), os.Path(_, T.workspace)) val exec = if (Properties.isWin && os.isDir(f) && f.last.endsWith(".zip")) os.list(f).find(_.last.endsWith(".exe")).getOrElse( @@ -186,7 +189,7 @@ trait CliLaunchers extends SbtModule { self => private def staticLibDirName = "native-libs" - private def copyCsjniutilTo(cs: String, destDir: os.Path): Unit = { + private def copyCsjniutilTo(cs: String, destDir: os.Path, workspace: os.Path): Unit = { val jniUtilsVersion = Deps.jniUtils.dep.version val libRes = os.proc( cs, @@ -196,10 +199,10 @@ trait CliLaunchers extends SbtModule { self => "-A", "lib" ).call() - val libPath = os.Path(libRes.out.trim(), os.pwd) + val libPath = os.Path(libRes.out.trim(), workspace) os.copy.over(libPath, destDir / "csjniutils.lib") } - private def copyLibsodiumjniTo(cs: String, destDir: os.Path): Unit = { + private def copyLibsodiumjniTo(cs: String, destDir: os.Path, workspace: os.Path): Unit = { val libsodiumjniVersion = Deps.libsodiumjni.dep.version val (classifier, ext) = sys.props.get("os.arch") match { case Some("x86_64" | "amd64") => @@ -224,26 +227,26 @@ trait CliLaunchers extends SbtModule { self => "-A", ext ).call() - val libPath = os.Path(libRes.out.trim(), os.pwd) + val libPath = os.Path(libRes.out.trim(), workspace) val prefix = if (Properties.isWin) "" else "lib" os.copy.over(libPath, destDir / s"${prefix}sodiumjni.$ext") } - private def copyLibsodiumStaticTo(cs: String, destDir: os.Path): Unit = { + private def copyLibsodiumStaticTo(cs: String, destDir: os.Path, workspace: os.Path): Unit = { val dirRes = os.proc( cs, "get", "--archive", "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip" ).call() - val dir = os.Path(dirRes.out.trim(), os.pwd) + val dir = os.Path(dirRes.out.trim(), workspace) os.copy.over( dir / "libsodium" / "x64" / "Release" / "v143" / "static" / "libsodium.lib", destDir / "sodium.lib" ) } - private def copyAlpineLibsodiumTo(cs: String, destDir: os.Path): Unit = { + private def copyAlpineLibsodiumTo(cs: String, destDir: os.Path, workspace: os.Path): Unit = { val arcPath = os.proc( cs, "get", @@ -251,7 +254,7 @@ trait CliLaunchers extends SbtModule { self => ).call().out.trim() val tmpDir = os.temp.dir(prefix = "libsodium-static") try { - os.proc("tar", "-zxf", os.Path(arcPath, os.pwd)) + os.proc("tar", "-zxf", os.Path(arcPath, workspace)) .call(cwd = tmpDir, stdout = os.Inherit) os.copy.over(tmpDir / "usr" / "lib" / "libsodium.a", destDir / "libsodium.a") } @@ -277,14 +280,14 @@ trait CliLaunchers extends SbtModule { self => os.makeDir.all(dir) if (Properties.isWin) { - copyLibsodiumStaticTo(cs(), dir) - copyLibsodiumjniTo(cs(), dir) - copyCsjniutilTo(cs(), dir) + copyLibsodiumStaticTo(cs(), dir, T.workspace) + copyLibsodiumjniTo(cs(), dir, T.workspace) + copyCsjniutilTo(cs(), dir, T.workspace) } if (launcherKind == "static") { - copyAlpineLibsodiumTo(cs(), dir) - copyLibsodiumjniTo(cs(), dir) + copyAlpineLibsodiumTo(cs(), dir, T.workspace) + copyLibsodiumjniTo(cs(), dir, T.workspace) } PathRef(dir) @@ -353,7 +356,7 @@ trait CliLaunchers extends SbtModule { self => } def buildHelperImage = T { os.proc("docker", "build", "-t", Docker.customMuslBuilderImageName, ".") - .call(cwd = os.pwd / "project" / "musl-image", stdout = os.Inherit) + .call(cwd = T.workspace / "project" / "musl-image", stdout = os.Inherit) () } def writeNativeImageScript(scriptDest: String, imageDest: String = "") = T.command { @@ -432,7 +435,7 @@ trait CliLaunchers extends SbtModule { self => stdin = os.Inherit, stdout = os.Inherit ) - T.log.outputStream.println(s"Config generated in ${outputDir.relativeTo(os.pwd)}") + T.log.outputStream.println(s"Config generated in ${outputDir.relativeTo(T.workspace)}") } def runFromJars(args: String*) = T.command { @@ -484,7 +487,7 @@ trait CliLaunchers extends SbtModule { self => def standaloneLauncher = T { - val cachePath = os.Path(coursier.cache.FileCache().location, os.pwd) + val cachePath = os.Path(coursier.cache.FileCache().location, T.workspace) def urlOf(path: os.Path): Option[String] = if (path.startsWith(cachePath)) { val segments = path.relativeTo(cachePath).segments @@ -540,7 +543,7 @@ trait HasTests extends SbtModule { else Nil super.scalacOptions() ++ extraOptions } - trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests with TestModule.Munit { + trait ScalaCliTests extends ScalaCliModule with super.SbtTests with TestModule.Munit { def ivyDeps = super.ivyDeps() ++ Agg( Deps.expecty, Deps.munit @@ -572,10 +575,10 @@ trait PublishLocalNoFluff extends PublishModule { val publisher = localIvyRepo match { case null => LocalIvyPublisher case repo => - new LocalIvyPublisher(os.Path(repo.replace("{VERSION}", publishVersion()), os.pwd)) + new LocalIvyPublisher(os.Path(repo.replace("{VERSION}", publishVersion()), T.workspace)) } - publisher.publish( + publisher.publishLocal( jar = jar().path, sourcesJar = emptyZip().path, docJar = emptyZip().path, @@ -613,7 +616,7 @@ trait LocalRepo extends Module { val repoVer = vcsState().format() val ver = version() val something = localRepo() - val repoDir = os.pwd / "out" / "repo" / ver + val repoDir = T.workspace / "out" / "repo" / ver val destDir = T.dest / ver / "repo.zip" val dest = destDir / "repo.zip" @@ -757,7 +760,7 @@ trait FormatNativeImageConf extends JavaModule { System.err.println(msg) for (f <- needsFormatting) System.err.println( - s" ${if (f.startsWith(os.pwd)) f.relativeTo(os.pwd).toString else f.toString}" + s" ${if (f.startsWith(T.workspace)) f.relativeTo(T.workspace).toString else f.toString}" ) System.err.println( """Run @@ -782,19 +785,50 @@ trait ScalaCliScalafixModule extends ScalafixModule { override def semanticDbVersion = Deps.Versions.scalaMeta def scalafixConfig = T { - if (scalaVersion().startsWith("2.")) super.scalafixConfig() - else Some(os.pwd / ".scalafix3.conf") + if (scalaVersion().startsWith("2.12.")) { + val newConfigPath = T.dest / ".scalafix.conf" + val newConfigContent = + os.read(T.workspace / ".scalafix.conf").replace( + "targetDialect = Scala3", + "# targetDialect = Scala3" + ) + os.write(newConfigPath, newConfigContent) + Some(newConfigPath) + } + else if (scalaVersion().startsWith("3.")) Some(T.workspace / ".scalafix3.conf") + else super.scalafixConfig() + } + + // Run Scalafix only on the main Scala version of the module + // If the module has Scala 2. + override def fix(args: String*) = { + val allScalaVersions = this.millOuterCtx.crossValues.map(_.toString) + + val mainScalaVersion = + if (allScalaVersions.contains(Scala.scala212)) Some(Scala.scala212) + else if (allScalaVersions.contains(Scala.scala213)) Some(Scala.scala213) + else if (allScalaVersions.contains(Scala.scala3Lts)) Some(Scala.scala3Lts) + else None + + this match { + case m: CrossModuleBase if mainScalaVersion.contains(m.crossScalaVersion) => + super.fix(args: _*) + case m: CrossModuleBase => + T.command(()) + case _ => + super.fix(args: _*) + } } def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ { if (scalaVersion().startsWith("2.")) Seq(Deps.semanticDbScalac) else Nil } // Explicitly setting sourceroot, so that Scala CLI doesn't use a wrong one. - // Using os.pwd is more or less required, for scalafix stuff to work fine. + // Using T.workspace is more or less required, for scalafix stuff to work fine. def scalacOptions = T { val sv = scalaVersion() val isScala2 = sv.startsWith("2.") - val sourceRoot = os.pwd + val sourceRoot = T.workspace val parentOptions = { val l = super.scalacOptions() if (isScala2) l.filterNot(_.startsWith("-P:semanticdb:sourceroot:")) @@ -847,7 +881,7 @@ object Licenses { implicit val rw: ReadWriter[Licenses] = macroRW } -def updateLicensesFile() = { +def updateLicensesFile = T.task { val url = "https://github.com/spdx/license-list-data/raw/master/json/licenses.json" var is: InputStream = null val b = @@ -888,7 +922,7 @@ def updateLicensesFile() = { val dest = os.rel / "modules" / "build" / "src" / "main" / "scala" / "scala" / "build" / "internal" / "Licenses.scala" - os.write.over(os.pwd / dest, genSource) + os.write.over(T.workspace / dest, genSource) System.err.println(s"Wrote $dest") } diff --git a/project/utils.sc b/project/utils.mill.scala similarity index 85% rename from project/utils.sc rename to project/utils.mill.scala index bedd500dda..ab6beaca16 100644 --- a/project/utils.sc +++ b/project/utils.mill.scala @@ -1,3 +1,5 @@ +package build.project + import java.util.Locale lazy val isArmArchitecture: Boolean = diff --git a/project/website.sc b/project/website.mill.scala similarity index 97% rename from project/website.sc rename to project/website.mill.scala index 9bffdec43b..36bf50ccf8 100644 --- a/project/website.sc +++ b/project/website.mill.scala @@ -1,4 +1,6 @@ -import $file.deps, deps.Scala +package build.project + +import deps.Scala private def lastTableLine(path: os.Path, colCount: Int): Seq[String] = { val content = os.read(path)