-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathandroid.gradle
194 lines (177 loc) · 6.07 KB
/
android.gradle
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Gradle script to build/publish Libbulletjme Android artifacts
plugins {
id 'maven-publish' // to publish artifacts to Maven repositories
id 'signing' // to sign artifacts for publication
alias(libs.plugins.android.library) // to build Android libraries
alias(libs.plugins.validate.poms) // to verify POMs provide all info required by Maven Central
}
// $artifact and $lbjVersion are set in the gradle.properties file
// or by -P options on the Gradle command line.
ext {
groupID = 'com.github.stephengold'
baseName = "${artifact}-${lbjVersion}" // for artifacts
websiteUrl = 'https://github.com/stephengold/Libbulletjme'
}
android {
buildTypes {
debug {
externalNativeBuild {
ndkBuild {
cppFlags '-D_DEBUG'
//cppFlags '-DBT_ADDITIONAL_DEBUG'
//cppFlags '-DBT_DEBUG_MEMORY_ALLOCATIONS'
//cppFlags '-DDEBUG_PERSISTENCY'
//cppFlags '-DVERBOSE_RESIDUAL_PRINTF'
}
}
jniDebuggable = true
}
release {
minifyEnabled = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
compileSdk = 35
defaultConfig {
aarMetadata {
minCompileSdk = 22
}
minSdk = 22
ndk {
if (!project.hasProperty('target')) {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
} else if (target == 'Android_ARM7') {
abiFilters 'armeabi-v7a'
} else if (target == 'Android_ARM8') {
abiFilters 'arm64-v8a'
} else if (target == 'Android_X86') {
abiFilters 'x86'
} else if (target == 'Android_X86_64') {
abiFilters 'x86_64'
}
}
targetSdk = 22
}
externalNativeBuild {
ndkBuild {
path 'Android.mk'
}
}
flavorDimensions 'precision'
namespace = groupID + '.libbulletjme'
ndkVersion = '27.2.12479018' // r27c
productFlavors {
if (!project.hasProperty('flavor') || flavor == 'Dp') {
Dp { // flavor with double-precision locations
dimension 'precision'
externalNativeBuild {
ndkBuild {
cppFlags '-DBT_USE_DOUBLE_PRECISION'
}
}
}
}
if (!project.hasProperty('flavor') || flavor == 'Sp') {
Sp { // flavor with single-precision locations
dimension 'precision'
}
}
}
publishing {
multipleVariants('complete') {
allVariants()
withJavadocJar()
withSourcesJar()
}
}
}
dependencies {
testImplementation(libs.junit4)
}
// Register publishing tasks:
tasks.register('install') {
dependsOn 'publishMavenPublicationToMavenLocal'
description = 'Installs Maven artifacts to the local repository.'
}
tasks.register('release') {
dependsOn 'publishMavenPublicationToOSSRHRepository'
description = 'Stages Maven artifacts to Sonatype OSSRH.'
}
publishing {
publications {
maven(MavenPublication) {
artifactId = artifact
afterEvaluate { from components.complete }
groupId = groupID
pom {
description = 'a JNI interface for Bullet Physics and V-HACD'
developers {
developer {
email = '[email protected]'
id = 'stephengold'
name = 'Stephen Gold'
}
}
licenses {
license {
distribution = 'repo'
name = 'New BSD (3-clause) License'
url = 'https://opensource.org/licenses/BSD-3-Clause'
}
}
name = groupID + ':' + artifact
scm {
connection = 'scm:git:git://github.com/stephengold/Libbulletjme.git'
developerConnection = 'scm:git:ssh://github.com:stephengold/Libbulletjme.git'
url = websiteUrl + '/tree/master'
}
url = websiteUrl
}
version = lbjVersion
}
}
repositories {
maven { // the staging repo of Sonatype OSSRH
// Staging to OSSRH relies on the existence of 2 properties
// (ossrhUsername and ossrhPassword)
// which should be set in the ~/.gradle/gradle.properties file
// or by -P options on the command line.
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
password = project.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
}
name = 'OSSRH'
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
}
}
}
publishMavenPublicationToMavenLocal.dependsOn('assemble')
publishMavenPublicationToMavenLocal.doLast {
println 'installed locally as ' + baseName
}
// Register tasks to sign artifacts for publication:
// Signing relies on the existence of 2 properties
// (signingKeyEncoded and signingPassword)
// which should be set in the ~/.gradle/gradle.properties file
// or by -P options on the command line.
signing {
def signingKey = base64Decode(findProperty('signingKeyEncoded'))
def signingPassword = findProperty('signingPassword')
useInMemoryPgpKeys(signingKey, signingPassword)
sign configurations.archives
sign publishing.publications.maven
}
tasks.withType(Sign).configureEach {
onlyIf { project.hasProperty('signingKeyEncoded') }
}
static def base64Decode(encodedString) {
if (encodedString != null) {
byte[] decoded = encodedString.decodeBase64()
String decode = new String(decoded)
return decode
}
return null
}