-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sbt-native-packager instead of sbt-pack
- Loading branch information
1 parent
4828244
commit 09f94b4
Showing
6 changed files
with
193 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
name: Build the MSI Package | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
env: | ||
RELEASEBUILD: yes | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '21' | ||
cache: 'sbt' | ||
- name: Build MSI package | ||
run: | | ||
sbt 'dist-win-x86_64/Windows/packageBin' | ||
- name: Upload MSI Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: scala.msi | ||
path: ./dist/win-x86_64/target/windows/scala.msi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error CNDL0108 : The Product/@Version attribute's value, '3.5.1-RC1', is not a valid version. Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import java.io.File | ||
import java.nio.file._ | ||
|
||
import Process._ | ||
import Modes._ | ||
import ScaladocGeneration._ | ||
import com.jsuereth.sbtpgp.PgpKeys | ||
import sbt.Keys._ | ||
import sbt._ | ||
import sbt.Keys.* | ||
import sbt.* | ||
import complete.DefaultParsers._ | ||
import pl.project13.scala.sbt.JmhPlugin | ||
import pl.project13.scala.sbt.JmhPlugin.JmhKeys.Jmh | ||
import com.typesafe.sbt.packager.Keys._ | ||
import com.typesafe.sbt.packager.MappingsHelper.directory | ||
import com.typesafe.sbt.packager.universal.UniversalPlugin | ||
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.Universal | ||
import com.typesafe.sbt.packager.windows.WindowsPlugin | ||
import com.typesafe.sbt.packager.windows.WindowsPlugin.autoImport.Windows | ||
import sbt.Package.ManifestAttributes | ||
import sbt.PublishBinPlugin.autoImport._ | ||
import dotty.tools.sbtplugin.RepublishPlugin | ||
import dotty.tools.sbtplugin.RepublishPlugin.autoImport._ | ||
import sbt.plugins.SbtPlugin | ||
import sbt.ScriptedPlugin.autoImport._ | ||
import xerial.sbt.pack.PackPlugin | ||
import xerial.sbt.pack.PackPlugin.autoImport._ | ||
import xerial.sbt.Sonatype.autoImport._ | ||
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._ | ||
import org.scalajs.sbtplugin.ScalaJSPlugin | ||
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ | ||
|
||
import sbtbuildinfo.BuildInfoPlugin | ||
import sbtbuildinfo.BuildInfoPlugin.autoImport._ | ||
import sbttastymima.TastyMiMaPlugin | ||
|
@@ -88,7 +92,7 @@ object Build { | |
|
||
val referenceVersion = "3.4.2-RC1" | ||
|
||
val baseVersion = "3.5.1-RC1" | ||
val baseVersion = "3.5.1" | ||
|
||
// LTS or Next | ||
val versionLine = "Next" | ||
|
@@ -2124,25 +2128,27 @@ object Build { | |
) | ||
|
||
lazy val commonDistSettings = Seq( | ||
packMain := Map(), | ||
publishArtifact := false, | ||
packGenerateMakefile := false, | ||
republishRepo := target.value / "republish", | ||
packResourceDir += (republishRepo.value / "bin" -> "bin"), | ||
packResourceDir += (republishRepo.value / "maven2" -> "maven2"), | ||
packResourceDir += (republishRepo.value / "etc" -> "etc"), | ||
republishCommandLibs += | ||
("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core")), | ||
republishCommandLibs += | ||
("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!tasty-core")), | ||
republishCommandLibs += | ||
("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")), | ||
Compile / pack := republishPack.value, | ||
Universal / packageName := packageName.value, | ||
// ======== | ||
Universal / stage := (Universal / stage).dependsOn(republish).value, | ||
Universal / packageBin := (Universal / packageBin).dependsOn(republish).value, | ||
Universal / packageZipTarball := (Universal / packageZipTarball).dependsOn(republish).value, | ||
// ======== | ||
Universal / mappings ++= directory(republishRepo.value / "bin"), | ||
Universal / mappings ++= directory(republishRepo.value / "maven2"), | ||
Universal / mappings ++= directory(republishRepo.value / "etc"), | ||
Universal / mappings += (republishRepo.value / "VERSION") -> "VERSION", | ||
// ======== | ||
republishCommandLibs += ("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core")), | ||
republishCommandLibs += ("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!tasty-core")), | ||
republishCommandLibs += ("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")), | ||
) | ||
|
||
lazy val dist = project.asDist(Bootstrapped) | ||
.settings(packageName := "scala3-" + dottyVersion) | ||
.settings( | ||
packArchiveName := "scala3-" + dottyVersion, | ||
republishBinDir := baseDirectory.value / "bin", | ||
republishCoursier += | ||
("coursier.jar" -> s"https://github.com/coursier/coursier/releases/download/v$coursierJarVersion/coursier.jar"), | ||
|
@@ -2151,51 +2157,63 @@ object Build { | |
) | ||
|
||
lazy val `dist-mac-x86_64` = project.in(file("dist/mac-x86_64")).asDist(Bootstrapped) | ||
.settings(packageName := (dist / packageName).value + "-x86_64-apple-darwin") | ||
.settings( | ||
republishBinDir := (dist / republishBinDir).value, | ||
packArchiveName := (dist / packArchiveName).value + "-x86_64-apple-darwin", | ||
republishBinOverrides += (dist / baseDirectory).value / "bin-native-overrides", | ||
republishFetchCoursier := (dist / republishFetchCoursier).value, | ||
republishLaunchers += | ||
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-apple-darwin.gz") | ||
) | ||
|
||
lazy val `dist-mac-aarch64` = project.in(file("dist/mac-aarch64")).asDist(Bootstrapped) | ||
.settings(packageName := (dist / packageName).value + "-aarch64-apple-darwin") | ||
.settings( | ||
republishBinDir := (dist / republishBinDir).value, | ||
packArchiveName := (dist / packArchiveName).value + "-aarch64-apple-darwin", | ||
republishBinOverrides += (dist / baseDirectory).value / "bin-native-overrides", | ||
republishFetchCoursier := (dist / republishFetchCoursier).value, | ||
republishLaunchers += | ||
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-aarch64-apple-darwin.gz") | ||
) | ||
|
||
lazy val `dist-win-x86_64` = project.in(file("dist/win-x86_64")).asDist(Bootstrapped) | ||
.enablePlugins(WindowsPlugin) // TO GENERATE THE `.msi` installer | ||
.settings(packageName := (dist / packageName).value + "-x86_64-pc-win32") | ||
.settings( | ||
republishBinDir := (dist / republishBinDir).value, | ||
packArchiveName := (dist / packArchiveName).value + "-x86_64-pc-win32", | ||
republishBinOverrides += (dist / baseDirectory).value / "bin-native-overrides", | ||
republishFetchCoursier := (dist / republishFetchCoursier).value, | ||
republishExtraProps += ("cli_version" -> scalaCliLauncherVersion), | ||
mappings += (republishRepo.value / "EXTRA_PROPERTIES" -> "EXTRA_PROPERTIES"), | ||
republishLaunchers += | ||
("scala-cli.exe" -> s"zip+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersionWindows/scala-cli-x86_64-pc-win32.zip!/scala-cli.exe") | ||
) | ||
.settings( | ||
Universal / mappings += (republishRepo.value / "EXTRA_PROPERTIES" -> "EXTRA_PROPERTIES"), | ||
) | ||
.settings( | ||
Windows / name := "scala", | ||
Windows / mappings := (Universal / mappings).value, | ||
Windows / packageBin := (Windows / packageBin).dependsOn(republish).value, | ||
Windows / wixFiles := (Windows / wixFiles).dependsOn(republish).value, | ||
maintainer := "Hamza Remmal <[email protected]>", | ||
wixProductId := "74ED19C3-74FE-4ABA-AF30-55A06B6322A9", | ||
wixProductUpgradeId := "3E5A1A82-CA67-4353-94FE-5BDD400AF66B" | ||
) | ||
|
||
lazy val `dist-linux-x86_64` = project.in(file("dist/linux-x86_64")).asDist(Bootstrapped) | ||
.settings(packageName := (dist / packageName).value + "-x86_64-pc-linux") | ||
.settings( | ||
republishBinDir := (dist / republishBinDir).value, | ||
packArchiveName := (dist / packArchiveName).value + "-x86_64-pc-linux", | ||
republishBinOverrides += (dist / baseDirectory).value / "bin-native-overrides", | ||
republishFetchCoursier := (dist / republishFetchCoursier).value, | ||
republishLaunchers += | ||
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-pc-linux.gz") | ||
) | ||
|
||
lazy val `dist-linux-aarch64` = project.in(file("dist/linux-aarch64")).asDist(Bootstrapped) | ||
.settings(packageName := (dist / packageName).value + "-aarch64-pc-linux") | ||
.settings( | ||
republishBinDir := (dist / republishBinDir).value, | ||
packArchiveName := (dist / packArchiveName).value + "-aarch64-pc-linux", | ||
republishBinOverrides += (dist / baseDirectory).value / "bin-native-overrides", | ||
republishFetchCoursier := (dist / republishFetchCoursier).value, | ||
republishLaunchers += | ||
|
@@ -2333,7 +2351,7 @@ object Build { | |
settings(scala3PresentationCompilerBuildInfo) | ||
|
||
def asDist(implicit mode: Mode): Project = project. | ||
enablePlugins(PackPlugin, RepublishPlugin). | ||
enablePlugins(UniversalPlugin, RepublishPlugin). | ||
withCommonSettings. | ||
settings(commonDistSettings). | ||
dependsOn( | ||
|
@@ -2429,7 +2447,6 @@ object ScaladocConfigs { | |
} | ||
|
||
lazy val DefaultGenerationConfig = Def.task { | ||
def distLocation = (dist / Compile / pack).value | ||
DefaultGenerationSettings.value | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import com.typesafe.sbt.packager.Keys.stage | ||
import com.typesafe.sbt.packager.universal.UniversalPlugin | ||
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.Universal | ||
import sbt.* | ||
|
||
/** | ||
* @author Hamza REMMAL (https://github.com/hamzaremmal/) | ||
*/ | ||
object DistributionPlugin extends AutoPlugin { | ||
|
||
override def trigger = allRequirements | ||
|
||
override def requires = | ||
super.requires && UniversalPlugin // Require the Universal Plugin to | ||
|
||
object autoImport { | ||
val `universal_project` = settingKey[Project]("???") | ||
val `linux-aarch64_project` = settingKey[Project]("???") | ||
val `linux-x86_64_project` = settingKey[Project]("???") | ||
val `mac-aarch64_project` = settingKey[Project]("???") | ||
val `win-x86_64_project` = settingKey[Project]("???") | ||
|
||
|
||
// ========================== TASKS TO GENERATE THE FOLDER PACKAGE ============================ | ||
val `pack-universal` = | ||
taskKey[File]("Generate the package with the universal binaries (folder)") | ||
val `pack_linux-aarch64` = | ||
taskKey[File]("Generate the package with the linux-aarch64 binaries (folder)") | ||
val `pack_linux-x86_64` = | ||
taskKey[File]("Generate the package with the linux-x86_64 binaries (folder)") | ||
val `pack_mac-aarch64` = | ||
taskKey[File]("Generate the package with the mac-aarch64 binaries (folder)") | ||
val `pack_mac-x86_64` = | ||
taskKey[File]("Generate the package with the mac-x86_64 binaries (folder)") | ||
val `pack_win-x86_64` = | ||
taskKey[File]("Generate the package with the linux-x86_64 binaries (folder)") | ||
} | ||
|
||
import autoImport.* | ||
|
||
override def projectSettings = Def.settings( | ||
`pack-universal` := (`universal_project` / Universal./(stage)).value , | ||
`pack_linux-aarch64` := ???, | ||
`pack_linux-x86_64` := ???, | ||
`pack_mac-aarch64` := ???, | ||
`pack_mac-x86_64` := ???, | ||
`pack_win-x86_64` := ??? | ||
) | ||
|
||
} |
Oops, something went wrong.