From 5ad31322a6446f1919254a0bd07bd004da54645d Mon Sep 17 00:00:00 2001 From: Hamza REMMAL Date: Tue, 11 Jun 2024 15:58:00 +0100 Subject: [PATCH] first trial to build the msi --- .github/workflows/build-msi.yml | 26 +++++++++++++++++ project/Build.scala | 1 + project/DistributionPlugin.scala | 50 ++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .github/workflows/build-msi.yml create mode 100644 project/DistributionPlugin.scala diff --git a/.github/workflows/build-msi.yml b/.github/workflows/build-msi.yml new file mode 100644 index 000000000000..8812ec4d9f5c --- /dev/null +++ b/.github/workflows/build-msi.yml @@ -0,0 +1,26 @@ + +name: Build the MSI Package + +on: + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '11' + cache: 'sbt' + - name: Build MSI package + run: | + sbt 'dist-win-x86/Windows/packageBin' + - name: Upload MSI Artifact + uses: actions/upload-artifact@v3 + with: + name: scala.msi + path: ./dist/win-x86_64/target/windows/ diff --git a/project/Build.scala b/project/Build.scala index fc16f5ba8a43..c601b09e7f73 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -2181,6 +2181,7 @@ object Build { Universal / mappings += (republishRepo.value / "etc" / "EXTRA_PROPERTIES" -> "EXTRA_PROPERTIES"), ) .settings( + Windows / name := "scala", Windows / mappings := (Universal / mappings).value, maintainer := "Josh Suereth ", packageSummary := "test-windows", diff --git a/project/DistributionPlugin.scala b/project/DistributionPlugin.scala new file mode 100644 index 000000000000..473ecd8378af --- /dev/null +++ b/project/DistributionPlugin.scala @@ -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` := ??? + ) + +}