summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/build.gradle3
-rw-r--r--build.gradle24
-rw-r--r--dependencies.gradle5
-rw-r--r--gradle.properties2
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--load-properties.gradle33
6 files changed, 63 insertions, 6 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 15fa88c..2b493d6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -14,6 +14,8 @@ android {
versionName buildConfig.version.fullName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+
+ resValue("string", "mapbox_key", MAPBOX_KEY)
}
buildTypes {
@@ -37,6 +39,7 @@ dependencies {
implementation Libs.AndroidX.Lifecycle.runtime
implementation Libs.AndroidX.Lifecycle.viewmodel
+ implementation Libs.MapBox.sdk
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.+'
diff --git a/build.gradle b/build.gradle
index 2dfd140..7cd5cd6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,15 +27,19 @@ buildscript {
}
ext.buildConfig.version['code'] = buildConfig.version.major * 1000000 + buildConfig.version.minor * 10000 + buildConfig.version.patch * 100 + buildNumber
+ // Load properties either from local.properties or system environment (on CI).
+ apply from: rootProject.file('load-properties.gradle')
+
+ // Load dependencies as extra properties.
apply from: rootProject.file('dependencies.gradle')
+
repositories {
google()
mavenCentral()
- jcenter()
}
dependencies {
- classpath Libs.androidGradlePlugin
+ classpath 'com.android.tools.build:gradle:4.2.0'
classpath Libs.Kotlin.gradlePlugin
// NOTE: Do not place your application dependencies here; they belong
@@ -52,7 +56,21 @@ allprojects {
repositories {
google()
mavenCentral()
- jcenter()
+
+ maven {
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
+ authentication {
+ basic(BasicAuthentication)
+ }
+ credentials {
+ // Do not change the username below.
+ // This should always be `mapbox` (not your username).
+ username = 'mapbox'
+ // Use the secret token you stored in gradle.properties as the password
+ password = MAPBOX_SECRET_KEY ?: ""
+ }
+ }
+
}
}
diff --git a/dependencies.gradle b/dependencies.gradle
index 3e5e6ba..e30d4bb 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -81,4 +81,9 @@ libs.Hilt = [
compiler: "com.google.dagger:hilt-compiler:$versions.hilt",
testing: "com.google.dagger:hilt-android-testing:$versions.hilt",
gradlePlugin: "com.google.dagger:hilt-android-gradle-plugin:$versions.hilt",
+]
+
+versions.mapbox="9.6.1"
+libs.MapBox = [
+ sdk: "com.mapbox.mapboxsdk:mapbox-android-sdk:$versions.mapbox"
] \ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 98bed16..01b80d7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,5 +17,3 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
-# Kotlin code style for this project: "official" or "obsolete":
-kotlin.code.style=official \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 400490d..dc62e2d 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
diff --git a/load-properties.gradle b/load-properties.gradle
new file mode 100644
index 0000000..71c9fb5
--- /dev/null
+++ b/load-properties.gradle
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 E FOUNDATION
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Read all the properties from local.properties if it exists otherwise try to load from
+ * system environment variables.
+ *
+ * We don't provide default value like empty string here because we want it to fail early
+ * if those properties can't be found.
+ */
+File localPropertiesFile = project.rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ Properties p = new Properties()
+ new FileInputStream(localPropertiesFile).withCloseable { is -> p.load(is) }
+ p.each { name, value -> ext[name] = value }
+} else {
+ ext["MAPBOX_KEY"] = System.getenv('MAPBOX_KEY')
+ ext["MAPBOX_SECRET_KEY"] = System.getenv('MAPBOX_SECRET_KEY')
+} \ No newline at end of file