aboutsummaryrefslogtreecommitdiff
path: root/app/build.gradle
blob: 17768b053b1774e1134094deabea264824615a71 (plain) (blame)
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
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

// Release signing is configured only if a local keystore.properties exists
// (gitignored). Otherwise the release build is unsigned, which is what F-Droid
// and reproducible-build verification want.
def keystoreProps = rootProject.file('keystore.properties')

android {
    namespace 'invalid.lena.rsend'
    compileSdk 35
    buildToolsVersion '35.0.0'

    defaultConfig {
        applicationId 'invalid.lena.rsend'
        minSdk 30
        targetSdk 35
        versionCode 5
        versionName '0.2.0'
        // Ship only the ABIs the native build scripts produce (ABIS in versions).
        ndk { abiFilters 'arm64-v8a', 'x86_64' }
    }

    signingConfigs {
        if (keystoreProps.exists()) {
            def props = new Properties()
            keystoreProps.withInputStream { props.load(it) }
            release {
                storeFile rootProject.file(props['storeFile'])
                storePassword props['storePassword']
                keyAlias props['keyAlias']
                keyPassword props['keyPassword']
                // Include v1 (JAR) signing too; some sideload installers
                // (Samsung One UI on Android 11/12) reject v2-only APKs with
                // "problem parsing the package".
                enableV1Signing true
                enableV2Signing true
                enableV3Signing true
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            // Do not stamp the git revision into the APK. It makes two builds
            // of the same source differ by checkout state, which is exactly
            // what reproducible-build verification is supposed to detect.
            vcsInfo {
                include false
            }
            if (keystoreProps.exists()) {
                signingConfig signingConfigs.release
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }

    buildFeatures {
        buildConfig true
    }

    // Native executables ship as lib*.so and must be extracted to be exec'd from
    // nativeLibraryDir (useLegacyPackaging => extractNativeLibs=true).
    packaging {
        jniLibs {
            useLegacyPackaging true
            // Native build scripts already strip these PIE executables.
            keepDebugSymbols += ['**/libxrsync.so', '**/libxrsh.so']
        }
    }

    // Reproducible / F-Droid: do not embed the Google dependency metadata block.
    dependenciesInfo {
        includeInApk false
        includeInBundle false
    }

    lint {
        warningsAsErrors true
        // rsend is deliberately English-only. Keeping short operational text
        // beside the behavior is clearer than a large indirection table.
        disable 'HardcodedText', 'SetTextI18n'
        // These two checks enforce Google Play policy; rsend targets F-Droid
        // and sideloading, and both permissions are core to unattended sync.
        disable 'BatteryLife', 'ScopedStorage'
        // Core 1.17+ requires a different platform and AGP toolchain. The pin
        // below is the newest version compatible with this release's stack.
        disable 'GradleDependency'
        // OldTargetApi fires the moment Google publishes a newer SDK, against
        // a targetSdk this repo pins deliberately in ./versions and enforces
        // in ci/test.sh. With warningsAsErrors that turns the calendar into a
        // build break: the same commit passes today and fails next quarter,
        // which is the opposite of what every other pin here exists for.
        // Bumping the target is a deliberate, tested change, not lint's call.
        disable 'OldTargetApi'
    }
}

dependencies {
    // 1.16.0 is the newest Core release supported by the pinned API 35 and
    // AGP 8.7 toolchain. Core 1.17+ requires a newer platform and AGP.
    implementation 'androidx.core:core-ktx:1.16.0'
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'androidx.work:work-runtime:2.11.2'

    // The real org.json shadows the android.jar stub so JSON tests run on the JVM.
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.json:json:20240303'
}