Skip to content

Commit 5e24cb1

Browse files
authored
Update to gradle 8.1, enable windows arm64 builds (#16)
1 parent 47f8a4a commit 5e24cb1

9 files changed

Lines changed: 53 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ jobs:
8282
- artifact-name: Win32
8383
architecture: x86
8484
vc: vcvars32.bat
85+
- artifact-name: WinArm64
86+
architecture: x64
87+
vc: vcvarsamd64_arm64.bat
88+
build-options: "-Pforcecrossbuild=windows-arm64"
8589
name: "Build - ${{ matrix.artifact-name }}"
8690
runs-on: windows-2019
8791
steps:
@@ -99,7 +103,7 @@ jobs:
99103
- name: Build with Gradle
100104
run: |
101105
@call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\${{ matrix.vc }}"
102-
gradlew build
106+
gradlew build ${{ matrix.build-options }}
103107
shell: cmd
104108

105109
- uses: actions/upload-artifact@v2

build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
// Project Version
8-
ext.pub_version = "0.95-6"
8+
ext.pub_version = "0.95-7"
99

1010
static def get_platform() {
1111
def platform
@@ -29,6 +29,7 @@ static def get_platform() {
2929
} else {
3030
platform = "${os_name}-${os_arch}"
3131
}
32+
3233
return platform
3334
}
3435

@@ -49,6 +50,8 @@ static def get_platform_path(platform) {
4950
return "windows/x86"
5051
} else if (platform == "windows-x86_64") {
5152
return "windows/x86-64"
53+
} else if (platform == "windows-arm64") {
54+
return "windows/arm64"
5255
} else {
5356
return ""
5457
}
@@ -101,8 +104,8 @@ task copyAllOutputs(type: Copy) {
101104

102105
ext.addTaskToCopyAllOutputs = { task ->
103106
copyAllOutputs.dependsOn task
104-
copyAllOutputs.inputs.file task.archivePath
105-
copyAllOutputs.from task.archivePath
107+
copyAllOutputs.inputs.file task.archiveFile
108+
copyAllOutputs.from task.archiveFile
106109
}
107110

108111
task build {
@@ -112,5 +115,5 @@ task build {
112115
apply from: "publish.gradle"
113116

114117
wrapper {
115-
gradleVersion = '7.5.1'
118+
gradleVersion = '8.1'
116119
}

gradle/wrapper/gradle-wrapper.jar

1.29 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libssh.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ types.each { type ->
5050
workingDir build_dir
5151
environment "OPENSSL_ROOT_DIR": "${project.openssl_install}"
5252

53+
def platformArg = "x64"
54+
if (project.platform == "windows-x86") {
55+
platformArg = "Win32"
56+
} else if (project.platform == "windows-arm64") {
57+
platformArg = "arm64"
58+
}
59+
5360
// Add the arch specifier for Windows.
5461
if (project.platform.contains("windows")) {
5562
args "-A"
56-
args project.platform == "windows-x86" ? "Win32" : "x64"
63+
args platformArg
5764
}
5865

5966
dependsOn prepareLibSshirectories
@@ -74,10 +81,16 @@ types.each { type ->
7481
args "--build", ".", "--parallel", "${project.processors}"
7582
workingDir build_dir
7683

84+
def platformArg = "/p:Platform=x64"
85+
if (project.platform == "windows-x86") {
86+
platformArg = "/p:Platform=win32"
87+
} else if (project.platform == "windows-arm64") {
88+
platformArg = "/p:Platform=arm64"
89+
}
90+
7791
// Specify arch and build type on Windows.
7892
if (project.platform.contains("windows")) {
79-
args "--", "/p:Configuration=$type", "/v:m",
80-
project.platform == "windows-x86" ? "/p:Platform=win32" : "/p:Platform=x64"
93+
args "--", "/p:Configuration=$type", "/v:m", platformArg
8194
}
8295
}
8396
}

openssl.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ project.tasks.create("configureOpenSSL", Exec) {
1717

1818
// Add the arch specifier for Windows.
1919
if (project.platform.contains("windows")) {
20-
args project.platform == "windows-x86" ? "VC-WIN32" : "VC-WIN64A"
20+
if (project.platform == "windows-x86") {
21+
args "VC-WIN32"
22+
} else if (project.platform == "windows-arm64") {
23+
args "VC-WIN64-ARM"
24+
} else {
25+
args "VC-WIN64A"
26+
}
2127
} else if (project.platform == "osx-arm64") {
2228
args "darwin64-arm64-cc"
2329
environment "ARCHFLAGS", "-arch arm64"

publish.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ task cppHeadersZip(type: Zip) {
3636

3737
destinationDirectory = outputs_dir
3838
archiveBaseName = zip_base_name
39-
classifier = "headers"
39+
archiveClassifier = "headers"
4040

4141
// Copy license files.
4242
from(libssh_license_file) {
@@ -72,7 +72,7 @@ task cppSourcesZip(type: Zip) {
7272

7373
destinationDirectory = outputs_dir
7474
archiveBaseName = zip_base_name
75-
classifier = "sources"
75+
archiveClassifier = "sources"
7676

7777
// Copy license files.
7878
from(libssh_license_file) {
@@ -104,7 +104,7 @@ types.each { type ->
104104

105105
destinationDirectory = outputs_dir
106106
archiveBaseName = zip_base_name
107-
classifier = project.platform_classifier + "static" + type.toLowerCase().replace("release", "")
107+
archiveClassifier = project.platform_classifier + "static" + type.toLowerCase().replace("release", "")
108108

109109
// Copy license files.
110110
from(libssh_license_file) {

0 commit comments

Comments
 (0)