|
1 | 1 | import java.util.Properties |
2 | 2 |
|
| 3 | +val versionName = "0.2.3" |
| 4 | + |
3 | 5 | plugins { |
4 | 6 | alias(libs.plugins.android.application) |
5 | 7 | alias(libs.plugins.kotlin.compose) |
@@ -29,15 +31,14 @@ android { |
29 | 31 | minSdk = 33 |
30 | 32 | targetSdk = 37 |
31 | 33 | versionCode = 36 |
32 | | - versionName = "0.2.3" |
| 34 | + versionName = versionName |
33 | 35 | } |
34 | 36 | buildTypes { |
35 | 37 | release { |
36 | 38 | isMinifyEnabled = true |
37 | 39 | isShrinkResources = true |
38 | 40 | proguardFiles( |
39 | | - getDefaultProguardFile("proguard-android-optimize.txt"), |
40 | | - "proguard-rules.pro" |
| 41 | + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" |
41 | 42 | ) |
42 | 43 | externalNativeBuild { |
43 | 44 | cmake { |
@@ -83,7 +84,7 @@ android { |
83 | 84 | } |
84 | 85 | sourceSets { |
85 | 86 | getByName("main") { |
86 | | - res.directories+="src/main/res-apple" |
| 87 | + res.directories += "src/main/res-apple" |
87 | 88 | } |
88 | 89 | } |
89 | 90 |
|
@@ -144,9 +145,83 @@ dependencies { |
144 | 145 | } |
145 | 146 |
|
146 | 147 | aboutLibraries { |
147 | | - export{ |
| 148 | + export { |
148 | 149 | prettyPrint = true |
149 | 150 | excludeFields = listOf("generated") |
150 | 151 | outputFile = file("src/main/res/raw/aboutlibraries.json") |
151 | 152 | } |
152 | 153 | } |
| 154 | + |
| 155 | +val rootModuleDir = rootProject.file("../root-module-manual") |
| 156 | +val releaseDir = rootProject.file("../release") |
| 157 | + |
| 158 | +fun cap(s: String) = s.replaceFirstChar { it.uppercase() } |
| 159 | + |
| 160 | +fun registerRootModuleZipTask( |
| 161 | + name: String, |
| 162 | + flavor: String, |
| 163 | + buildType: String |
| 164 | +) = tasks.register<Zip>(name) { |
| 165 | + |
| 166 | + val variantTask = "assemble${cap(flavor)}${cap(buildType)}" |
| 167 | + dependsOn(variantTask) |
| 168 | + |
| 169 | + val apkPath = "outputs/apk/$flavor/$buildType/app-$flavor-$buildType.apk" |
| 170 | + |
| 171 | + from(rootModuleDir) |
| 172 | + |
| 173 | + duplicatesStrategy = DuplicatesStrategy.WARN |
| 174 | + |
| 175 | + from(layout.buildDirectory.file(apkPath)) { |
| 176 | + into("system/priv-app/LibrePods") |
| 177 | + rename { "LibrePods.apk" } |
| 178 | + } |
| 179 | + |
| 180 | + archiveFileName.set("LibrePods-FOSS-v$versionName-$buildType.zip") |
| 181 | + destinationDirectory.set(layout.buildDirectory.dir("outputs/rootModuleZips")) |
| 182 | +} |
| 183 | + |
| 184 | +val zipRelease = registerRootModuleZipTask( |
| 185 | + "zipXposedReleaseModule", |
| 186 | + "xposed", |
| 187 | + "release" |
| 188 | +) |
| 189 | + |
| 190 | +val zipDebug = registerRootModuleZipTask( |
| 191 | + "zipXposedDebugModule", |
| 192 | + "xposed", |
| 193 | + "debug" |
| 194 | +) |
| 195 | + |
| 196 | +val collect = tasks.register<Copy>("collectReleaseArtifacts") { |
| 197 | + |
| 198 | + dependsOn( |
| 199 | + zipRelease, |
| 200 | + zipDebug, |
| 201 | + "bundleXposedPlayRelease" |
| 202 | + ) |
| 203 | + |
| 204 | + into(releaseDir) |
| 205 | + |
| 206 | + from(layout.buildDirectory.dir("outputs/apk/xposed/release")) { |
| 207 | + include("*.apk") |
| 208 | + rename(".*", "LibrePods-FOSS-v$versionName-release.apk") |
| 209 | + } |
| 210 | + |
| 211 | + from(layout.buildDirectory.dir("outputs/apk/xposed/debug")) { |
| 212 | + include("*.apk") |
| 213 | + rename(".*", "LibrePods-FOSS-v$versionName-debug.apk") |
| 214 | + } |
| 215 | + |
| 216 | + from(layout.buildDirectory.dir("outputs/bundle/xposedPlayRelease")) { |
| 217 | + include("*.aab") |
| 218 | + } |
| 219 | + |
| 220 | + from(layout.buildDirectory.dir("outputs/rootModuleZips")) { |
| 221 | + include("*.zip") |
| 222 | + } |
| 223 | +} |
| 224 | + |
| 225 | +tasks.register("packageReleaseArtifacts") { |
| 226 | + dependsOn(collect) |
| 227 | +} |
0 commit comments