mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[Gradle] Add configuration to store output files in release directory.
This commit is contained in:
parent
2a3b1422ef
commit
1108f2eb71
@ -31,15 +31,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
applicationVariants.all { variant ->
|
|
||||||
variant.outputs.all {
|
|
||||||
if (variant.buildType.name == "release") {
|
|
||||||
outputFileName = "Edziennik_" + defaultConfig.versionName + ".apk"
|
|
||||||
} else {
|
|
||||||
outputFileName = "Edziennik_" + defaultConfig.versionName + "_debug.apk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debug {
|
debug {
|
||||||
minifyEnabled = false
|
minifyEnabled = false
|
||||||
}
|
}
|
||||||
@ -92,6 +83,30 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.whenTaskAdded { task ->
|
||||||
|
if (!task.name.endsWith("Release") && !task.name.endsWith("ReleaseWithR8"))
|
||||||
|
return
|
||||||
|
def renameTaskName = "rename${task.name.capitalize()}"
|
||||||
|
|
||||||
|
def flavor = ""
|
||||||
|
if (task.name.startsWith("bundle"))
|
||||||
|
flavor = task.name.substring("bundle".length(), task.name.indexOf("Release")).uncapitalize()
|
||||||
|
if (task.name.startsWith("assemble"))
|
||||||
|
flavor = task.name.substring("assemble".length(), task.name.indexOf("Release")).uncapitalize()
|
||||||
|
if (task.name.startsWith("minify"))
|
||||||
|
flavor = task.name.substring("minify".length(), task.name.indexOf("Release")).uncapitalize()
|
||||||
|
|
||||||
|
if (flavor != "") {
|
||||||
|
tasks.create(renameTaskName, Copy) {
|
||||||
|
from file("${projectDir}/${flavor}/release/"), file("${buildDir}/outputs/mapping/${flavor}Release/")
|
||||||
|
include "*.aab", "*.apk", "mapping.txt", "output-metadata.json"
|
||||||
|
destinationDir file("${projectDir}/release/")
|
||||||
|
rename ".+?\\.(.+)", "Edziennik_${android.defaultConfig.versionName}_${flavor}." + '$1'
|
||||||
|
}
|
||||||
|
task.finalizedBy(renameTaskName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user