From 9aeda4795328fe76b8c37bb4a480d323581c35d1 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 14 Oct 2024 12:38:08 +0300 Subject: [PATCH 1/2] =?UTF-8?q?Refactor=20mapbox.repo.token=20config=20to?= =?UTF-8?q?=20match=20gradle=20config=20mapbox.sdk.token=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- .github/workflows/library.yml | 2 +- .github/workflows/utils.yml | 2 +- build.gradle | 2 +- configs.gradle | 2 +- sample/README.md | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1adc77b1..17698385 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: Create local.properties file - run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties + run: touch local.properties && echo "mapbox.sdk.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties - name: Print Java version run: java -version diff --git a/.github/workflows/library.yml b/.github/workflows/library.yml index d6057597..2ce1e20c 100644 --- a/.github/workflows/library.yml +++ b/.github/workflows/library.yml @@ -34,7 +34,7 @@ jobs: java-version: 17 - name: Create local.properties file - run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties + run: touch local.properties && echo "mapbox.sdk.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties - name: Print Java version run: java -version diff --git a/.github/workflows/utils.yml b/.github/workflows/utils.yml index 9fcd44c8..03ce438b 100644 --- a/.github/workflows/utils.yml +++ b/.github/workflows/utils.yml @@ -34,7 +34,7 @@ jobs: java-version: 17 - name: Create local.properties file - run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties + run: touch local.properties && echo "mapbox.sdk.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties - name: Print Java version run: java -version diff --git a/build.gradle b/build.gradle index f4790a1e..20327bb5 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ allprojects { // This should always be `mapbox` (not your username). username = "mapbox" // Use the secret token you stored in gradle.properties as the password - password = localProperties['mapbox.repo.token'] ?: "" + password = localProperties['mapbox.sdk.token'] ?: "" } } maven{url "https://oss.sonatype.org/content/repositories/snapshots"} diff --git a/configs.gradle b/configs.gradle index 61c0adbf..ab9f684c 100644 --- a/configs.gradle +++ b/configs.gradle @@ -53,7 +53,7 @@ ext.getVersionName = getVersionName // LOAD PROPERTIES FILE Properties properties = new Properties() -String[] propertyKeys = ["cgr.username", "cgr.password", "cgr.url", "mapbox.sdk.token", "mapbox.repo.token"] +String[] propertyKeys = ["cgr.username", "cgr.password", "cgr.url", "mapbox.sdk.token"] if (project.rootProject.file("local.properties").exists()) { diff --git a/sample/README.md b/sample/README.md index e36ccf6f..e6544920 100644 --- a/sample/README.md +++ b/sample/README.md @@ -4,7 +4,7 @@ Use this sample application to view Kujaku's features. Add the following lines i `../local.properties` file before compiling this module: ``` -mapbox.repo.token="[YOUR MAPBOX REPO ACCESS TOKEN]" +mapbox.sdk.token="[YOUR MAPBOX REPO ACCESS TOKEN]" mapbox.sdk.token=[YOUR MAPBOX SDK TOKEN] cgr.username="[YOUR_CGR_USERNAME_WITHOUT_BRACKETS]" cgr.password="[YOUR_CGR_PASSWORD_WITHOUT_BRACKETS]" @@ -12,4 +12,4 @@ cgr.url="[CGR_URL_WITHOUT_BRACKETS]" ``` If you don't have a Mapbox account, [sign up](https://www.mapbox.com/signup/), and then navigate to your [Account](https://www.mapbox.com/account/) page. Copy your default public token to your clipboard then use it as `[YOUR MAPBOX SDK TOKEN]` above. Generate another token, a secret access token, that gives you access to `Downloads:Read` scope. This allows you to access the Mapbox repository with the dependencies -**NB: The `mapbox.sdk.token` has double quotation marks around the value while the `mapbox.repo.token` does not have double quotation marks around the value.** +**NB: The `mapbox.sdk.token` has double quotation marks around the value while the `mapbox.sdk.token` does not have double quotation marks around the value.** From 8d3e047ef69339ec7d493e7675a15343dae0f679 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 14 Oct 2024 13:12:59 +0300 Subject: [PATCH 2/2] Escape mapbox.sdk.token in the Gradle config files --- library/build.gradle | 4 ++-- sample/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index cd6e0d94..1780dd6f 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -55,7 +55,7 @@ android { properties.load(project.rootProject.file("local.properties").newDataInputStream()) if (properties != null && properties.containsKey("mapbox.sdk.token")) { - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\"" } else { println("One of the required config variables is not set in your local.properties"); buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\"" @@ -75,7 +75,7 @@ android { properties.load(project.rootProject.file("local.properties").newDataInputStream()) if (properties != null && properties.containsKey("mapbox.sdk.token")) { - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\"" } else { println("One of the required config variables is not set in your local.properties"); buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\"" diff --git a/sample/build.gradle b/sample/build.gradle index 4922f264..605c46ae 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -37,7 +37,7 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\"" buildConfigField "String", "CGR_USERNAME", localProperties["cgr.username"] buildConfigField "String", "CGR_PASSWORD", localProperties["cgr.password"] buildConfigField "String", "CGR_URL", localProperties["cgr.url"] @@ -47,7 +47,7 @@ android { debug { // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 testCoverageEnabled true - buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] + buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\"" buildConfigField "String", "CGR_USERNAME", localProperties["cgr.username"] buildConfigField "String", "CGR_PASSWORD", localProperties["cgr.password"] buildConfigField "String", "CGR_URL", localProperties["cgr.url"]