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

[GENERAL][BUGFIX][build] - patch v5 build toolchains for XCode10.2 & RN0.59 compatibility #2166

Merged
merged 4 commits into from
May 26, 2019

Conversation

mikehardy
Copy link
Collaborator

@mikehardy mikehardy commented May 26, 2019

Summary

As near as I can tell the v5.x.x branch does not currently build (it certainly doesn't pass CircleCI) owing to various areas of bitrot

This PR aims to start with the v5.3.1 tag (the most recent release tag? maybe I missed one) and simply get it working before building on it for future releases

The change involved patching:

  • detox: manually on the existing dependency so that XCode 10.2 may be used (even though you fixed CircleCI to 10.1, can't test it locally without this). Was just a 'SWIFT_VERSION' change
  • detox: via patch-package so that gradle versions will work with RN0.59 (android API 28)
  • jet: a branch off the v0.3.0 tag from jet to allow gradle overrides (android API 28 here too)

All of that is just toolchain work, nothing semantic was done.

Android and iOS installs and builds for me locally now and on CI, with all patches from v5.3.1 integrated, and my work overriding just the minimal gradle changes from tip of v5.x.x to make it work again - I left in the Firebase SDK and gradle version bumps

One of the dependencies is currently pointing to a local jet fork but if PR invertase/jet#13 is merged and a jet v0.3.1 is released it should be pointed back to the official upstream repo again

Checklist

  • Supports Android
  • Supports iOS
  • e2e tests added or updated in /tests/e2e/*
  • Updated the documentation in the docs repo
    • LINK TO DOCS PR HERE
  • Flow types updated
  • Typescript types updated

Test Plan

This whole PR is just to make CI work so we can run the tests! :-)

Release Plan

[GENERAL][BUGFIX][build] - patch build toolchains for XCode10.2 & RN0.59 compatibility


Think react-native-firebase is great? Please consider supporting the project with any of the below:

@mikehardy
Copy link
Collaborator Author

The last commit is my reverting the build changes made after v5.3.1 tag that moved to incompatible / AndroidX detox - those were a non-starter I think, thus my approach of just carefully patching from v5.3.1 without moving versions much.

This whole thing may be terrible though, you can look and see :-). Fingers crossed for CircleCI to go green either way

@mikehardy mikehardy changed the title V5.3.1 dev [GENERAL][BUGFIX][build] - patch v5 build toolchains for XCode10.2 & RN0.59 compatibility May 26, 2019
@mikehardy
Copy link
Collaborator Author

Okay - so definitely needs some of your changes past v5.3.1 to build, I de-conflicted android/build.gradle but there is still something attempting to use kotlinVersion past the v5.3.1 tag, and now that it's gone that blows up the android build on the branch

@mikehardy
Copy link
Collaborator Author

I just force-pushed again (and maybe the last time?) after rebasing to tip of v5.x.x and manually fixing conflicts to get everything working with local testing (as opposed to just hand-hacking it in the github web ui). I think this one is going to pass CI

My packager (yarn run packager-jet) works now too, as you'd fixed that in a commit later than v5.3.1

@mikehardy
Copy link
Collaborator Author

mikehardy commented May 26, 2019

CI has gone green
color of grass on Fuji
so ephemeral

(well, for android anyway, the ios-e2e-test failed on a crashlytics thing locally even if it passes in CircleCI but I had nothing to do with that...)

@Salakar
Copy link
Member

Salakar commented May 26, 2019

Well, I'll be damned, thanks so much for this @mikehardy, MVP.

Any objections if I merge as is? I can run the android e2e tests locally then (CI not setup for this until v6 - it only runs iOS e2e tests right now) - if all is well I will publish a v5.4.0 I guess. Can look at the jet PR during the week then

Feel free to invoice the Open Collective again (ignore the hourly limits) as you've clearly worked hard on this and saved us a ton of time.

@invertase invertase deleted a comment from codecov bot May 26, 2019
@invertase invertase deleted a comment from codecov bot May 26, 2019
@invertase invertase deleted a comment from codecov bot May 26, 2019
@invertase invertase deleted a comment from codecov bot May 26, 2019
@mikehardy
Copy link
Collaborator Author

mikehardy commented May 26, 2019

I have no objections, it's as surgical as I can make it, and though having the jet dependency point to some random developer's fork (mine) isn't 100%, it isn't so weird when it's all transparent on github. And I am strongly motivated by self-interest to see the v5 branch stable so I'm not going to go blow it up myself :-)

@mikehardy
Copy link
Collaborator Author

As an aside, this is just a preview of the crapshow the AndroidX transition is going to be, with the Detox v12 thing. Moving forward I think we can use jetifier in reverse mode to process AARs but that kills the ability for people to easily fork and depend on local forks of react-native modules, or use patch-package, because the AAR is a processed artifact. Going to be messy...

@Salakar
Copy link
Member

Salakar commented May 26, 2019

and though having the jet dependency point to some random developer's fork (mine) isn't 100%

Only a temporary measure, will get a 0.3.x patch published during the week based on the PR you submitted there

As an aside, this is just a preview of the crapshow the AndroidX transition is going to be, with the Detox v12 thing.

Only going to get worse with React Native 0.60.x 😞 thankfully v6 will target >0.60, so we can use AndroidX without worrying too much about backwards compat, v6 tests run on detox ^12.5.0 also without issue 🤞 .

@Salakar Salakar merged commit 631ff70 into invertase:v5.x.x May 26, 2019
@Salakar
Copy link
Member

Salakar commented May 26, 2019

Running e2e tests locally - will report back 👍

@mikehardy
Copy link
Collaborator Author

Awesome - I hadn't set up a Testing AVD like the docs and run them locally, I was trusting (dangerously) that because my changes were minimal and the build worked before that it should work again without change, but if not I'll take this back, make a testing AVD and fuzzbust through there on android-e2e-test

@Salakar
Copy link
Member

Salakar commented May 26, 2019

Am getting a crash relating to RN Argument serialisation; am looking into it now - I think I know what it is though as its something that came up recently for v6 - don't think it's related to any of your changes 👍

It did build and get through a fair chunk of tests so it's really good progress at least 🔥

cc @Ehesp - this is the JSON serialise issue I mentioned the other day to look out for when refactoring Database serialisation utils - so we should probably revert those changes to those serialize methods on your Database branch.

2019-05-26 23:36:37.637 12622-12622/com.invertase.testing E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.invertase.testing, PID: 12622
    java.lang.IllegalArgumentException: Could not convert class org.json.JSONObject$1
        at com.facebook.react.bridge.Arguments.addEntry(Arguments.java:117)
        at com.facebook.react.bridge.Arguments.makeNativeMap(Arguments.java:133)
        at com.facebook.react.bridge.Arguments.makeNativeObject(Arguments.java:34)
        at com.facebook.react.bridge.Arguments.makeNativeArray(Arguments.java:57)
        at io.invertase.firebase.Utils.mapPutValue(Utils.java:92)
        at io.invertase.firebase.Utils.mapPutValue(Utils.java:98)
        at io.invertase.firebase.auth.RNFirebaseAuth$33.onComplete(RNFirebaseAuth.java:1552)
        at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-05-26 23:36:37.642 12622-12622/com.invertase.testing E/MonitoringInstr: Exception encountered by: Thread[main,5,main]. Dumping thread state to outputs and pining for the fjords.
    java.lang.IllegalArgumentException: Could not convert class org.json.JSONObject$1
        at com.facebook.react.bridge.Arguments.addEntry(Arguments.java:117)
        at com.facebook.react.bridge.Arguments.makeNativeMap(Arguments.java:133)
        at com.facebook.react.bridge.Arguments.makeNativeObject(Arguments.java:34)
        at com.facebook.react.bridge.Arguments.makeNativeArray(Arguments.java:57)
        at io.invertase.firebase.Utils.mapPutValue(Utils.java:92)
        at io.invertase.firebase.Utils.mapPutValue(Utils.java:98)
        at io.invertase.firebase.auth.RNFirebaseAuth$33.onComplete(RNFirebaseAuth.java:1552)
        at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-05-26 23:36:37.654 12622-12622/com.invertase.testing E/THREAD_STATE:   Thread[OkHttp http://10.0.2.2:8081/...,5,main]
        java.net.SocketInputStream.socketRead0(Native Method)
        java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
        java.net.SocketInputStream.read(SocketInputStream.java:176)
        java.net.SocketInputStream.read(SocketInputStream.java:144)
        okio.Okio$2.read(Okio.java:140)
        okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
        okio.RealBufferedSource.request(RealBufferedSource.java:68)
        okio.RealBufferedSource.require(RealBufferedSource.java:61)
        okio.RealBufferedSource.readByte(RealBufferedSource.java:74)
        okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:117)
        okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:101)
        okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
        okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
        okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
        okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        java.lang.Thread.run(Thread.java:764)
    
      Thread[OkHttp ConnectionPool,5,main]
        java.lang.Object.wait(Native Method)
        okhttp3.ConnectionPool$1.run(ConnectionPool.java:67)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        java.lang.Thread.run(Thread.java:764)
    
      Thread[OkHttp WebSocket http://10.0.2.2:8081/...,5,main]
        java.lang.Object.wait(Native Method)
        java.lang.Thread.parkFor$(Thread.java:2137)
        sun.misc.Unsafe.park(Unsafe.java:358)
        java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
        java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059)
        java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1120)
        java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:849)
        java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        java.lang.Thread.run(Thread.java:764)
    
      Thread[Queue,10,main]
        java.lang.Object.wait(Native Method)
        java.lang.Thread.parkFor$(Thread.java:2137)
        sun.misc.Unsafe.park(Unsafe.java:358)
        java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
        java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059)
        java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:548)
        io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
        io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
        io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
        io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
        java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        java.lang.Thread.run(Thread.java:764)
    
      Thread[pool-3-thread-1,5,main]
        java.lang.Object.wait(Native Method)
        java.lang.Thread.parkFor$(Thread.java:2137)
        sun.misc.Unsafe.park(Unsafe.java:358)
        java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
        java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
        java.util.

@Salakar
Copy link
Member

Salakar commented May 27, 2019

Right, all sorted with all e2e tests passing, had to upgrade android dependencies to work around run time crashes (#2122); which then caused the above serialisation issue so fixed that in f80338f - native dev is fun 👀

image

Published a v5.4.0 version to npm, updated the docs & change log and upgraded the starter 👍

Thanks again for the assist on this @mikehardy - as mentioned above, feel free to invoice the Open Collective again (ignore the hourly limits), you saved me a lot of time with this.

@mikehardy
Copy link
Collaborator Author

Very cool! Now that this freshly shaven yak is sent back to the herd, the second next one in line is to get a notification/messaging demo app going (ideally fully automated). Not that there are a lot of problems in the library there but I personally am having difficulty in my project and it's the next biggest issue generator in the repo I think. Unfortunately it's blocked by the imposing yak that is #2163 where for some reason the header file search paths or messed up on fresh installs. One by one I/we'll get them though

robertbarclay added a commit to robertbarclay/react-native-firebase that referenced this pull request May 28, 2019
* v5.x.x:
  5.4.0
  [tests] disable admob (has a new runtime check that causes a crash as we don't have a valid admob identifier)
  [android] update firebase sdk versions - forced to upgrade due to invertase#2122
  [android][internals] rework internals utils to better support JSONObject/Array values
  [GENERAL][BUGFIX][build] - patch v5 build toolchains for XCode10.2 & RN0.59 compatibility (invertase#2166)
  [tests] update podfile lock
  [tests] sync v5.x.x local changes
  [tests] sync v5.x.x local changes
  [docs] update link
  [STORAGE][BUGFIX][ANDROID] - Preserve `file://` prefix
  [JS][BUGFIX] [package.json] - Fix build on Windows (BABEL_ENV error)
  [Messaging] Add null check to acquire WakeLock on Android (invertase#2092)
  [TYPES][BUGFIX][AUTHENTICATION] - Change type PhoneAuthSnapshot.Error to NativeError
@mikehardy mikehardy deleted the v5.3.1-dev branch June 11, 2019 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants