Skip to content

Commit 17b0480

Browse files
authored
Add M1 Build (#3)
1 parent 0b04f22 commit 17b0480

9 files changed

Lines changed: 255 additions & 145 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ jobs:
6666
- name: Build
6767
run: ./gradlew build
6868

69+
- name: BuildArm
70+
run: ./gradlew build -Pforcealternatemacbuild
71+
6972
- uses: actions/upload-artifact@v2
7073
with:
7174
name: macOS

build.gradle

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ static def get_platform() {
1616
os_arch = 'x86_64'
1717
} else if (os_arch == 'i386') {
1818
os_arch = 'x86'
19+
} else if (os_arch == 'aarch64' || os_arch == 'arm64') {
20+
os_arch = 'arm64'
1921
}
2022

2123
if (OperatingSystem.current().isWindows()) {
@@ -48,24 +50,43 @@ static def get_platform_path(platform) {
4850
} else if (platform == "windows-x86") {
4951
return "windows/x86"
5052
} else if (platform == "windows-x86_64") {
51-
return "windows/x86-64"
53+
return "osx/x86-64"
54+
} else if (platform == "osx-arm64") {
55+
return "osx/arm64"
5256
} else {
5357
return ""
5458
}
5559
}
5660

5761
ext.platform = get_platform()
62+
if (project.hasProperty('forcealternatemacbuild')) {
63+
if (ext.platform == "osx-arm64") {
64+
ext.platform = "osx-x86_64"
65+
} else if (ext.platform == "osx-x86_64") {
66+
ext.platform = "osx-arm64"
67+
}
68+
}
5869
ext.platform_path = get_platform_path(ext.platform)
5970
ext.platform_classifier = ext.platform.replaceFirst('-', '').replace('_', '-')
6071

6172
// Get the number of processors available to build.
6273
ext.processors = Runtime.runtime.availableProcessors()
6374

6475
ext.openssl_dir = file("openssl")
65-
ext.openssl_install = file("install-openssl")
76+
ext.openssl_build_dir = file("build/$platform_path/openssl")
77+
ext.openssl_install = file("build/$platform_path/install-openssl")
6678

6779
ext.libssh_dir = file("libssh-mirror")
68-
ext.libssh_build = file("build-libssh")
80+
ext.libssh_build = file("build/$platform_path/libssh")
81+
82+
task clean {
83+
doLast {
84+
rootDir.eachDir {dir ->
85+
if (dir.name.startsWith("build") || dir.name.startsWith("install"))
86+
delete dir
87+
}
88+
}
89+
}
6990

7091
apply from: "openssl.gradle"
7192
apply from: "libssh.gradle"
@@ -82,17 +103,12 @@ ext.addTaskToCopyAllOutputs = { task ->
82103
copyAllOutputs.from task.archivePath
83104
}
84105

85-
task clean {
86-
doLast {
87-
rootDir.eachDir {dir ->
88-
if (dir.name.startsWith("build") || dir.name.startsWith("install"))
89-
delete dir
90-
}
91-
}
92-
}
93-
94106
task build {
95107
dependsOn copyAllOutputs
96108
}
97109

98-
apply from: "publish.gradle"
110+
apply from: "publish.gradle"
111+
112+
wrapper {
113+
gradleVersion = '7.5-rc-2'
114+
}

gradle/wrapper/gradle-wrapper.jar

1.52 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)