Skip to content

Commit 78a0a16

Browse files
committed
Fixes for Google Drive integration
- Updated libraries - Updated build.gradle for CLIENT_ID declaration - Update GHA to expose CLIENT_ID to build
1 parent 0f4ac0e commit 78a0a16

20 files changed

Lines changed: 107 additions & 24 deletions

.github/workflows/android-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
name: Check spotless
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Export secret to env
19+
run: |
20+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
1821
- uses: actions/checkout@v6
1922
- name: Set up JDK 17
2023
uses: actions/setup-java@v5
@@ -69,6 +72,9 @@ jobs:
6972
name: Build debug
7073
runs-on: ubuntu-latest
7174
steps:
75+
- name: Export secret to env
76+
run: |
77+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
7278
- uses: actions/checkout@v6
7379
- name: Set up JDK 17
7480
uses: actions/setup-java@v5

.github/workflows/android-debug-artifact-ondemand.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
echo "::set-output name=repo_name::${{ fromJson(steps.request.outputs.data).head.repo.full_name }}"
3030
echo "::set-output name=repo_clone_url::${{ fromJson(steps.request.outputs.data).head.repo.clone_url }}"
3131
echo "::set-output name=repo_ssh_url::${{ fromJson(steps.request.outputs.data).head.repo.ssh_url }}"
32+
- name: Export secret to env
33+
run: |
34+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
3235
- name: Checkout PR Branch
3336
uses: actions/checkout@v6
3437
with:

.github/workflows/android-debug-artifact-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
apk:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Export secret to env
12+
run: |
13+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
1114
- uses: actions/checkout@v6
1215
- name: Set up JDK 17
1316
uses: actions/setup-java@v5

.github/workflows/android-feature.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
name: Check spotless
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Export secret to env
20+
run: |
21+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
1922
- uses: actions/checkout@v6
2023
- name: Set up JDK 17
2124
uses: actions/setup-java@v5
@@ -40,6 +43,9 @@ jobs:
4043
name: Build debug and run Jacoco tests
4144
runs-on: ubuntu-latest
4245
steps:
46+
- name: Export secret to env
47+
run: |
48+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
4349
- uses: actions/checkout@v6
4450
- name: Set up JDK 17
4551
uses: actions/setup-java@v5

.github/workflows/android-main.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
name: Check spotless
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Export secret to env
20+
run: |
21+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
1922
- uses: actions/checkout@v6
2023
- name: Set up JDK 17
2124
uses: actions/setup-java@v5
@@ -37,7 +40,10 @@ jobs:
3740
name: Build debug, Jacoco test and publish to codacy
3841
runs-on: ubuntu-latest
3942
steps:
40-
- uses: actions/checkout@v6
43+
- name: Export secret to env
44+
run: |
45+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
46+
- uses: actions/checkout@v4
4147
with:
4248
fetch-depth: 0
4349
- name: Set up JDK 17
@@ -106,6 +112,9 @@ jobs:
106112
matrix:
107113
api-level: [ 21, 28 ]
108114
steps:
115+
- name: Export secret to env
116+
run: |
117+
echo "AMAZE_CLOUD_GOOGLE_CLIENT_ID=${{ secrets.AMAZE_CLOUD_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV
109118
- name: checkout
110119
uses: actions/checkout@v6
111120
- name: Java 17

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import java.util.concurrent.TimeUnit
2+
import com.android.build.gradle.internal.cxx.configure.GradleLocalPropertiesKt
23

34
apply plugin: 'com.android.application'
45
apply plugin: 'kotlin-android'
@@ -35,6 +36,10 @@ android {
3536
"room.expandProjection": "true"]
3637
}
3738
}
39+
40+
def googleClientId = getValueFromEnvOrProperties("AMAZE_CLOUD_GOOGLE_CLIENT_ID")
41+
def bareGoogleClientId = googleClientId.replace(".apps.googleusercontent.com", "")
42+
manifestPlaceholders["googleClientIdForRedirect"] = "com.googleusercontent.apps.${bareGoogleClientId}"
3843
}
3944

4045
signingConfigs {
@@ -238,6 +243,20 @@ dependencies {
238243
transitive = true
239244
}
240245

246+
implementation(libs.google.api.client) {
247+
transitive = false
248+
}
249+
250+
implementation(libs.google.oauth.client) {
251+
transitive = false
252+
}
253+
254+
implementation(libs.google.http.client) {
255+
transitive = false
256+
}
257+
258+
implementation(libs.google.http.client.gson)
259+
241260
//zip4j: support password-protected zips
242261
implementation libs.zip4j
243262

@@ -348,9 +367,15 @@ if (propFile.canRead()) {
348367
println 'signing.properties not found'
349368
android.buildTypes.release.signingConfig = null
350369
}
370+
351371
repositories {
352372
google()
353373
mavenCentral()
354374
maven { url "https://jitpack.io" }
355375
maven { url "https://jcenter.bintray.com" }
356376
}
377+
378+
String getValueFromEnvOrProperties(String name) {
379+
def localProperties = GradleLocalPropertiesKt.gradleLocalProperties(rootDir, project.providers)
380+
return System.getenv(name) ?: localProperties[name]
381+
}
-947 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)