Skip to content

Commit 56c131e

Browse files
committed
Test.
1 parent 360e7e9 commit 56c131e

File tree

2 files changed

+98
-24
lines changed

2 files changed

+98
-24
lines changed

.github/workflows/gradle.yml

+41-15
Original file line numberDiff line numberDiff line change
@@ -72,43 +72,69 @@ jobs:
7272
env:
7373
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
7474

75-
build_mac:
75+
build_mac_arm:
7676
runs-on: macos-latest
77-
7877
defaults:
7978
run:
8079
shell: bash
81-
8280
steps:
83-
- name: Clone.
81+
- name: Clone
8482
uses: actions/checkout@v1
8583

86-
- name: Set up JDK
84+
- name: Set up JDK (ARM64)
8785
uses: actions/setup-java@v3
8886
with:
8987
distribution: 'temurin'
9088
java-version: '17'
89+
architecture: arm64
9190

92-
- name: Set up version of Chatty.
91+
- name: Set up version of Chatty
9392
run: |
9493
git checkout test_ci
9594
echo `which jpackage`
9695
97-
- name: Build with Gradle.
96+
- name: Build with Gradle (ARM64)
9897
run: |
9998
./gradlew build && \
10099
./gradlew release && \
101-
./gradlew jpackageMac -PjpackagePath=`which jpackage`
100+
./gradlew jpackageMacArm -PjpackagePath=`which jpackage`
101+
102+
- name: Upload Artifacts (ARM64)
103+
uses: actions/[email protected]
104+
with:
105+
name: Chatty-Build-${{ env.NEW_TAG_TEXT }}-arm64
106+
path: build/jpackage-mac/*
107+
108+
build_mac_intel:
109+
runs-on: macos-latest
110+
defaults:
111+
run:
112+
shell: bash
113+
steps:
114+
- name: Clone
115+
uses: actions/checkout@v1
116+
117+
- name: Set up JDK (x64)
118+
uses: actions/setup-java@v3
119+
with:
120+
distribution: 'temurin'
121+
java-version: '17'
122+
architecture: x64
102123

103-
ls build
104-
echo "===="
105-
ls build/releases
106-
echo "===="
107-
ls build/jpackage-mac
124+
- name: Set up version of Chatty
125+
run: |
126+
git checkout test_ci
127+
echo `which jpackage`
128+
129+
- name: Build with Gradle (x64)
130+
run: |
131+
./gradlew build && \
132+
./gradlew release && \
133+
./gradlew jpackageMacIntel -PjpackagePath=`which jpackage`
108134
109-
- name: Upload Artifacts
135+
- name: Upload Artifacts (x64)
110136
uses: actions/[email protected]
111137
with:
112-
name: Chatty-Build-${{ env.NEW_TAG_TEXT }}
138+
name: Chatty-Build-${{ env.NEW_TAG_TEXT }}-x64
113139
path: build/jpackage-mac/*
114140

build.gradle

+57-9
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ task releaseWinSetups(group: 'build') {
321321

322322
def macBundleTarget = new File(buildDir, 'jpackage-mac')
323323

324-
task jpackageMac(type: Exec, group: 'build') {
324+
task jpackageMacArm(type: Exec, group: 'build') {
325325
dependsOn shadowJar
326326

327327
def macVersion = '1.0.7' // default
@@ -346,29 +346,77 @@ task jpackageMac(type: Exec, group: 'build') {
346346

347347
def command = [jpackageExec,
348348
'--type', 'app-image',
349-
'--name', 'Chatty',
349+
'--name', 'Chatty-arm64',
350350
'--input', new File(macBundleTarget, 'input'),
351351
'--main-jar', 'Chatty.jar',
352352
'--main-class', 'chatty.Chatty',
353353
'--dest', macBundleTarget,
354-
'--description', 'Chatty - Twitch Chat Client',
354+
'--description', 'Chatty - Twitch Chat Client (ARM64)',
355355
'--java-options', '-Xmx600M',
356356
'--icon', 'assets-bundle/Chatty.icns',
357357
'--app-version', macVersion,
358-
'--vendor', 'Chatty']
358+
'--vendor', 'Chatty',
359+
'--mac-package-identifier', 'chatty.client.arm64']
359360

360361
commandLine command
361362
}
362363

363-
task packageApp(type: Zip) {
364-
dependsOn jpackageMac
365-
from("${macBundleTarget}/Chatty.app")
366-
archiveFileName = "Chatty_${version}_mac.app.zip"
364+
task jpackageMacIntel(type: Exec, group: 'build') {
365+
dependsOn shadowJar
366+
367+
def macVersion = '1.0.7' // default
368+
369+
doFirst {
370+
delete macBundleTarget
371+
copy {
372+
from tasks.shadowJar.archivePath
373+
into new File(macBundleTarget, 'input')
374+
}
375+
376+
def versionParts = project.version.replaceAll(/[^0-9.]/, '').split(/\./)
377+
macVersion = (versionParts.size() >= 3) ?
378+
"${versionParts[0]}.${versionParts[1]}.${versionParts[2]}" :
379+
(versionParts.size() == 2) ? "${versionParts[0]}.${versionParts[1]}.0" :
380+
"${versionParts[0]}.0.0"
381+
382+
if (macVersion == '..0') macVersion = '1.0.7'
383+
}
384+
385+
def jpackageExec = project.hasProperty('jpackagePath') ? jpackagePath : 'jpackage'
386+
387+
def command = [jpackageExec,
388+
'--type', 'app-image',
389+
'--name', 'Chatty-x64',
390+
'--input', new File(macBundleTarget, 'input'),
391+
'--main-jar', 'Chatty.jar',
392+
'--main-class', 'chatty.Chatty',
393+
'--dest', macBundleTarget,
394+
'--description', 'Chatty - Twitch Chat Client (Intel)',
395+
'--java-options', '-Xmx600M',
396+
'--icon', 'assets-bundle/Chatty.icns',
397+
'--app-version', macVersion,
398+
'--vendor', 'Chatty',
399+
'--mac-package-identifier', 'chatty.client.x64']
400+
401+
commandLine command
402+
}
403+
404+
task packageAppArm(type: Zip) {
405+
dependsOn jpackageMacArm
406+
from("${macBundleTarget}/Chatty-arm64.app")
407+
archiveFileName = "Chatty_${version}_mac_arm64.app.zip"
408+
destinationDirectory = releasesDir
409+
}
410+
411+
task packageAppIntel(type: Zip) {
412+
dependsOn jpackageMacIntel
413+
from("${macBundleTarget}/Chatty-x64.app")
414+
archiveFileName = "Chatty_${version}_mac_x64.app.zip"
367415
destinationDirectory = releasesDir
368416
}
369417

370418
task releaseMacSetups(group: 'build') {
371-
dependsOn packageApp
419+
dependsOn packageAppArm, packageAppIntel
372420
}
373421

374422
//---------

0 commit comments

Comments
 (0)