diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9c3da12..2d0fb1f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,7 @@ jobs: matrix: OS: [ubuntu-22.04, windows-2022] # Test using the same Scala 3 as used to publish ScalaNative artifacts - scala: [2.12.18, 2.13.12, 3.1.3] + scala: [2.12.20, 2.13.17, 3.1.3] steps: - uses: actions/checkout@v3 - uses: coursier/cache-action@v6 @@ -30,7 +30,7 @@ jobs: function InstallLLVM { Write-Host "Attempting to install LLVM (try $($retryCount + 1 - $global:retryAttempt) of $($retryCount + 1))..." - choco install llvm --version=17.0.6 --allow-downgrade --force + choco install llvm --version=21.1.0 --allow-downgrade --force } # Attempt to install LLVM with retries diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f506f3b..691b119 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,12 +12,16 @@ jobs: name: Publish runs-on: ubuntu-22.04 if: github.repository == 'scala-native/scala-native-cli' + env: + # Present only for repository_dispatch; empty for tag push / manual runs + CI_NATIVE_VERSION: ${{ github.event.client_payload.version || '' }} steps: - uses: actions/checkout@v3 - uses: coursier/cache-action@v6 - uses: coursier/setup-action@v1 with: jvm: adopt:8 + apps: sbt - name: Setup PGP Key run: | diff --git a/.gitignore b/.gitignore index 3c53055..79fc1b7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ bin/ # vim *.swp +**/*.DS_Store \ No newline at end of file diff --git a/build.sbt b/build.sbt index c4ea821..69a3329 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,20 @@ -val ScalaNativeVersion = "0.5.9-SNAPSHOT" +import scala.util.Properties.envOrNone +import scala.scalanative.nir.Proxy.nativeBinaryVersion + +val ScalaNativeVersion = envOrNone("CI_NATIVE_VERSION") + .filterNot(_.isEmpty) + .getOrElse("0.5.8") val crossScalaVersions212 = (14 to 20).map("2.12." + _) -val crossScalaVersions213 = (8 to 16).map("2.13." + _) +val crossScalaVersions213 = (8 to 17).map("2.13." + _) val crossScalaVersions3 = (2 to 3).map("3.1." + _) ++ (0 to 2).map("3.2." + _) ++ - (0 to 6).map("3.3." + _) ++ + (0 to 7).map("3.3." + _) ++ (0 to 3).map("3.4." + _) ++ (0 to 2).map("3.5." + _) ++ (2 to 4).map("3.6." + _) ++ - (0 to 1).map("3.7." + _) ++ + (0 to 3).map("3.7." + _) ++ Nil val scala2_12 = crossScalaVersions212.last @@ -100,9 +105,6 @@ inThisBuild( Some("scm:git:git@github.com:scala-native/scala-native-cli.git") ) ), - // Used during the releases - resolvers += "Sonatype Central Deployments" at "https://central.sonatype.com/api/v1/publisher/deployments/download/", - resolvers ++= Resolver.sonatypeOssRepos("snapshots"), resolvers += Resolver.sonatypeCentralSnapshots, resolvers += Resolver.mavenCentral, resolvers += Resolver.defaultLocal @@ -120,11 +122,10 @@ lazy val cli = project crossScalaVersions := publishScalaVersions, Compile / run / mainClass := Some("scala.scalanative.cli.ScalaNativeLd"), - scalacOptions += "-Ywarn-unused:imports", - scalacOptions ++= CrossVersion.partialVersion(scalaVersion.value).collect { - case (2, _) => "-target:jvm-1.8" - case (3, _) => "-Xtarget:8" - }, + scalacOptions ++= Seq( + "-release:8", + "-Ywarn-unused:imports" + ), libraryDependencies ++= Seq( "org.scala-native" %% "tools" % scalaNativeVersion.value, "com.github.scopt" %% "scopt" % "4.0.1", @@ -170,13 +171,6 @@ lazy val cliScriptedTests = project } ) -def nativeBinaryVersion(version: String): String = { - val VersionPattern = raw"(\d+)\.(\d+)\.(\d+)(\-.*)?".r - val VersionPattern(major, minor, patch, milestone) = version - if (patch != null && milestone != null) version - else s"$major.$minor" -} - val nativeSourceExtensions = Set(".c", ".cpp", ".cxx", ".h", ".hpp", ".S") val DeduplicateOrRename = new sbtassembly.MergeStrategy { def name: String = "deduplicate-or-rename" @@ -230,7 +224,7 @@ lazy val cliPackSettings = Def.settings( val lm = { import sbt.librarymanagement.ivy._ val ivyConfig = InlineIvyConfiguration() - .withResolvers(resolvers.value.toVector) + .withResolvers((ThisBuild / resolvers).value.toVector) .withLog(log) IvyDependencyResolution(ivyConfig) } @@ -312,9 +306,7 @@ lazy val sonatypePublishSettings = Def.settings( publishMavenStyle := true, pomIncludeRepository := (_ => false), publishTo := { - val centralSnapshots = - "https://central.sonatype.com/repository/maven-snapshots/" - if (isSnapshot.value) Some("central-snapshots" at centralSnapshots) + if (isSnapshot.value) Some(Resolver.sonatypeCentralSnapshots) else localStaging.value }, credentials ++= { diff --git a/cli/src/sbt-test/integration/cli/build.sbt b/cli/src/sbt-test/integration/cli/build.sbt index 0b2e055..546455f 100644 --- a/cli/src/sbt-test/integration/cli/build.sbt +++ b/cli/src/sbt-test/integration/cli/build.sbt @@ -1,4 +1,4 @@ -resolvers ++= Resolver.sonatypeOssRepos("snapshots") +resolvers += Resolver.sonatypeCentralSnapshots enablePlugins(ScalaNativePlugin) import sbt._ diff --git a/cli/src/sbt-test/integration/cli/project/build.sbt b/cli/src/sbt-test/integration/cli/project/build.sbt index 4908c41..fed9cc1 100644 --- a/cli/src/sbt-test/integration/cli/project/build.sbt +++ b/cli/src/sbt-test/integration/cli/project/build.sbt @@ -1,4 +1,4 @@ -resolvers ++= Resolver.sonatypeOssRepos("snapshots") +resolvers += Resolver.sonatypeCentralSnapshots val pluginVersion = System.getProperty("plugin.version") if (pluginVersion == null) diff --git a/cli/src/sbt-test/integration/standalone/build.sbt b/cli/src/sbt-test/integration/standalone/build.sbt index 227155c..f8b800a 100644 --- a/cli/src/sbt-test/integration/standalone/build.sbt +++ b/cli/src/sbt-test/integration/standalone/build.sbt @@ -47,9 +47,9 @@ runScript := { if (!scalaBinDir.exists) { val downloadUrl = if (ver.startsWith("3.")) - s"https://github.com/lampepfl/dotty/releases/download/$ver/$scalaDir.zip" + s"https://github.com/scala/scala3/releases/download/$ver/$scalaDir.zip" else - s"https://downloads.lightbend.com/scala/${ver}/$scalaDir.zip" + s"https://github.com/scala/scala/releases/download/v${ver}/${scalaDir}.zip" IO.unzipURL(url(downloadUrl), cacheDir) } // Make sure we can execute scala/scalac from downloaded distro diff --git a/cli/src/sbt-test/integration/standalone/test b/cli/src/sbt-test/integration/standalone/test index c9c4721..7338640 100755 --- a/cli/src/sbt-test/integration/standalone/test +++ b/cli/src/sbt-test/integration/standalone/test @@ -16,10 +16,10 @@ $ exists Foo$.nir -> runScript scala-native-p --from-path notExisting.nir # Move nir file to directory outside classpath -$ mkdir ../scala-native-test/ -$ copy-file Foo.nir ../scala-native-test//Foo2.nir -$ exists ../scala-native-test/Foo2.nir -> runScript scala-native-p --from-path ../scala-native-test/Foo2.nir +$ mkdir scala-native-test/ +$ copy-file Foo.nir scala-native-test/Foo2.nir +$ exists scala-native-test/Foo2.nir +> runScript scala-native-p --from-path scala-native-test/Foo2.nir > runExec jar cf inside.jar Foo.class Foo.nir Foo$.class Foo$.nir > runScript scala-native-p --cp inside.jar --from-path Foo.nir Foo$.nir diff --git a/project/Internals.scala b/project/Internals.scala new file mode 100644 index 0000000..d7d5ce5 --- /dev/null +++ b/project/Internals.scala @@ -0,0 +1,8 @@ +package scala.scalanative + +// Proxy to package private methods +package nir { + object Proxy { + def nativeBinaryVersion(version: String) = Versions.binaryVersion(version) + } +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 5092e32..5b5486e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.0.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0") + +// Used only to access cross-version utilities +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.8")