Skip to content

Conversation

tido64
Copy link
Member

@tido64 tido64 commented Feb 4, 2021

Description

JCenter is being sunset: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

Platforms affected

  • Android
  • iOS
  • macOS
  • Windows

Test plan

CI should pass.

@tido64 tido64 added the platform: Android This affects Android label Feb 4, 2021
Copy link
Contributor

@kelset kelset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving it with the blind faith that CI will just go smoothly 🤞

@arazabishov
Copy link
Member

arazabishov commented Feb 4, 2021

Android Gradle Plugin has a dependency on jetbrains/trove4j that seems to exist only on jCenter. If we can find a mirror repo that has it too, adding it should fix the problem (a quick search didn't help though). Alternatively, we can wait a little until Google gives official guidance on migration.

@kelset
Copy link
Contributor

kelset commented Feb 4, 2021

Allright, as basically we expected, by moving away from jcenter() we are hitting the infamous:

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all artifacts for configuration ':app:classpath'.
   > Could not find org.jetbrains.trove4j:trove4j:20160824.

For which all the workarounds on StackOverflow are literally to revert the change: move from mavenCentral() to jcenter() (one, two, three).
Which is, and will be, a no-go.

Now. Here's the situation:

  • trove4j is a library for Java that is (luckily) OSS over on Bitbucket. Last activity on it is from 2018‑11‑08, so over 2 years ago.
  • trove4j was forked by the JetBrains folks into a new package that is used in IntelliJ IDEA, intellij-deps-trove4j. So if I'd have to guess, there will be published version of it - something along the lines of org.jetbrains.intellij.deps.trove4j - available in mavenCentral; or at least that what this commit seems to imply. Sidenote, that commit is dated around 1 month after last activity on the other repo (and last activity is around Mar 2020).

So here the alternatives:

  1. somehow, we get someone to publish the old org.jetbrains.trove4j:trove4j to mavenCentral(). I don't know enough about maven to know how publishing there could work - I have the slight assumption that it's just broken enough that it won't actually verify that the package is being published by an "authorized maintainer" working from jetbrains, and given that as a dependency in maven it doesn't seem to be bound to a specific version, it could be the smoothest way to fix this. If that's viable, the change done in this PR will be just good enough to fix the problem on the "end user" codebase side.
    • this might also become a more general workaround, along the lines of publishing an npm package with the .jar, and use a local maven repo reference in the build.gradle
  2. variation of 1, where we reach out to the maintainers of the unmaintained version on Bitbucket (Author.txt) and ask them to publish their package to mavenCentral.

If neither of those are viable, it's gonna be a fun ride. Let's throw some ideas:

  • if gradle files allow for some sort of "redirect" of a dependency, we could try to redirect the org.jetbrains.trove4j:trove4j to point to the Intellij alternative. And see what happens.
  • we figure out what/where React Native uses trove4j, and modify the source code to consume the IntelliJ version (note well: at this point in time I haven't dove in the RN source code to find how it's used yet).

This will mean that only new releases of React Native will survive - even if we went back and patched ex. 0.61, 0.62, 0.63 with this change, previous versions/not-latest patches will all break. Also, this will still require all the developers that have a RN app to change their code too to remove the jcenter() reference.

PS: in all of this I haven't even considered if this is trove4j is also being used by some third party package, in which case it will be even more fun 💀


EDIT: As pointed out by @arazabishov, I could actually confirm that trove4j is not actually used directly in the React Native codebase. That said, there are a few reference to jcenter across the code that will need to be removed (I am not sure these will directly affect any given existing RN app).
I guess we'll have to keep our eyes out to see what happens on the Android Gradle Plugin side.

@sweggersen
Copy link
Member

sweggersen commented Feb 4, 2021

Running ./gradlew app:dependencies in our test apps reveal the following. Looks like this is used in com.android.tools:sdk-common:26.6.0. There's also a different dependency to trove in multiple kotlin plugins, but I don't know if those only live in JCenter too. I guess Google will have to update their dependency.. Will this break backwards compatibility for all Android apps 🤔

See the logs results

--- com.android.tools.lint:lint-gradle:26.6.0
+--- com.android.tools:sdk-common:26.6.0
| +--- com.android.tools:sdklib:26.6.0
| | +--- com.android.tools.layoutlib:layoutlib-api:26.6.0
| | | +--- com.android.tools:common:26.6.0
| | | | +--- com.android.tools:annotations:26.6.0
| | | | +--- com.google.guava:guava:27.1-jre
| | | | | +--- com.google.guava:failureaccess:1.0.1
| | | | | +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
| | | | | +--- com.google.code.findbugs:jsr305:3.0.2
| | | | | +--- org.checkerframework:checker-qual:2.5.2
| | | | | +--- com.google.errorprone:error_prone_annotations:2.2.0
| | | | | +--- com.google.j2objc:j2objc-annotations:1.1
| | | | | --- org.codehaus.mojo:animal-sniffer-annotations:1.17
| | | | --- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61
| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.61
| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.61
| | | | | --- org.jetbrains:annotations:13.0
| | | | --- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61
| | | | --- org.jetbrains.kotlin:kotlin-stdlib:1.3.61 ()
| | | +--- net.sf.kxml:kxml2:2.3.0
| | | +--- com.android.tools:annotations:26.6.0
| | | --- org.jetbrains:annotations:13.0
| | +--- com.android.tools:dvlib:26.6.0
| | | --- com.android.tools:common:26.6.0 (
)
| | +--- com.android.tools:repository:26.6.0
| | | +--- com.android.tools:common:26.6.0 ()
| | | +--- com.sun.activation:javax.activation:1.2.0
| | | +--- org.apache.commons:commons-compress:1.12
| | | +--- org.glassfish.jaxb:jaxb-runtime:2.3.1
| | | | +--- javax.xml.bind:jaxb-api:2.3.1
| | | | | --- javax.activation:javax.activation-api:1.2.0
| | | | +--- org.glassfish.jaxb:txw2:2.3.1
| | | | +--- com.sun.istack:istack-commons-runtime:3.0.7
| | | | +--- org.jvnet.staxex:stax-ex:1.8
| | | | +--- com.sun.xml.fastinfoset:FastInfoset:1.2.15
| | | | --- javax.activation:javax.activation-api:1.2.0
| | | +--- com.google.jimfs:jimfs:1.1
| | | | --- com.google.guava:guava:18.0 -> 27.1-jre (
)
| | | --- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 ()
| | +--- com.google.code.gson:gson:2.8.5
| | +--- org.apache.commons:commons-compress:1.12
| | +--- org.apache.httpcomponents:httpmime:4.5.6
| | | --- org.apache.httpcomponents:httpclient:4.5.6
| | | +--- org.apache.httpcomponents:httpcore:4.4.10
| | | +--- commons-logging:commons-logging:1.2
| | | --- commons-codec:commons-codec:1.10
| | --- org.apache.httpcomponents:httpcore:4.4.10
| +--- com.android.tools.build:builder-test-api:3.6.0
| | --- com.android.tools.ddms:ddmlib:26.6.0
| | +--- com.android.tools:common:26.6.0 (
)
| | --- net.sf.kxml:kxml2:2.3.0
| +--- com.android.tools.build:builder-model:3.6.0
| | --- com.android.tools:annotations:26.6.0
| +--- com.android.tools.ddms:ddmlib:26.6.0 ()
| +--- com.android.tools.analytics-library:shared:26.6.0
| | +--- com.android.tools.analytics-library:protos:26.6.0
| | | --- com.google.protobuf:protobuf-java:3.4.0
| | +--- com.android.tools:annotations:26.6.0
| | +--- com.android.tools:common:26.6.0 (
)
| | +--- com.google.guava:guava:27.1-jre ()
| | +--- com.google.code.gson:gson:2.8.5
| | --- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 (
)
| +--- org.bouncycastle:bcpkix-jdk15on:1.56
| | --- org.bouncycastle:bcprov-jdk15on:1.56
| +--- org.bouncycastle:bcprov-jdk15on:1.56
| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 ()
| +--- org.jetbrains.kotlin:kotlin-reflect:1.3.61
| | --- org.jetbrains.kotlin:kotlin-stdlib:1.3.61 (
)
| +--- com.google.protobuf:protobuf-java:3.4.0
| +--- javax.inject:javax.inject:1
| +--- org.jetbrains.trove4j:trove4j:20160824
| --- com.android.tools.build:aapt2-proto:0.4.0
| --- com.google.protobuf:protobuf-java:3.4.0
...

kotlinCompilerClasspath
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20
| --- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.20
+--- org.jetbrains.kotlin:kotlin-reflect:1.4.20
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 (*)
+--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.20
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211

kotlinCompilerPluginClasspath
--- org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20
| --- org.jetbrains:annotations:13.0
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 ()
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.20
+--- org.jetbrains.kotlin:kotlin-reflect:1.4.20
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 (
)
+--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.20
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211

kotlinKaptWorkerDependencies
--- org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20
| --- org.jetbrains:annotations:13.0
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 ()
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.20
+--- org.jetbrains.kotlin:kotlin-reflect:1.4.20
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 (
)
+--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.20
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211

kotlinKlibCommonizerClasspath
--- org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20
| --- org.jetbrains:annotations:13.0
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.20
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 ()
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.20
+--- org.jetbrains.kotlin:kotlin-reflect:1.4.20
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.20 (
)
+--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.20
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211


EDIT: @kelset, to put the logs into details tag.

@arazabishov
Copy link
Member

arazabishov commented Feb 4, 2021

Another thing to keep in mind is that Gradle spits out errors 1 by 1 while trying to resolve dependencies. We don't know if any other libraries are missing on mavenCentral. In other words, jetbrains/trove4j can be only the beginning.

Since the shutdown of jCenter() will break all Android builds in the world, I suggest that we wait until Google provides a solution to this problem 🤠

@kelset
Copy link
Contributor

kelset commented Feb 4, 2021

Update on the Google side - I went into the deep end and git clone'd the Android platform source code to see how things are there - via git clone https://android.googlesource.com/platform/tools/base.

It looks like they already migrated from org.jetbrains.trove4j:trove4j:20160824 to org.jetbrains.intellij.deps:trove4j:1.0.20200330 (see my previous comment) 3 months ago, with this commit. But I don't know what this means in terms of releases.

But I don't know if that trove4j is also used somewhere else.

@tido64 tido64 force-pushed the tido64/jcenter-mavencentral branch from 107db5e to 55f96b9 Compare April 3, 2021 09:24
@tido64 tido64 marked this pull request as ready for review April 3, 2021 09:25
Copy link
Contributor

@kelset kelset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea to force the resolution to use the new intelliJ version! I really like it 👍

@tido64 tido64 merged commit 7af24bd into master Apr 7, 2021
@tido64 tido64 deleted the tido64/jcenter-mavencentral branch April 7, 2021 14:34
@github-actions
Copy link

github-actions bot commented Apr 7, 2021

🎉 This PR is included in version 0.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android This affects Android released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants