mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-04-20 03:25:14 +00:00
Pull Fabric props from environment variables, default to 0 which stops build failures
This commit is contained in:
parent
77f939b095
commit
571e7ebff3
5 changed files with 34 additions and 30 deletions
|
@ -1,3 +0,0 @@
|
|||
[*.kt]
|
||||
indent_size = 2
|
||||
continuation_indent_size=4
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -40,7 +40,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -4,17 +4,7 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
apply plugin: 'io.fabric'
|
||||
|
||||
def getFabricApiKey() {
|
||||
def propsFile = project.rootProject.file('local.properties')
|
||||
if (!propsFile.exists()) {
|
||||
return ""
|
||||
}
|
||||
Properties properties = new Properties()
|
||||
properties.load(propsFile.newDataInputStream())
|
||||
return properties.getProperty("fabric.apikey") ?: ""
|
||||
}
|
||||
apply from: '../fabric.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion versions.compileSdk
|
||||
|
@ -26,7 +16,6 @@ android {
|
|||
targetSdkVersion versions.compileSdk
|
||||
versionCode versions.publishVersionCode
|
||||
versionName versions.publishVersion
|
||||
manifestPlaceholders = [fabricKey:getFabricApiKey()]
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.afollestad.nocknock">
|
||||
|
||||
<application>
|
||||
|
||||
<meta-data
|
||||
android:name="io.fabric.ApiKey"
|
||||
android:value="${fabricKey}"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
32
fabric.gradle
Normal file
32
fabric.gradle
Normal file
|
@ -0,0 +1,32 @@
|
|||
apply plugin: 'io.fabric'
|
||||
|
||||
ext.getFabricApiKey = {
|
||||
return System.getenv('FABRIC_APIKEY') ?: "0"
|
||||
}
|
||||
|
||||
ext.getFabricApiSecret = {
|
||||
return System.getenv('FABRIC_APISECRET') ?: "0"
|
||||
}
|
||||
|
||||
def buildFabricProperties() {
|
||||
def propertiesFile = file("fabric.properties")
|
||||
def apiSecret = getFabricApiSecret()
|
||||
def apiKey = getFabricApiKey()
|
||||
|
||||
if (apiSecret == "0" || apiKey == "0") {
|
||||
logger.warn("API key and/or secret env variables not found, defaulting to 0.")
|
||||
}
|
||||
if (propertiesFile.exists()) {
|
||||
propertiesFile.delete()
|
||||
}
|
||||
|
||||
def commentMessage = "suppress inspection \"UnusedProperty\" for whole file"
|
||||
ant.propertyfile(file: "fabric.properties", comment: commentMessage) {
|
||||
entry(key: "apiSecret", value: apiSecret)
|
||||
entry(key: "apiKey", value: apiKey)
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
buildFabricProperties()
|
||||
}
|
Loading…
Add table
Reference in a new issue