summaryrefslogtreecommitdiff
path: root/org.fox.ttrss/build.gradle
blob: 2402a42d5b323b057297cdb8501556db4efce4c8 (plain)
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
apply plugin: 'com.android.application'

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "org.fox.ttrss"
        buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
        minSdkVersion 24
        //noinspection ExpiredTargetSdkVersion
        targetSdkVersion 31
        compileSdk 35
        versionCode getGitVersionCode()
        versionName getVersion()
        vectorDrawables.useSupportLibrary = true
        manifestPlaceholders = [
            appIcon: "@mipmap/ic_launcher"
        ]
    }

    signingConfigs {
        signed {
            if (project.hasProperty("SIGNING_STORE_FILE")) {
                storeFile file(SIGNING_STORE_FILE)
                storePassword SIGNING_STORE_PASSWORD
                keyAlias SIGNING_KEY_ALIAS
                keyPassword SIGNING_KEY_PASSWORD
            }
        }
    }

    lintOptions {
        abortOnError false
        checkReleaseBuilds false
        disable 'MissingTranslation'
    }

    buildTypes {
        debug {
            minifyEnabled  false
            versionNameSuffix "-debug"
            applicationIdSuffix ".debug"
            debuggable true
            resValue "string", "app_name", "Tiny Tiny RSS (debug)"
            manifestPlaceholders = [
                appIcon: "@mipmap/ic_launcher_variant"
            ]
        }

        release {
            minifyEnabled  false
            versionNameSuffix "-release-unsigned"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }

        signed {
            minifyEnabled  false
            versionNameSuffix "-signed"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.signed
        }

        branch {
            minifyEnabled  false
            versionNameSuffix "-signed-branch"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.signed
            applicationIdSuffix ".branch"
            resValue "string", "app_name", "Tiny Tiny RSS (dev)"
            manifestPlaceholders = [
                appIcon: "@mipmap/ic_launcher_variant"
            ]
        }
    }
    namespace 'org.fox.ttrss'
    buildFeatures {
        buildConfig true
    }
}

def getGitVersionCode() {
    return new Date(getGitTimestamp()).format('yyyyMMdd').toInteger()
}

def getGitTimestampFormatted() {
    return new Date(getGitTimestamp()).format('YY.MM')
}

def getGitTimestamp() {
    // gitlab CI iso-8601 timestamp
    if (System.getenv("CI_COMMIT_TIMESTAMP")) {
        return Date.parse("yyyy-MM-dd'T'HH:mm:ssXXX", System.getenv("CI_COMMIT_TIMESTAMP")).getTime();
    }

    // try to get version from git repo in current dir
    try {
        def stdout = new ByteArrayOutputStream()
        exec {
            commandLine 'git', '--no-pager', 'log', '--pretty=%ct', '-n1', 'HEAD'
            standardOutput = stdout
        }

        return stdout.toString().trim().toLong() * 1000;
    }
    catch (ignored) {
        return 0;
    }

}

def getGitCommitHash() {
    // gitlab CI
    if (System.getenv("CI_COMMIT_SHORT_SHA"))
        return System.getenv("CI_COMMIT_SHORT_SHA");

    // try to get version from git repo in current dir
    try {
        def stdout = new ByteArrayOutputStream()
        exec {
            commandLine 'git', '--no-pager', 'log', '--pretty=%h', '-n1', 'HEAD'
            standardOutput = stdout
        }
        return stdout.toString().trim()
    }
    catch (ignored) {
        return 'UNKNOWN';
    }
}

def getVersion() {
    return getGitTimestampFormatted() + '-' + getGitCommitHash();
}

dependencies {
    implementation 'com.squareup.okhttp3:okhttp:3.12.5'
    implementation 'org.jsoup:jsoup:1.11.3'
    implementation 'com.bogdwellers:pinchtozoom:0.1'
    implementation 'com.github.bumptech.glide:glide:4.14.2'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.14.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
    implementation 'androidx.recyclerview:recyclerview:1.4.0'
    implementation 'androidx.activity:activity:1.10.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.appcompat:appcompat-resources:1.7.0'
    implementation 'androidx.browser:browser:1.8.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.3.0'
    implementation 'com.github.natario1:NestedScrollCoordinatorLayout:5a33a7dbd8'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'com.google.code.gson:gson:2.10.1'
    implementation 'me.relex:circleindicator:2.1.6'
    implementation 'com.github.amulyakhare:TextDrawable:558677ea31'
    implementation 'com.telefonica:nestedscrollwebview:0.1.6'
    implementation 'androidx.preference:preference:1.2.1'
    implementation 'ch.acra:acra-mail:5.12.0'
    implementation 'ch.acra:acra-dialog:5.12.0'
}
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}