Open yogurtearl opened 1 year ago
Hi @yogurtearl, thanks for reaching out. While we investigate this, any chance you could share a minimal reproducible example of the issue? Thanks!
Are you intending to extend the plugin or something? I am curious why you apply it this was as a dep in your build-logic, instead of applied as a typical gradle plugin? The issue might have something to do with that, I can play with it but I want to understand the use case more please.
Hey @yogurtearl. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I have a precompiled script plugin that applies the firebase plugin, but because it is not declaring it's deps properly it fails when gradle tries to generate the accessors.
This script will reproduce the issue on macOS, assuming you have gradle 8.x installed locally.
This uses the built in kotlin-dsl
plugin to create a precompiled script plugin.
https://docs.gradle.org/current/userguide/custom_plugins.html#sec:precompiled_plugins
#!/usr/bin/env zsh
tmpdir=$(/usr/bin/mktemp -d /tmp/repro_5473.XXXXXX)
cd "$tmpdir" || exit
mkdir -p "$tmpdir/src/main/kotlin/"
cat <<"BUILD_FILE" > "$tmpdir/build.gradle.kts"
plugins {
`kotlin-dsl`
}
repositories {
google()
mavenCentral()
}
dependencies {
implementation("com.google.firebase.crashlytics:com.google.firebase.crashlytics.gradle.plugin:2.9.9")
}
BUILD_FILE
cat <<"PLUGIN_FILE" > "$tmpdir/src/main/kotlin/myplugin.gradle.kts"
plugins {
id("com.google.firebase.crashlytics")
}
PLUGIN_FILE
gradle build --stacktrace
echo "$tmpdir"
will result in:
Caused by: java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpRequestBase
at com.google.firebase.crashlytics.buildtools.Buildtools.createWebApi(Buildtools.java:64)
at com.google.firebase.crashlytics.buildtools.Buildtools.getInstance(Buildtools.java:107)
at com.google.firebase.crashlytics.buildtools.Buildtools$getInstance$0.call(Unknown Source)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.configureBuildtools(CrashlyticsPlugin.groovy:133)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.apply(CrashlyticsPlugin.groovy:73)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.apply(CrashlyticsPlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)
.
.
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpRequestBase
at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:186)
... 196 more
BUILD FAILED in 1s
4 actionable tasks: 4 executed
This can be fixed by adding the httpclient
dependency to your published pom file.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
Is the source code for the firebase crashlytics gradle plugin open source?
Unfortunately is it not open sourced. I am advocating for open sourcing our Gradle plugin, but it is not a high priority right now.
I have a hunch your issue is caused by a failure in the way we package the fat jar. We do include httpclient, but we also namespace it so it does not interfere with your other Gradle plugins that may depend on an incompatible version of httpclient. We validate it with the typical workflow, that is simply applying the plugin in a project. Your workflow is different, and we don't have a functional test for it. I will add one, and fix the fat jar, but it might not happen until other high priority issues are addressed first.
[READ] Step 1: Are you in the right place?
yes
[REQUIRED] Step 2: Describe your environment
8.4
8.1.2
2.9.9
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Apply the firebase gradle plugin via a precompiled script plugin in
build-logic/
i.e. at
build-logic/src/main/kotlin/firebase.gradle.kts
you would have:that plugin uses
org.apache.http.client.methods.HttpRequestBase
which comes fromorg.apache.httpcomponents:httpclient
but thepom.xml
does NOT declare this dependency.This pom needs to add
org.apache.httpcomponents:httpclient
as a dependency: https://dl.google.com/android/maven2/com/google/firebase/firebase-crashlytics-buildtools/2.9.9/firebase-crashlytics-buildtools-2.9.9.pomSee error below.
workaround
Add this to your
build-logic/build.gradle.kts
:ERROR