Skip to content

Commit

Permalink
Update secret key configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DSteve595 committed Dec 28, 2018
1 parent 3cc4810 commit 52a6330
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@

# mpeltonen/sbt-idea plugin
.idea_modules/

/secrets.gradle.kts
/*.keystore
3 changes: 1 addition & 2 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/build
/src/main/res/values/secrets.xml
/google-services.json
/google-services.json
39 changes: 37 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

def secretsFilename = "secrets.gradle.kts"
try {
apply from: "$rootDir/$secretsFilename"
} catch (e) {
throw new GradleException(
"To build this project, you must make a `$secretsFilename` file that provides the " +
"required secrets keys.\n" +
"To get your secret keys, go here: " +
"https://app.put.io/settings/account/oauth/apps" +
"""
Example `$secretsFilename`:
extra["secrets"] = PutioSecrets(
putioClientId = "your put.io Client ID",
putioApiKey = "your put.io API key"
)
""", e)
}

repositories {
maven {
url 'https://maven.fabric.io/public'
Expand All @@ -25,14 +44,30 @@ android {
arg("room.schemaLocation", "$projectDir/schemas")
}
}

resValue "string", "putio_client_id", secrets.putioClientId
resValue "string", "putio_api_key", secrets.putioApiKey
}
signingConfigs {
if (secrets.keystorePath != null) {
release {
storeFile file(secrets.keystorePath)
storePassword secrets.keystorePassword
keyAlias secrets.keyAlias
keyPassword secrets.keyPassword
}
}
}
buildTypes {
debug {
versionNameSuffix "-debug"
manifestPlaceholders = [crashlyticsEnabled:false]
manifestPlaceholders = [crashlyticsEnabled: false]
}
release {
manifestPlaceholders = [crashlyticsEnabled:true]
if (signingConfigs.findByName("release") != null) {
signingConfig signingConfigs.release
}
manifestPlaceholders = [crashlyticsEnabled: true]
}
}
lintOptions {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
22 changes: 22 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.11'
}

repositories {
jcenter()
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
9 changes: 9 additions & 0 deletions buildSrc/src/main/java/PutioSecrets.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PutioSecrets(
val keystorePath: String? = null,
val keystorePassword: String? = null,
val keyAlias: String? = null,
val keyPassword: String? = null,

val putioClientId: String,
val putioApiKey: String
)

0 comments on commit 52a6330

Please sign in to comment.