Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ bin/

# vim
*.swp
**/*.DS_Store
38 changes: 15 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 ++= {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/sbt-test/integration/cli/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
resolvers += Resolver.sonatypeCentralSnapshots
enablePlugins(ScalaNativePlugin)

import sbt._
Expand Down
2 changes: 1 addition & 1 deletion cli/src/sbt-test/integration/cli/project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
resolvers += Resolver.sonatypeCentralSnapshots

val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
Expand Down
4 changes: 2 additions & 2 deletions cli/src/sbt-test/integration/standalone/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cli/src/sbt-test/integration/standalone/test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions project/Internals.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package scala.scalanative

// Proxy to package private methods
package nir {
object Proxy {
def nativeBinaryVersion(version: String) = Versions.binaryVersion(version)
}
}
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")