Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please publish yoga-layout on Maven Central #1065

Closed
1 task done
ganadist opened this issue Feb 8, 2021 · 25 comments
Closed
1 task done

Please publish yoga-layout on Maven Central #1065

ganadist opened this issue Feb 8, 2021 · 25 comments

Comments

@ganadist
Copy link

ganadist commented Feb 8, 2021

Report

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

JCenter will be unavailable on May 1, 2021.
But it seems yoga-layout is available on JCenter only.
https://mvnrepository.com/artifact/com.facebook.yoga.android/yoga-layout?repo=jcenter

@minyushov
Copy link

React Native depends on com.facebook.yoga:proguard-annotations which is also available on JCenter only.
It means we can't build any project that uses React Native after May 1, 2021.

@Naomarik
Copy link

Yes please. As of posting this, jcenter is down due to some technical issues and I'm unable to get this dependency.

@pke
Copy link

pke commented Mar 16, 2021

This is really important and just shows how brittle external dependencies really are.
Can we work with offline caches easily or create our own artifact respository clone?

@Naomarik
Copy link

This is really important and just shows how brittle external dependencies really are.
Can we work with offline caches easily or create our own artifact respository clone?

I'm honestly surprised the build process didn't use any offline cache. I had compiled this project many times before on MacOS and WSL2. When jcenter went down, both would not compile.

@mikehardy
Copy link

You can force gradle to prefer offline or go offline only, it's a command line flag.
That said this is a vital change.

@mikehardy
Copy link

Note that:

  • jitpack.io is not even able to find tag 1.14.1 (the react-native dependency for the 0.64.0 release) because it was apparently never tagged here so it obviously can't build it
  • jitpack.io did try to build some recent ones plus I just triggered a build of 1.14.0 and they all fail with this:

{"cookie":"","inReplyTo":"configure","message":"CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.","title":"Error","type":"message"}

Which looks like this failure to set the CMAKE program more or less (yes, windows paths, but probably adaptable): https://stackoverflow.com/a/64917390/9910298

This project appears to be a transitive dependency of react-native via flipper as well, so it is critical this is updated soon as multiple projects needs updated releases I think before jcenter can be purged

@d4vidi
Copy link

d4vidi commented Apr 20, 2021

Here's a work-around for the time being:
I also got bit by the proguard-annotations artifact (as the indirect dep through react native), personally, but this should work for yoga-layout as well.
In any case, I don't like to wait for the last minute, and also - we're all expecting another prescheduled brown-out downtime next week (April 26th) by Bintray. So here's what I moved forward with:

  1. Directly download (TODAY) the missing artifact from Bintray. For example, for proguard-annotations version 1.14.1, browse your way to the .jar file in https://bintray.com/facebook/maven/com.facebook.yoga%3Aproguard-annotations/1.14.1#files.
  2. Place the .jar in your project's android/libs (yes, it should be commited+pushed to Github until this is fixed).
  3. In your root build.gradle, apply this repo definition:
allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        // ... 
+        flatDir {
+            dirs "$rootProject.projectDir/libs"
+        }
    }
}
(Add `allproject` entirely, if it's missing in your project)
  1. Replace the standard react native dep in your app/build.gradle like so:
dependencies {
-    implementation 'com.facebook.react:react-native:+'
+    implementation 'com.facebook.fbjni:fbjni-java-only:0.0.4'
+    implementation('com.facebook.react:react-native:+') {
+        exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'
+        exclude group: 'com.facebook.yoga', module: 'proguard-annotations'
+    }
}

@mikehardy
Copy link

mikehardy commented Apr 20, 2021

@d4vidi that's an interesting approach, you are on to something there. This is a potential start towards something automated for people that can't update.

Examine this if you have time: https://github.com/ankidroid/Anki-Android/blob/master/AnkiDroid/robolectricDownloader.gradle - the idea is to pre-download maven artifacts you'll need later

I wrote that in order to have external dependency download de-flaked in an E2E CI type pipeline where the downloads were failing builds and giving me a fail signal outside of my code changes. With that and an exponential-back-off-retry I have great signal to noise.

But - if the general idea of "you can have a gradle task that downloads dependencies before your real build" is combined with the idea of "react-native jcenter dependencies may be downloaded"...

1- store the problematic in-use artifacts on the official react-native github somewhere (or on their respective project pages) as downloadable things - have a known list of them, I think there are only a handful (yoga android-annotations, 2 flipper plugins, fbjni)

2- write a downloader script for them like the above

3- integrate that in to patch releases of RN CLI?

It could be just as terrible + functional as https://github.com/mikehardy/jetifier :-), which is and was kind of gross but also just glossed over the whole AndroidX migration for everyone at once and made it go away...

@mikehardy
Copy link

mikehardy commented Apr 20, 2021

If done well it requires no external approval or waiting actually - a repo could simply get them now even if it wouldn't be officially blessed, write the task and throw them in the local ~/.m2 and integration of the package is to add an apply ... statement in your build script (something semi-normal for packages to ask) and make sure mavenLocal is in your repo list in build.gradle, so as a proof-of-concept it could be demonstrated prior to involving the official repos (so the artifacts are more official) or the RN CLI (so the task is included / default-on like jetifier for everyone)

Note that it may be useful to develop this capability regardless of the dependencies we know about being fixed, as there is always some other thing we did not know about. And if we have this capability then someone somewhere can get a copy of the artifact, post it in the downloadable spot, we can add it to the npm package for an update to the list and everyone is auto-fixed again until versions are actually updated (similar to jetifier which did have some missing edge cases at the start until adoption was 100% and is still a lifesaver for folks on RN59 etc)

@d4vidi
Copy link

d4vidi commented Apr 20, 2021

@mikehardy That could actually make a really cool solution. Perhaps we could even publish it as a Gradle plugin - I wonder.

@mikehardy
Copy link

Just a quick note here: JCenter is on record as saying they will leave the repo up in read-only mode, so this is not urgent any longer

However it is important (despite not being urgent) to have ability to publish somewhere/anywhere else, so I believe the issue is still valid

Cheers

@joe-goodall-ticketmaster
Copy link

joe-goodall-ticketmaster commented Jun 16, 2021

I know there's an update that JCenter will be kept as a read-only repository indefinitely but yoga-layout is failing with a 403 on JCenter but works on maven.

Does this mean the migration from jcenter() to mavenCentral() is necessary after all?

@PhilipBrew
Copy link

PhilipBrew commented Jul 7, 2021

As of Monday (5th July 2021) I've been getting this issue, and it seems I've missed the boat in terms of grabbing the artefact from Bintray so feel like I'm a bit stuck. I'm not really an Android dev and use Yoga through React Native.

`Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.

Could not find com.facebook.yoga:proguard-annotations:1.14.1.
Required by:
project :app > com.facebook.react:react-native:0.63.2
Could not find com.facebook.fbjni:fbjni-java-only:0.0.3.
Required by:
project :app > com.facebook.react:react-native:0.63.2`

Full build scan is here: https://scans.gradle.com/s/lyge6fz762tsu/

Seems whereas JCenter has until Feb 2022 and will be available read-only, Bintray went 4th July https://status.bintray.com/

@mikehardy
Copy link

@PhilipBrew So for now you just need the jcenter maven repository and it should work?

https://github.com/facebook/react-native/blob/757bb75fbf837714725d7b2af62149e8e2a7ee51/template/android/build.gradle#L13

I'm still building successfully at least

Appears that react-native 0.65 when it's released will have evicted jcenter completely based on the template alterations visible on that branch facebook/react-native@9a923be

@PhilipBrew
Copy link

PhilipBrew commented Jul 8, 2021

@mikehardy Yeah I think so long as I can grab the .jar file I will be able to do @d4vidi workaround above. I then anticipate some of the other packages I'm using to throw the same issues however.

I'm really unsure why I'm suddenly unable to build Android but the wider community as a whole seem to be fine, at least for now. Apologies if we should be having this conversation somewhere else, but it feels like I'm missing something when a base create-react-native-app does indeed build

EDIT: I bumped gradle from 3.5.3 to classpath("com.android.tools.build:gradle:3.5.4") and also realised I needed to add mavenCentral() before jcenter() rather than in place of. After some fiddling I am building again but a few packages I've had to turn off abortOnError in lintOptions for. Namely ml-vision which brings me full circle to the status of this? 🤯invertase/react-native-firebase#4555

@cortinico
Copy link
Contributor

It seems like yoga-layout is actually on Maven Central:
https://search.maven.org/artifact/com.facebook.yoga.android/yoga-layout/1.19.0/aar

Is there anything left to be done here then?

@minyushov
Copy link

com.facebook.yoga:proguard-annotations still not published to Maven Central

@cortinico
Copy link
Contributor

com.facebook.yoga:proguard-annotations still not published to Maven Central

It seems like it is https://search.maven.org/artifact/com.facebook.yoga/proguard-annotations/1.19.0/jar

@minyushov
Copy link

Oops, somehow I was unable to find it...
Indeed, It looks like the issue is resolved.

@valentinmakov
Copy link

valentinmakov commented Sep 17, 2021

It seems like it is https://search.maven.org/artifact/com.facebook.yoga/proguard-annotations/1.19.0/jar

Our project needs com.facebook.yoga:proguard-annotations:1.14.1 which is still absent on Maven Central

@cortinico
Copy link
Contributor

Our project needs com.facebook.yoga:proguard-annotations:1.14.1 which is still absent on Maven Central

Out of curiosity: why can't you update to the latest version?

@kelset
Copy link

kelset commented Sep 17, 2021

maybe this help: it looks like to be on 1.19 you need to be using RN65 - RN64 is still on 1.14: https://github.com/facebook/react-native/blob/0.64-stable/ReactAndroid/build.gradle

@valentinmakov
Copy link

@cortinico @kelset You are right, guys. This is my fault. Since we moved to RN 0.65, 1.14 is not needed anymore. Didn't see it myself. Thanks! :-)

@cortinico
Copy link
Contributor

Our project needs com.facebook.yoga:proguard-annotations:1.14.1 which is still absent on Maven Central

Just a heads up: com.facebook.yoga:proguard-annotations:1.14.1 has now been republished to MavenCentral so users on RN 0.64.x would be able to build while fetching this artifact from mavenCentral() rather than jcenter() in case of an outage:

https://repo1.maven.org/maven2/com/facebook/yoga/proguard-annotations/1.14.1/

@NickGerleman
Copy link
Contributor

It looks like @cortinico has taken care of this. Please let me know if there is anything still pending on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests