Skip to content

Commit e635457

Browse files
authored
Merge pull request #50 from LeoAndo/add_flavor
Add flavor
2 parents 633fd01 + 6a05c7b commit e635457

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

app/build.gradle

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ android {
3131
vectorDrawables {
3232
useSupportLibrary true
3333
}
34+
// 各productFlavorsで共通のTokenを利用する想定
3435
buildConfigField("String", "GITHUB_ACCESS_TOKEN", "\"" + localProperties['GITHUB_ACCESS_TOKEN'] + "\"")
35-
buildConfigField "String", "GITHUB_API_DOMAIN", "\"https://api.github.com\""
3636
}
3737

3838
buildTypes {
@@ -60,6 +60,31 @@ android {
6060
excludes += '/META-INF/{AL2.0,LGPL2.1}'
6161
}
6262
}
63+
flavorDimensions "version"
64+
productFlavors {
65+
development {
66+
dimension "version"
67+
buildConfigField "String", "GITHUB_API_DOMAIN", "\"https://api.github.com\""
68+
applicationIdSuffix ".development"
69+
versionNameSuffix "-development"
70+
}
71+
stub {
72+
dimension "version"
73+
buildConfigField "String", "GITHUB_API_DOMAIN", "\"https://api.github.com\""
74+
applicationIdSuffix ".stub"
75+
versionNameSuffix "-stub"
76+
}
77+
staging {
78+
dimension "version"
79+
buildConfigField "String", "GITHUB_API_DOMAIN", "\"https://api.github.com\""
80+
applicationIdSuffix ".staging"
81+
versionNameSuffix "-staging"
82+
}
83+
production {
84+
dimension "version"
85+
buildConfigField "String", "GITHUB_API_DOMAIN", "\"https://api.github.com\""
86+
}
87+
}
6388
}
6489

6590
dependencies {

app/src/development/package-info.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
ここに開発環境専用のコードを追加する
3+
*/

app/src/production/package-info.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
ここに本番環境専用のコードを追加する
3+
*/

app/src/staging/package-info.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
ここにステージング環境専用のコードを追加する
3+
*/

app/src/stub/package-info.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
ここにスタブ環境専用のコードを追加する
3+
*/

0 commit comments

Comments
 (0)