Actually make headless work on arm aarch64

Following the two comments at
https://code.briarproject.org/briar/briar/-/issues/1854#note_44340

.jar files now get built with

    $ ./gradlew --configure-on-demand briar-headless:x86LinuxJar
    $ ./gradlew --configure-on-demand briar-headless:aarch64LinuxJar

Related to #1854
This commit is contained in:
Nico Alt
2021-03-03 12:00:00 +00:00
parent c5d2661c1d
commit b738bdd14e
3 changed files with 37 additions and 7 deletions

View File

@@ -44,18 +44,32 @@ dependencies {
kaptTest "com.google.dagger:dagger-compiler:$daggerVersion"
}
jar {
manifest {
void jarFactory(Jar jarTask, jarArchitecture) {
jarTask.doFirst {
println 'Building ' + jarArchitecture + ' version has started'
}
jarTask.manifest {
attributes(
'Main-Class': 'org.briarproject.briar.headless.MainKt'
)
}
from {
jarTask.setArchiveClassifier(jarArchitecture)
jarTask.from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
doLast() {
{
String[] architectures = ["linux-aarch64", "linux-x86_64"]
for (String arch : architectures) {
if (arch != jarArchitecture) {
exclude "obfs4proxy_" + arch + ".zip"
exclude "tor_" + arch + ".zip"
}
}
}
jarTask.with jar
jarTask.doLast {
// Rename the original jar
File jar = project.jar.archivePath
File jar = jarTask.archivePath
String srcPath = jar.toString().replaceFirst('\\.jar$', '.unsorted.jar')
File srcFile = new File(srcPath)
jar.renameTo(srcFile)
@@ -80,9 +94,18 @@ jar {
}
destStream.close()
srcJarFile.close()
println 'Building ' + jarArchitecture + ' version has finished'
}
}
task aarch64LinuxJar(type: Jar) {
jarFactory(it, 'linux-aarch64')
}
task x86LinuxJar(type: Jar) {
jarFactory(it, 'linux-x86_64')
}
// At the moment for non-Android projects we need to explicitly mark the code generated by kapt
// as 'generated source code' for correct highlighting and resolve in IDE.
idea {