Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/gradle/app/com.google.dagger-hilt…
Browse files Browse the repository at this point in the history
…-android-2.51.1
  • Loading branch information
dkhawk authored Jan 28, 2025
2 parents 2075265 + 8793e02 commit 60b1253
Show file tree
Hide file tree
Showing 22 changed files with 434 additions and 85 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: 2
updates:
- package-ecosystem: gradle
Expand Down
14 changes: 14 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

rebaseMergeAllowed: true
squashMergeAllowed: true
mergeCommitAllowed: false
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
committer: googlemaps-bot <[email protected]>
author: googlemaps-bot <[email protected]>
title: 'docs: Update docs'
labels: |
docs
automerge
body: |
Updated GitHub pages with latest from `./gradlew dokka`.
branch: googlemaps-bot/update_gh_pages
49 changes: 49 additions & 0 deletions .github/workflows/lint-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Lint and Upload SARIF

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'

- name: Run Android Lint
run: ./gradlew lint

- name: Merge SARIF files
run: |
jq -s '{ "$schema": "https://json.schemastore.org/sarif-2.1.0", "version": "2.1.0", "runs": map(.runs) | add }' app/build/reports/lint-results.sarif places-ktx/build/reports/lint-results.sarif > merged.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: merged.sarif
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ jobs:
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc
echo "Build and publish"
sed -i -e "s,sonatypeUsername=,sonatypeUsername=$SONATYPE_USERNAME,g" gradle.properties
SONATYPE_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_PASSWORD" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s,sonatypePassword=,sonatypePassword=$SONATYPE_PASSWORD_ESCAPED,g" gradle.properties
sed -i -e "s,sonatypeToken=,sonatypeToken=$SONATYPE_TOKEN_USERNAME,g" gradle.properties
SONATYPE_TOKEN_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_TOKEN_PASSWORD" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s,sonatypeTokenPassword=,sonatypeTokenPassword=$SONATYPE_TOKEN_PASSWORD_ESCAPED,g" gradle.properties
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties
sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties
env:
GPG_KEY_ARMOR: "${{ secrets.SYNCED_GPG_KEY_ARMOR }}"
GPG_KEY_ID: ${{ secrets.SYNCED_GPG_KEY_ID }}
GPG_PASSWORD: ${{ secrets.SYNCED_GPG_KEY_PASSWORD }}
SONATYPE_PASSWORD: ${{ secrets.SYNCED_SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SYNCED_SONATYPE_USERNAME }}
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN }}

- uses: actions/setup-node@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are using the Places SDK through Google Play Services:

```groovy
dependencies {
implementation 'com.google.maps.android:places-ktx:3.1.1'
implementation 'com.google.maps.android:places-ktx:3.3.1'
}
```

Expand Down
34 changes: 19 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2023 Google Inc.
* Copyright 2024 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,12 +23,16 @@ plugins {
}

android {
compileSdk 34
lint {
sarifOutput = file("$buildDir/reports/lint-results.sarif")
}

compileSdk libs.versions.androidCompileSdk.get().toInteger()

defaultConfig {
applicationId "com.google.maps.android.ktx.demo"
minSdk 21
targetSdk 34
minSdk libs.versions.androidMinSdk.get().toInteger()
targetSdk libs.versions.androidTargetSdk.get().toInteger()
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand Down Expand Up @@ -58,19 +62,19 @@ android {
}

dependencies {
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.core:core-ktx:1.12.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.22"
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.google.android.gms:play-services-maps:18.2.0"
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.android.volley:volley:1.2.1'
implementation libs.appcompat
implementation libs.core.ktx
implementation libs.kotlin.stdlib
implementation libs.multidex
implementation libs.play.services.maps
implementation libs.fragment.ktx
implementation libs.lifecycle.runtime.ktx
implementation libs.material
implementation libs.volley

// Hilt
implementation "com.google.dagger:hilt-android:2.51.1"
kapt "com.google.dagger:hilt-android-compiler:2.51.1.1"
implementation libs.hilt.android
kapt "com.google.dagger:hilt-android-compiler:2.55"

implementation project(':places-ktx')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class AutocompleteDemoActivity : AppCompatActivity() {
as AutocompleteSupportFragment

// Specify the types of place data to return.
autocompleteFragment.setPlaceFields(listOf(Place.Field.ID, Place.Field.NAME))
autocompleteFragment.setPlaceFields(listOf(Place.Field.ID,Place.Field.DISPLAY_NAME))

// Listen to place selection events
lifecycleScope.launch {
autocompleteFragment.placeSelectionEvents().collect { event ->
when (event) {
is PlaceSelectionSuccess -> Toast.makeText(
this@AutocompleteDemoActivity,
"Got place '${event.place.name}'",
"Got place '${event.place.displayName}'",
Toast.LENGTH_SHORT
).show()
is PlaceSelectionError -> Toast.makeText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.google.android.libraries.places.ktx.api.net.awaitFetchPlace
import com.google.android.libraries.places.ktx.api.net.awaitFindAutocompletePredictions
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
Expand All @@ -44,6 +45,7 @@ class PlacesSearchViewModel @Inject constructor(

private var searchJob: Job? = null

@OptIn(ExperimentalCoroutinesApi::class)
fun onSearchQueryChanged(query: String) {
searchJob?.cancel()

Expand Down Expand Up @@ -75,6 +77,7 @@ class PlacesSearchViewModel @Inject constructor(
}
}

@OptIn(ExperimentalCoroutinesApi::class)
fun onAutocompletePredictionClicked(prediction: AutocompletePrediction) {
val handler = CoroutineExceptionHandler { _, e ->
e.printStackTrace()
Expand All @@ -84,9 +87,9 @@ class PlacesSearchViewModel @Inject constructor(
val place = placesClient.awaitFetchPlace(
prediction.placeId,
listOf(
Place.Field.NAME,
Place.Field.ADDRESS,
Place.Field.LAT_LNG,
Place.Field.DISPLAY_NAME,
Place.Field.FORMATTED_ADDRESS,
Place.Field.LOCATION,
Place.Field.BUSINESS_STATUS
)
)
Expand Down
32 changes: 16 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2023 Google Inc.
* Copyright 2024 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,12 +21,12 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.1'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.51"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
classpath 'com.mxalbert.gradle:jacoco-android:0.2.1'
classpath libs.gradle
classpath libs.dokka.gradle.plugin
classpath libs.kotlin.gradle.plugin
classpath libs.hilt.android.gradle.plugin
classpath libs.secrets.gradle.plugin
classpath libs.jacoco.android
}
}

Expand All @@ -48,7 +48,7 @@ ext.projectArtifactId = { project ->
*/
allprojects {
group = 'com.google.maps.android'
version = '3.1.1'
version = '3.3.1'
project.ext.artifactId = rootProject.ext.projectArtifactId(project)

repositories {
Expand All @@ -66,11 +66,11 @@ allprojects {
subprojects { project ->
if (project.ext.artifactId == null) return

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'com.mxalbert.gradle.jacoco-android'
apply plugin: 'signing'
plugins.apply(libs.plugins.androidLibrary.get().pluginId)
plugins.apply(libs.plugins.mavenPublish.get().pluginId)
plugins.apply(libs.plugins.dokka.get().pluginId)
plugins.apply(libs.plugins.jacocoAndroid.get().pluginId)
plugins.apply(libs.plugins.signing.get().pluginId)

// Code coverage
jacoco {
Expand Down Expand Up @@ -154,8 +154,8 @@ subprojects { project ->
name = "mavencentral"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username sonatypeUsername
password sonatypePassword
username sonatypeToken
password sonatypeTokenPassword
}
}
}
Expand All @@ -167,5 +167,5 @@ subprojects { project ->
}

tasks.register('clean', Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ signing.keyId=
signing.password=
signing.secretKeyRingFile=

sonatypeUsername=
sonatypePassword=
sonatypeToken=
sonatypeTokenPassword=
64 changes: 64 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[versions]
androidCompileSdk = "34"
androidMinSdk = "23"
androidTargetSdk = "34"

appcompat = "1.7.0"
coreKtx = "1.13.1"
dokkaGradlePlugin = "1.9.20"
fragmentKtx = "1.8.3"
gradle = "8.6.1"
hiltAndroid = "2.51.1"
jacocoAndroid = "0.2.1"
kotlin = "2.0.0"
kotlinGradlePlugin = "1.9.24"
kotlinx-coroutines-core = "1.8.1"
lifecycle-viewmodel-ktx = "2.8.6"
material = "1.12.0"
playServicesMaps = "19.0.0"
secretsGradlePlugin = "2.0.1"
truth = "1.4.2"
volley = "1.2.1"
multidex = "2.0.1"
kotlinx-coroutines-play-services = "1.8.1"
places = "4.0.0"
junit-ext = "1.2.1"
test-core = "1.6.1"
mockito-kotlin = "2.2.0"
junit = "4.13.2"
mockito-core = "5.11.0"

[libraries]
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokkaGradlePlugin" }
fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" }
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hiltAndroid" }
jacoco-android = { module = "com.mxalbert.gradle:jacoco-android", version.ref = "jacocoAndroid" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle-viewmodel-ktx" }
lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-viewmodel-ktx" }
material = { module = "com.google.android.material:material", version.ref = "material" }
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secretsGradlePlugin" }
truth = { module = "com.google.truth:truth", version.ref = "truth" }
volley = { group = "com.android.volley", name = "volley", version.ref = "volley" }
multidex = { group = "androidx.multidex", name = "multidex", version.ref = "multidex" }
kotlinx-coroutines-play-services = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines-play-services" }
places = { group = "com.google.android.libraries.places", name = "places", version.ref = "places" }
junit-ext = { group = "androidx.test.ext", name = "junit", version.ref = "junit-ext" }
test-core = { group = "androidx.test", name = "core", version.ref = "test-core" }
mockito-kotlin = { group = "com.nhaarman.mockitokotlin2", name = "mockito-kotlin", version.ref = "mockito-kotlin" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito-core" }

[plugins]
androidLibrary = { id = "com.android.library" }
mavenPublish = { id = "maven-publish" }
dokka = { id = "org.jetbrains.dokka" }
jacocoAndroid = { id = "com.mxalbert.gradle.jacoco-android" }
signing = { id = "signing" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 60b1253

Please sign in to comment.