Skip to content

Commit

Permalink
fix/restructure rcp build (#124)
Browse files Browse the repository at this point in the history
* safety.distribution.build: added model for startup scripts, added plarform specific builds

* safety.build: restructured to enable building for different platforms

* safety.build: various fixes in the build scripts on the mps side

* build.gradle.kts: re-written publications
  • Loading branch information
danielratiu authored Dec 22, 2024
1 parent 9f067f6 commit 0f142e7
Show file tree
Hide file tree
Showing 5 changed files with 1,682 additions and 633 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Build
run: |
xvfb-run ./gradlew package_fasten_safety_distribution_win build_all_languages check \
xvfb-run ./gradlew build_all_languages check \
-Pgpr.user=${{github.actor}} -Pgpr.token=${{ secrets.GITHUB_TOKEN }}
- name: Publish test report
Expand Down Expand Up @@ -68,11 +68,11 @@ jobs:
exit 1
fi
- name: Upload distribution
uses: actions/upload-artifact@v4
with:
name: fasten-distribution-win-2023.2-${{ steps.time.outputs.time }}
path: build/distributions/fasten-2023.2-SNAPSHOT-Win-2023.2-SNAPSHOT.zip
#- name: Upload distribution
# uses: actions/upload-artifact@v4
# with:
# name: fasten-distribution-win-2023.2-${{ steps.time.outputs.time }}
# path: build/distributions/fasten-2023.2-SNAPSHOT-Win-2023.2-SNAPSHOT.zip

publish:
# Only publish on push (to maintenance or master) or on dispatch if requested
Expand Down
73 changes: 38 additions & 35 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plugins {

val jbrVers = "17.0.8.1-b1000.32"
val jbrWindowsVers = "jbr_jcef-17.0.8.1-windows-x64-b1000.32"
val jbrLinuxVers = "jbr_jcef-17.0.8.1-linux-x64-b1000.32"

downloadJbr {
jbrVersion = jbrVers
Expand Down Expand Up @@ -162,6 +163,16 @@ val defaultScriptArgs = mapOf(

fun scriptFile(relativePath: String):File = File("$rootDir/build/scripts/patched/$relativePath")

fun unpackAndRenameJBR(archiveName : String, nameOfDirectoryInsideArchive : String, nameOfJbrDirectory : String) {
val jbrDownloadDir = jdkDir.toString() + "/../jbrDownload";
//project.delete(files("${jbrDownloadDir}"));
copy {
from(tarTree(resources.gzip(jdkDir.toString() + "/${archiveName}")))
into(jbrDownloadDir)
}
file(jbrDownloadDir + "/${nameOfDirectoryInsideArchive}").renameTo(file("${jbrDownloadDir}/${nameOfJbrDirectory}"))
}

tasks {
val configureJava by registering {
dependsOn(downloadJbr)
Expand Down Expand Up @@ -355,49 +366,41 @@ tasks {
val resolvedArtifact = configurations["jbrWin"].resolvedConfiguration.resolvedArtifacts.find { ra -> ra.file.name == filename }!!
resolvedArtifact.name + "-" + resolvedArtifact.classifier + "." + resolvedArtifact.extension
}
}

val unpackDistribution by registering(Copy::class) {
from(zipTree("$artifactsDir/com.mbeddr.formal.safetyDistribution/fasten-${version}.zip"))
into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp")
}

val deleteJBR by registering(Delete::class) {
dependsOn(unpackDistribution)
delete("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/jbr/")
doLast {
unpackAndRenameJBR("jbr_jcef-windows-x64.tgz", jbrWindowsVers, "jbr_windows");
}
}

val fix_JNA_for_Windows by registering(Copy::class) {
dependsOn(unpackDistribution)
from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/lib/jna/amd64/")
into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/lib/jna/")
}
val resolveJBR_Linux by registering(Copy::class) {
from(configurations["jbrLinux"])
into(jdkDir)
rename { filename ->
val resolvedArtifact = configurations["jbrLinux"].resolvedConfiguration.resolvedArtifacts.find { ra -> ra.file.name == filename }!!
resolvedArtifact.name + "-" + resolvedArtifact.classifier + "." + resolvedArtifact.extension
}

val fix_BIN_for_Windows by registering(Copy::class) {
dependsOn(unpackDistribution)
from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/bin/win/")
into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/bin/")
doLast {
unpackAndRenameJBR("jbr_jcef-linux-x64.tgz", jbrLinuxVers, "jbr_linux");
}
}

val unpack_windows_JBR by registering(Copy::class) {
dependsOn(resolveJBR_Win, deleteJBR, fix_JNA_for_Windows, fix_BIN_for_Windows)
from(tarTree("$jdkDir/jbr_jcef-windows-x64.tgz"))
into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp")
val package_fasten_distribution_for_specific_platforms by registering(BuildLanguages::class) {
dependsOn(resolveJBR_Win, resolveJBR_Linux, build_fasten_safety_distribution)
script = scriptFile("build-fasten-distribution-for-specific-platforms.xml")
}

val package_fasten_safety_distribution_win by registering(Zip::class) {
dependsOn(resolveJBR_Win, build_fasten_safety_distribution, unpack_windows_JBR)
archiveBaseName.set("fasten-${version}-Win")
from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/")
from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/$jbrWindowsVers") {
into("jbr")
}
val produce_fasten_distribution_win by registering(Zip::class) {
dependsOn(package_fasten_distribution_for_specific_platforms)
from(zipTree(artifactsDir.file("com.mbeddr.formal.safetyDistribution.platforms/fasten-${version}-Win.zip")))
destinationDirectory = artifactsDir
}

val package_fasten_safety_distribution_linux by registering(Zip::class) {
dependsOn(build_fasten_safety_distribution)
archiveBaseName.set("fasten-${version}-Linux")
from("$artifactsDir/com.mbeddr.formal.safetyDistribution/fasten-${version}.zip")
val produce_fasten_distribution_linux by registering(Tar::class) {
//dependsOn(package_fasten_distribution_for_specific_platforms)
compression = Compression.GZIP
from(tarTree(artifactsDir.file("com.mbeddr.formal.safetyDistribution.platforms/fasten-${version}-Linux.tar.gz")))
destinationDirectory = artifactsDir
}

val build_all_languages by registering {
Expand Down Expand Up @@ -540,12 +543,12 @@ publishing {
create<MavenPublication>("FASTEN_WIN_RCP") {
groupId = "fasten"
artifactId = "win.rcp"
artifact(tasks.named("package_fasten_safety_distribution_win"))
artifact(tasks.named("produce_fasten_distribution_win"))
}
create<MavenPublication>("FASTEN_LINUX_RCP") {
groupId = "fasten"
artifactId = "linux.rcp"
artifact(tasks.named("package_fasten_safety_distribution_linux"))
artifact(tasks.named("produce_fasten_distribution_linux"))
}
}
}
Expand Down
1 change: 1 addition & 0 deletions build/scripts/build_all_scripts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<language id="l:798100da-4f0a-421a-b991-71f8c50ce5d2:jetbrains.mps.build" />
<language id="l:0cf935df-4699-4e9c-a132-fa109541cba3:jetbrains.mps.build.mps" />
<language id="l:3600cb0a-44dd-4a5b-9968-22924406419e:jetbrains.mps.build.mps.tests" />
<language id="l:d5033cee-f632-44b6-b308-89d4fbde34ff:jetbrains.mps.build.startup" />
</uses>
<classpath>
<entry path="." />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<language slang="l:798100da-4f0a-421a-b991-71f8c50ce5d2:jetbrains.mps.build" version="0" />
<language slang="l:0cf935df-4699-4e9c-a132-fa109541cba3:jetbrains.mps.build.mps" version="7" />
<language slang="l:3600cb0a-44dd-4a5b-9968-22924406419e:jetbrains.mps.build.mps.tests" version="1" />
<language slang="l:d5033cee-f632-44b6-b308-89d4fbde34ff:jetbrains.mps.build.startup" version="0" />
<language slang="l:ceab5195-25ea-4f22-9b92-103b95ca8c0c:jetbrains.mps.lang.core" version="2" />
</languageVersions>
<dependencyVersions>
Expand Down
Loading

0 comments on commit 0f142e7

Please sign in to comment.