move secret strings to gradle config file

This commit is contained in:
Phillip Thelen 2016-06-17 12:43:49 +02:00
parent 0bdd13b57f
commit af2be913c4
5 changed files with 25 additions and 7 deletions

3
.gitignore vendored
View file

@ -52,4 +52,5 @@ fabric.properties
.DS_Store .DS_Store
*.iml *.iml
Habitica/res/values/secret_strings.xml Habitica/res/values/secret_strings.xml
habitica.properties habitica.properties
habitica.resources

View file

@ -40,5 +40,6 @@ android:
#- sys-img-x86-android-17 #- sys-img-x86-android-17
script: script:
- cp habitica.properties.travis habitica.properties - cp habitica.properties.travis habitica.properties
- cp habitica.resources.example habitica.resources
- ./gradlew assembleDebug - ./gradlew assembleDebug
- ./gradlew testDebugUnitTest --info - ./gradlew testDebugUnitTest --info

View file

@ -240,6 +240,25 @@ if (HRPG_PROPS_FILE.canRead()) {
throw new MissingResourceException('habitica.properties not found') throw new MissingResourceException('habitica.properties not found')
} }
// Add Habitica Resources to resources
final File HRPG_RES_FILE = new File('habitica.resources')
if (HRPG_RES_FILE.canRead()) {
def Properties HRPG_RES = new Properties()
HRPG_RES.load(new FileInputStream(HRPG_RES_FILE))
if (HRPG_RES != null) {
android.buildTypes.all { buildType ->
HRPG_RES.any { property ->
buildType.resValue "string", property.key, "\"${property.value}\""
}
}
} else {
throw new InvalidUserDataException('habitica.resources found but some entries are missing')
}
} else {
throw new MissingResourceException('habitica.resources not found')
}
tasks.whenTaskAdded { task -> tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) { if (task.name.equals("lint")) {
task.enabled = false task.enabled = false

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="fabric_key">CHANGE_ME</string>
<string name="facebook_app_id">CHANGE_ME</string>
<string name="amplitude_app_id">CHANGE_ME</string>
</resources>

View file

@ -0,0 +1,3 @@
fabric_key=CHANGE_ME
facebook_app_id=CHANGE_ME
amplitude_app_id=CHANGE_ME