Files
threadcount-community/android/app/build.gradle
T
ThreadCount 057da00fd2 ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from e2d6d42 on 2026-09-13. Licensed under the Functional Source License (FSL-1.1-ALv2).
2026-09-13 11:16:36 +10:00

117 lines
5.5 KiB
Groovy

apply plugin: 'com.android.application'
// Release signing. The keystore and its password live in ~/threadcount-keys, outside the repo —
// nothing secret is ever committed. Without that file the release build is simply unsigned, so a
// fresh clone still builds a debug APK.
def keystorePropsFile = file("${System.getProperty('user.home')}/threadcount-keys/keystore.properties")
def keystoreProps = new Properties()
if (keystorePropsFile.exists()) {
keystorePropsFile.withInputStream { keystoreProps.load(it) }
}
android {
namespace "tech.threadcount.app"
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "tech.threadcount.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
// Play permanently reserves a version code the moment a bundle is uploaded, even to a
// discarded draft — it can never be reused. Bump this for EVERY upload, not every release.
// 1 was spent on the build with the missing camera permission; 2 on the one before
// onboarding was bundled. 3, 4 and 5 went to Play as drafts — a code is reserved the
// moment Play ingests a bundle, warnings and all. 6 adds the mapping file and the native
// debug symbols Play asked for.
versionCode 10
versionName "1.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
signingConfigs {
release {
if (keystoreProps['storeFile']) {
storeFile file(keystoreProps['storeFile'])
storePassword keystoreProps['storePassword']
keyAlias keystoreProps['keyAlias']
keyPassword keystoreProps['keyPassword']
}
}
}
buildTypes {
release {
if (keystoreProps['storeFile']) {
signingConfig signingConfigs.release
}
// R8 shrinks and obfuscates, and Gradle folds the resulting mapping.txt into the
// bundle, which is what lets Play symbolicate a stack trace instead of showing
// a.b.c(). Capacitor ships its plugin keep-rules as consumerProguardFiles, so the
// classes the bridge loads reflectively survive; proguard-rules.pro pins the rest.
//
// Resource shrinking is deliberately left off: the onboarding splash and welcome are
// plain files under assets/, which resource shrinking never inspects, so it would
// trade a real risk for almost no bytes.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Play warns that a bundle with native code has no debug symbols. ThreadCount has no
// native code of its own: all three .so files arrive pre-stripped inside Google's
// MLKit and CameraX AARs, and llvm-objcopy --only-keep-debug pulls zero .debug_* and
// zero .symtab sections out of them. So this currently emits nothing, and there is
// nothing it could emit — the warning is unfixable rather than unfixed. It stays
// configured so that the day ThreadCount does ship its own native code, the symbols
// go with it without anyone having to remember.
ndk {
debugSymbolLevel 'FULL'
}
}
}
// Devices from Android 15 can run 16 KB memory pages, and Play refuses uploads whose native
// libraries are only 4 KB-aligned. Uncompressed + page-aligned .so files satisfy both.
packaging {
jniLibs {
useLegacyPackaging false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
// WebViewCompat / WebViewFeature, for MainActivity.giveTheSiteTheBridge(). The Capacitor
// module has this as an implementation dependency, which does not reach this module.
implementation "androidx.webkit:webkit:$androidxWebkitVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}