Skip to content

Commit

Permalink
Added commandline copy/unzip/untar instead of gradle API
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan Albers committed Jun 16, 2022
1 parent 587d9e0 commit d459375
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 18 deletions.
50 changes: 41 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ext {
ktor_version = "2.0.0"
gson_version = "2.8.6"
jbr_version = "11_0_6-b520.66"
osx_jdk_version = "11.0.11-9"
}

configurations {
Expand All @@ -71,6 +72,7 @@ repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://jcenter.bintray.com/") }
maven { url = uri("https://artifacts.metaborg.org/content/repositories/releases/") }
if (System.getenv('CI') != null) {
maven {
url = uri("https://itemis.blackstardlb.nl")
Expand Down Expand Up @@ -369,6 +371,7 @@ task buildFlint(type: de.itemis.mps.gradle.RunAntScript, dependsOn: generateScri
task buildFlintIde(type: de.itemis.mps.gradle.RunAntScript, dependsOn: [buildFlint, 'downloadAllJbrs']) {
script = file("$codeDir/build-IdeDistribution.xml")
targets = ["build"]
finalizedBy("bundleMacosJbr")
}

task buildFlintPlugin(type: de.itemis.mps.gradle.RunAntScript, dependsOn: buildFlint) {
Expand Down Expand Up @@ -462,28 +465,57 @@ task downloadLinuxJbr(type: Copy) {
into(downloadDir)
}

task fixMacOsSymbolicLink(group: 'jbr') {
task bundleMacosJbr() {
group = 'jbr'
def dirName = "osx"
def downloadDir = new File(jbrsDir, dirName)
doFirst {
if (!OperatingSystem.current().isWindows()) {
def symbolicLink = new File("$mpsDir/jbrs/osx/jbr/Contents/MacOS/libjli.dylib")
symbolicLink.delete()
java.nio.file.Files.createSymbolicLink(symbolicLink.toPath(), new File("../Home/lib/jli/libjli.dylib").toPath())
} else {
logger.warn('Cannot build MAC distribution on windows')
delete {
delete new File(ideDir, 'Flint.app')
}
exec {
workingDir ideDir
commandLine 'unzip', 'Flint.macos.zip'
}
def oldJbr = new File(ideDir, "Flint.app/Contents/jbr")
delete {
delete oldJbr
}
def jbr = new File(downloadDir, "jbr/Contents")
oldJbr.mkdirs()
exec {
commandLine 'cp', '-r', jbr.absolutePath, new File(oldJbr, "Contents").absolutePath
}
delete {
delete new File(ideDir, 'Flint_jbr.macos.zip')
}
exec {
workingDir ideDir
commandLine 'zip','-r', 'Flint_jbr.macos.zip', 'Flint.app'
}
}
}

task downloadMacOsJbr(type: Copy, group: 'jbr') {
finalizedBy(fixMacOsSymbolicLink)
group = 'jbr'
def dirName = "osx"
def downloadDir = new File(jbrsDir, dirName)
doFirst {
downloadDir.delete()
}
from(getConfiguration(dirName).resolve().collect { tarTree(it) })
def dependency = "net.adoptopenjdk:jdk:$osx_jdk_version:[email protected]"
def config = configurations.detachedConfiguration(project.dependencies.create(dependency))
def file = config.resolve().collect { it }[0]
from(file)
into(downloadDir)
doLast {
exec {
workingDir downloadDir
commandLine 'tar', '-xf', file.name
}
def renameFile = new File(downloadDir, "jdk-" + osx_jdk_version.replace("-", "+"))
renameFile.renameTo(downloadDir.path + "/jbr")
}
}

task downloadAllJbrs(dependsOn: [downloadWindowsJbr, downloadLinuxJbr, downloadMacOsJbr]) {
Expand Down
12 changes: 3 additions & 9 deletions code/solutions/Flint.build0/models/Flint.build.mps
Original file line number Diff line number Diff line change
Expand Up @@ -1058,10 +1058,7 @@
</node>
<node concept="3_J27D" id="2WP7dhE1ewy" role="Nbhlr">
<node concept="3Mxwew" id="2WP7dhE1ewz" role="3MwsjC">
<property role="3MwjfP" value="Flint " />
</node>
<node concept="3Mxwey" id="2WP7dhE1ew$" role="3MwsjC">
<ref role="3Mxwex" node="elgu9R8ZWn" resolve="version" />
<property role="3MwjfP" value="Flint" />
</node>
<node concept="3Mxwew" id="2WP7dhE1ew_" role="3MwsjC">
<property role="3MwjfP" value=".app" />
Expand Down Expand Up @@ -1570,11 +1567,8 @@
<node concept="3_I8Xc" id="2WP7dhE1es4" role="39821P">
<ref role="3_I8Xa" to="ffeo:I6XuqH2zYV" resolve="git4idea" />
</node>
<node concept="3_I8Xc" id="2vSShtzy63A" role="39821P">
<ref role="3_I8Xa" to="ffeo:RJsmGEig2V" resolve="mps-vcs" />
</node>
<node concept="3ygNvl" id="62tb3AVhpiO" role="39821P">
<ref role="3ygNvj" to="ffeo:1diLdO26H7E" resolve="plugins" />
<node concept="3_I8Xc" id="2xxYZHPwwr6" role="39821P">
<ref role="3_I8Xa" to="ffeo:4EdAnGErOtx" resolve="mps-core" />
</node>
<node concept="3_I8Xc" id="2WP7dhE1es6" role="39821P">
<ref role="3_I8Xa" to="ffeo:1x6h9EwqP32" resolve="mps-make" />
Expand Down

0 comments on commit d459375

Please sign in to comment.