Skip to content

Commit e044828

Browse files
committed
Merge branch 'master' of https://github.com/firebase/firebase-android-sdk into rpf-add-coroutines-common-ktx
� Conflicts: � build.gradle
2 parents 2cf32e7 + e6226b7 commit e044828

File tree

73 files changed

+1187
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1187
-565
lines changed

.github/workflows/changelog.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Changelog
2+
3+
on:
4+
pull_request
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
danger:
12+
runs-on: ubuntu-22.04
13+
env:
14+
BUNDLE_GEMFILE: ./ci/danger/Gemfile
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 100
19+
submodules: true
20+
- uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '2.7'
23+
- name: Setup Bundler
24+
run: ./ci/danger/setup_bundler.sh
25+
- name: Danger CHANGELOG verifier
26+
env:
27+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }}
28+
run:
29+
'[ ! -z $DANGER_GITHUB_API_TOKEN ] && bundle exec danger --dangerfile=./ci/danger/Dangerfile || echo "Skipping Danger for External Contributor"'
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version=16.0.1
1+
version=16.0.2
2+
latestReleasedVersion=16.0.1
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version=16.0.1
1+
version=16.0.2
2+
latestReleasedVersion=16.0.1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=16.0.1
2-
latestReleasedVersion=16.0.0
1+
version=16.0.2
2+
latestReleasedVersion=16.0.1
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version=16.0.1
1+
version=16.0.2
2+
latestReleasedVersion=16.0.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=16.0.1
1+
version=16.0.2
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version=16.0.1
1+
version=16.0.2
2+
latestReleasedVersion=16.0.1

build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import com.google.firebase.gradle.plugins.license.LicenseResolverPlugin
1616
import com.google.firebase.gradle.MultiProjectReleasePlugin
1717

1818
buildscript {
19-
ext.kotlinVersion = '1.4.32'
19+
ext.kotlinVersion = '1.7.10'
2020
// Please update $coroutinesVersion alongside $kotlinVersion
2121
// A map of versions can be found here: https://kotlinlang.org/docs/releases.html
2222
ext.coroutinesVersion = '1.5.2'
@@ -41,8 +41,6 @@ buildscript {
4141
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.3.0'
4242
classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9'
4343
classpath 'com.google.gms:google-services:4.3.3'
44-
classpath 'digital.wup:android-maven-publish:3.6.3'
45-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
4644
classpath 'org.jlleitschuh.gradle:ktlint-gradle:9.2.1'
4745
}
4846
}

buildSrc/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Build Source
2+
3+
This file will be more organized as time progresses. Because a lot of our
4+
plugins and systems require a moderate amount of cognitive overhead to understand,
5+
I thought it best to provide documentation for such systems. You can find the
6+
currently documented systems below:
7+
8+
[Dackka Plugin](src/main/java/com/google/firebase/gradle/plugins/DackkaPlugin.kt)
9+
10+
11+
* Note that this file currently only serves as a table of contents until sufficient documentation has been created.

buildSrc/build.gradle.kts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ dependencies {
4343

4444
implementation("com.google.auto.value:auto-value-annotations:1.8.1")
4545
annotationProcessor("com.google.auto.value:auto-value:1.6.5")
46-
implementation("digital.wup:android-maven-publish:3.6.3")
47-
implementation(kotlin("gradle-plugin", "1.4.32"))
46+
implementation(kotlin("gradle-plugin", "1.7.10"))
4847
implementation("org.json:json:20210307")
4948

5049
implementation("org.eclipse.aether:aether-api:1.0.0.v20140518")
@@ -57,8 +56,8 @@ dependencies {
5756
implementation("org.apache.maven:maven-aether-provider:3.1.0")
5857

5958
implementation("com.google.code.gson:gson:2.8.9")
60-
implementation("org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17-g013-9b8280a")
61-
implementation("com.android.tools.build:gradle:3.4.3")
59+
implementation("com.android.tools.build:gradle:7.2.2")
60+
implementation("com.android.tools.build:builder-test-api:7.2.2")
6261
implementation("gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9")
6362

6463
testImplementation("junit:junit:4.13.2")
@@ -72,10 +71,6 @@ gradlePlugin {
7271
id = "LicenseResolverPlugin"
7372
implementationClass = "com.google.firebase.gradle.plugins.license.LicenseResolverPlugin"
7473
}
75-
register("dackkaPlugin") {
76-
id = "DackkaPlugin"
77-
implementationClass = "com.google.firebase.gradle.plugins.DackkaPlugin"
78-
}
7974
register("multiProjectReleasePlugin") {
8075
id = "MultiProjectReleasePlugin"
8176
implementationClass = "com.google.firebase.gradle.MultiProjectReleasePlugin"
@@ -88,12 +83,10 @@ gradlePlugin {
8883
id = "firebase-library"
8984
implementationClass = "com.google.firebase.gradle.plugins.FirebaseLibraryPlugin"
9085
}
91-
9286
register("firebaseJavaLibraryPlugin") {
9387
id = "firebase-java-library"
9488
implementationClass = "com.google.firebase.gradle.plugins.FirebaseJavaLibraryPlugin"
9589
}
96-
9790
register("firebaseVendorPlugin") {
9891
id = "firebase-vendor"
9992
implementationClass = "com.google.firebase.gradle.plugins.VendorPlugin"

buildSrc/settings.gradle.kts

Lines changed: 0 additions & 13 deletions
This file was deleted.

buildSrc/src/main/java/com/google/firebase/gradle/plugins/DackkaGenerationTask.kt

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ import org.gradle.api.DefaultTask
66
import org.gradle.api.provider.ListProperty
77
import org.gradle.api.provider.Property
88
import org.gradle.api.provider.SetProperty
9+
import org.gradle.api.tasks.CacheableTask
10+
import org.gradle.api.tasks.Classpath
911
import org.gradle.api.tasks.Input
1012
import org.gradle.api.tasks.InputFile
1113
import org.gradle.api.tasks.InputFiles
1214
import org.gradle.api.tasks.OutputDirectory
15+
import org.gradle.api.tasks.PathSensitive
16+
import org.gradle.api.tasks.PathSensitivity
1317
import org.gradle.api.tasks.TaskAction
1418
import org.gradle.process.ExecOperations
1519
import org.gradle.workers.WorkAction
1620
import org.gradle.workers.WorkParameters
1721
import org.gradle.workers.WorkerExecutor
1822
import org.json.JSONObject
19-
2023
/**
2124
* Extension class for [GenerateDocumentationTask].
2225
*
@@ -29,26 +32,51 @@ import org.json.JSONObject
2932
* @property suppressedFiles a list of files to exclude from documentation
3033
* @property outputDirectory where to store the generated files
3134
*/
35+
@CacheableTask
3236
abstract class GenerateDocumentationTaskExtension : DefaultTask() {
33-
@get:InputFile
37+
@get:[InputFile Classpath]
3438
abstract val dackkaJarFile: Property<File>
3539

36-
@get:Input
40+
@get:[InputFiles Classpath]
3741
abstract val dependencies: ListProperty<File>
3842

3943
@get:InputFiles
44+
@get:PathSensitive(PathSensitivity.RELATIVE)
4045
abstract val kotlinSources: ListProperty<File>
4146

4247
@get:InputFiles
48+
@get:PathSensitive(PathSensitivity.RELATIVE)
4349
abstract val javaSources: ListProperty<File>
4450

4551
@get:InputFiles
52+
@get:PathSensitive(PathSensitivity.RELATIVE)
4653
abstract val suppressedFiles: ListProperty<File>
4754

55+
@get:InputFiles
56+
@get:PathSensitive(PathSensitivity.RELATIVE)
57+
abstract val packageListFiles: ListProperty<File>
58+
59+
@get:Input
60+
abstract val clientName: Property<String>
61+
4862
@get:OutputDirectory
4963
abstract val outputDirectory: Property<File>
5064
}
5165

66+
/**
67+
* Wrapper data class for External package-lists in Dokka
68+
*
69+
* This class allows us to map package-lists in a type-safe way, versus inline straight to
70+
* a map. This extra step could be removed- but it could also catch bugs in the future.
71+
*
72+
* @property packageList the prepared package-list file to map against
73+
* @property externalLink the url to map with when generating the docs
74+
*/
75+
data class ExternalDocumentationLink(
76+
val packageList: File,
77+
val externalLink: String
78+
)
79+
5280
/**
5381
* Task to run Dackka on a project.
5482
*
@@ -64,18 +92,10 @@ abstract class GenerateDocumentationTask @Inject constructor(
6492
@TaskAction
6593
fun build() {
6694
val configFile = saveToJsonFile(constructArguments())
67-
launchDackka(configFile, workerExecutor)
95+
launchDackka(clientName, configFile, workerExecutor)
6896
}
6997

7098
private fun constructArguments(): JSONObject {
71-
// TODO(b/243675474): Move these to a task input for caching purposes
72-
val linksMap = mapOf(
73-
"android" to "https://developer.android.com/reference/kotlin/",
74-
"google" to "https://developer.android.com/reference/",
75-
"firebase" to "https://firebase.google.com/docs/reference/kotlin/",
76-
"coroutines" to "https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/"
77-
)
78-
7999
val jsonMap = mapOf(
80100
"moduleName" to "",
81101
"outputDir" to outputDirectory.get().path,
@@ -90,9 +110,9 @@ abstract class GenerateDocumentationTask @Inject constructor(
90110
"documentedVisibilities" to listOf("PUBLIC", "PROTECTED"),
91111
"skipEmptyPackages" to "true",
92112
"suppressedFiles" to suppressedFiles.get().map { it.path },
93-
"externalDocumentationLinks" to linksMap.map { (name, url) -> mapOf(
94-
"url" to url,
95-
"packageListUrl" to "file://${project.rootDir.absolutePath}/kotlindoc/package-lists/$name/package-list"
113+
"externalDocumentationLinks" to createExternalLinks(packageListFiles).map { mapOf(
114+
"url" to it.externalLink,
115+
"packageListUrl" to it.packageList.toURI()
96116
) }
97117
)),
98118
"offlineMode" to "true",
@@ -102,6 +122,20 @@ abstract class GenerateDocumentationTask @Inject constructor(
102122
return JSONObject(jsonMap)
103123
}
104124

125+
private fun createExternalLinks(packageLists: ListProperty<File>): List<ExternalDocumentationLink> {
126+
val linksMap = mapOf(
127+
"android" to "https://developer.android.com/reference/kotlin/",
128+
"google" to "https://developers.google.com/android/reference/",
129+
"firebase" to "https://firebase.google.com/docs/reference/kotlin/",
130+
"coroutines" to "https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/"
131+
)
132+
133+
return packageLists.get().map {
134+
val externalLink = linksMap[it.parentFile.nameWithoutExtension] ?: throw RuntimeException("Unexpected package-list found: ${it.name}")
135+
ExternalDocumentationLink(it, externalLink)
136+
}
137+
}
138+
105139
private fun saveToJsonFile(jsonObject: JSONObject): File {
106140
val outputFile = File.createTempFile("dackkaArgs", ".json")
107141

@@ -111,13 +145,13 @@ abstract class GenerateDocumentationTask @Inject constructor(
111145
return outputFile
112146
}
113147

114-
private fun launchDackka(argsFile: File, workerExecutor: WorkerExecutor) {
148+
private fun launchDackka(clientName: Property<String>, argsFile: File, workerExecutor: WorkerExecutor) {
115149
val workQueue = workerExecutor.noIsolation()
116150

117151
workQueue.submit(DackkaWorkAction::class.java) {
118152
args.set(listOf(argsFile.path, "-loggingLevel", "WARN"))
119153
classpath.set(setOf(dackkaJarFile.get()))
120-
projectName.set(project.name)
154+
projectName.set(clientName)
121155
}
122156
}
123157
}

0 commit comments

Comments
 (0)