Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some build config fields to AndroidTarget
Browse files Browse the repository at this point in the history
kageiit authored Sep 15, 2016
1 parent 09e17d8 commit 3e3d818
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -72,13 +72,6 @@ class AndroidAppTarget extends AndroidLibTarget {
List<String> getBuildConfigFields() {
List<String> buildConfig = super.getBuildConfigFields()
buildConfig.add("String APPLICATION_ID = \"${applicationId + applicationIdSuffix}\"")
if (versionCode != null) {
buildConfig.add("int VERSION_CODE = ${versionCode}")
}
if (versionName != null) {
buildConfig.add("String VERSION_NAME = \"${versionName}\"")
}

return buildConfig
}

Original file line number Diff line number Diff line change
@@ -131,12 +131,22 @@ abstract class AndroidTarget extends JavaLibTarget {
}

List<String> getBuildConfigFields() {
return ["String BUILD_TYPE = \"${buildType}\"",
"String FLAVOR = \"${flavor}\"",
] + baseVariant.mergedFlavor.buildConfigFields.collect {
List<String> buildConfig = [
"String BUILD_TYPE = \"${buildType}\"",
"String FLAVOR = \"${flavor}\"",
]
if (versionCode != null) {
buildConfig.add("int VERSION_CODE = ${versionCode}")
}
if (versionName != null) {
buildConfig.add("String VERSION_NAME = \"${versionName}\"")
}
buildConfig += baseVariant.mergedFlavor.buildConfigFields.collect {
String key, ClassField classField ->
"${classField.type} ${key} = ${classField.value}"
}

return buildConfig
}

String getFlavor() {

0 comments on commit 3e3d818

Please sign in to comment.