-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
97 lines (86 loc) · 3.1 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* SPDX-FileCopyrightText: 2024 Niklas Wimmer <[email protected]>
* SPDX-License-Identifier: MIT-0
*/
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
id("uniffi")
}
/*
* You can change the group to whatever you like, just make sure to also adjust your dependency
* declaration if you do.
*/
group = "me.nwimmer.unofficial.iroh"
version = "0.28.1"
uniffi {
cargoManifestDir.set(layout.projectDirectory.dir("iroh-ffi"))
/*
* Can not reuse upstream config because it does not include `bindings.kotlin.android = true`.
*/
uniffiConfigFile.set(layout.projectDirectory.file("uniffi.toml"))
libraryName.set("iroh_ffi")
/*
* This is a compromise between reducing the time it takes to build the library and the out of
* the box experience when including this build script without modifying it.
* Chances are your personal mobile phone's CPU supports 64-bit (in fact, it may *not* have
* support for 32-bit applications if it is a recent one) and your development machine supports
* 64-bit as well. Therefore, the library is only compiled for 64-bit targets by default under
* the assumption that this will cause no problem for most people. The benefit is that build
* times are almost halved.
* If you want maximum compatibility or just have other ABI requirements, you will need to
* modify this line (or remove it to build for all four targets).
*/
targets.set(listOf(Target.ARM64, Target.X86_64))
}
java {
toolchain {
/*
* Java 21 toolchains have only deprecated support for a targeting Java 8, to get rid of
* that warning force the toolchain to be the latest LTS version that still has full support
* for Java 8.
*/
languageVersion = JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion)
}
}
android {
namespace = "${project.group}"
compileSdk = 35
defaultConfig {
/*
* By increasing this you may be able to also increase the target Java version and disable
* desugaring. Consult Android documentation for more info or just try what builds and what
* fails with an error.
*/
minSdk = 24
version = project.version
}
compileOptions {
// see comment on kotlinOptions.jvmTarget
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// parts of the generated code need to be desugared to be compatible with our minSdk
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
/*
* Android SDK version 24 (i.e. Android 7 "Nougat"), the current minSdk, only supports
* Java 8.
*/
jvmTarget = "${JavaVersion.VERSION_1_8}"
}
}
dependencies {
/*
* These three libraries are required by UniFFI.
*/
implementation(libs.jna) {
artifact {
name = "jna"
type = "aar"
}
}
implementation(libs.kotlinx.coroutines)
implementation(libs.androidx.annotation)
coreLibraryDesugaring(libs.android.desugar)
}