|
| 1 | +import com.typesafe.sbt.packager.Keys.stage |
| 2 | +import com.typesafe.sbt.packager.universal.UniversalPlugin |
| 3 | +import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.Universal |
| 4 | +import sbt.* |
| 5 | + |
| 6 | +/** |
| 7 | + * @author Hamza REMMAL (https://github.com/hamzaremmal/) |
| 8 | + */ |
| 9 | +object DistributionPlugin extends AutoPlugin { |
| 10 | + |
| 11 | + override def trigger = allRequirements |
| 12 | + |
| 13 | + override def requires = |
| 14 | + super.requires && UniversalPlugin // Require the Universal Plugin to |
| 15 | + |
| 16 | + object autoImport { |
| 17 | + val `universal_project` = settingKey[Project]("???") |
| 18 | + val `linux-aarch64_project` = settingKey[Project]("???") |
| 19 | + val `linux-x86_64_project` = settingKey[Project]("???") |
| 20 | + val `mac-aarch64_project` = settingKey[Project]("???") |
| 21 | + val `win-x86_64_project` = settingKey[Project]("???") |
| 22 | + |
| 23 | + |
| 24 | + // ========================== TASKS TO GENERATE THE FOLDER PACKAGE ============================ |
| 25 | + val `pack-universal` = |
| 26 | + taskKey[File]("Generate the package with the universal binaries (folder)") |
| 27 | + val `pack_linux-aarch64` = |
| 28 | + taskKey[File]("Generate the package with the linux-aarch64 binaries (folder)") |
| 29 | + val `pack_linux-x86_64` = |
| 30 | + taskKey[File]("Generate the package with the linux-x86_64 binaries (folder)") |
| 31 | + val `pack_mac-aarch64` = |
| 32 | + taskKey[File]("Generate the package with the mac-aarch64 binaries (folder)") |
| 33 | + val `pack_mac-x86_64` = |
| 34 | + taskKey[File]("Generate the package with the mac-x86_64 binaries (folder)") |
| 35 | + val `pack_win-x86_64` = |
| 36 | + taskKey[File]("Generate the package with the linux-x86_64 binaries (folder)") |
| 37 | + } |
| 38 | + |
| 39 | + import autoImport.* |
| 40 | + |
| 41 | + override def projectSettings = Def.settings( |
| 42 | + `pack-universal` := (`universal_project` / Universal./(stage)).value , |
| 43 | + `pack_linux-aarch64` := ???, |
| 44 | + `pack_linux-x86_64` := ???, |
| 45 | + `pack_mac-aarch64` := ???, |
| 46 | + `pack_mac-x86_64` := ???, |
| 47 | + `pack_win-x86_64` := ??? |
| 48 | + ) |
| 49 | + |
| 50 | +} |
0 commit comments