-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathmapbox.gradle.kts
32 lines (28 loc) · 1.05 KB
/
mapbox.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.File
import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.InputStreamReader
import java.util.Properties
fun readProperties(file: String): Properties {
val properties = Properties()
val localProperties = File(file)
if (localProperties.isFile) {
InputStreamReader(FileInputStream(localProperties), Charsets.UTF_8).use { reader
->
properties.load(reader)
}
}
else throw FileNotFoundException("\u001B[34mFile $file not found\u001B[0m")
return properties
}
val mapboxSdkToken = System.getenv("MAPBOX_SDK_TOKEN") ?: readProperties((project.properties["localPropertiesFile"] ?: "${rootProject.projectDir}/local.properties").toString()).getProperty("MAPBOX_SDK_TOKEN")
allprojects {
repositories {
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
credentials.username = "mapbox"
credentials.password = mapboxSdkToken
authentication.create<BasicAuthentication>("basic")
}
}
}