Skip to content

Commit

Permalink
Force jlink command to run on external JDK
Browse files Browse the repository at this point in the history
  • Loading branch information
udda1996 committed Mar 9, 2023
1 parent c4aae6d commit 91e557b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -47,7 +47,7 @@ jobs:
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: ./gradlew.bat build --scan
- name: MacOS Build
if: matrix.os == 'macOS-latest'
if: matrix.os == 'macos-latest'
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
Expand Down
26 changes: 17 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,34 @@ task extractJdkForMacARM(type: Copy, dependsOn: downloadJdkforMacARM) {

task assembleJreForLinux(type: Exec, dependsOn: extractJdkForLinux) {
workingDir "$buildDir/temp/extracted/jdk-linux/jdk-${project.jdkVersion}/bin"
commandLine 'jlink', '--module-path', "$buildDir/temp/extracted/jdk-linux/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules, '--output', "$buildDir/temp/generated/ballerina-jre-linux-64"
commandLine "$buildDir/temp/extracted/jdk-linux/jdk-${project.jdkVersion}/bin/jlink",
'--module-path', "$buildDir/temp/extracted/jdk-linux/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules,
'--output', "$buildDir/temp/generated/ballerina-jre-linux-64"
}

task assembleJreForWindows(type: Exec, dependsOn: extractJdkForWindows) {
workingDir "$buildDir/temp/extracted/jdk-windows/jdk-${project.jdkVersion}/bin"
commandLine 'cmd', "/c", 'jlink.exe', '--module-path', "$buildDir/temp/extracted/jdk-windows/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules, '--output', "$buildDir/temp/generated/ballerina-jre-windows-64"
commandLine "$buildDir/temp/extracted/jdk-windows/jdk-${project.jdkVersion}/bin/jlink",
'--module-path', "$buildDir/temp/extracted/jdk-windows/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules,
'--output', "$buildDir/temp/generated/ballerina-jre-windows-64"
}

task assembleJreForMac(type: Exec, dependsOn: extractJdkForMac) { // Check for Content/Home directory
workingDir "$buildDir/temp/extracted/jdk-macos/jdk-${project.jdkVersion}/Contents/Home/bin"
commandLine 'jlink','--module-path', "$buildDir/temp/extracted/jdk-macos/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules, '--output', "$buildDir/temp/generated/ballerina-jre-macos-64"
commandLine "$buildDir/temp/extracted/jdk-macos/jdk-${project.jdkVersion}/Contents/Home/bin/jlink",
'--module-path', "$buildDir/temp/extracted/jdk-macos/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules,
'--output', "$buildDir/temp/generated/ballerina-jre-macos-64"
}

task assembleJreForMacARM(type: Exec, dependsOn: extractJdkForMacARM) { // Check for Content/Home directory
workingDir "$buildDir/temp/extracted/jdk-macos-arm/jdk-${project.jdkVersion}/Contents/Home/bin"
commandLine 'jlink','--module-path', "$buildDir/temp/extracted/jdk-macos-arm/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules, '--output', "$buildDir/temp/generated/ballerina-jre-macos-arm-64"
commandLine "$buildDir/temp/extracted/jdk-macos/jdk-${project.jdkVersion}/Contents/Home/bin/jlink",
'--module-path', "$buildDir/temp/extracted/jdk-macos-arm/jdk-${project.jdkVersion}/jmods",
'--add-modules', jdkModules,
'--output', "$buildDir/temp/generated/ballerina-jre-macos-arm-64"
}

task packageJreForLinux(type: Zip, dependsOn: assembleJreForLinux) {
Expand Down Expand Up @@ -156,8 +164,8 @@ if (moduleVersion.indexOf('-') != -1) {

task build {
if (Os.isFamily(Os.FAMILY_MAC)) {
dependsOn packageJreForMacARM
dependsOn packageJreForMac
// dependsOn packageJreForMacARM
} else if (Os.isFamily(Os.FAMILY_UNIX)) {
dependsOn packageJreForLinux
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
Expand Down

0 comments on commit 91e557b

Please sign in to comment.