build: regtest app variant
Description
This PR adds support to build an app variant having regtest as default bitcoin network.
Aside to the default network, the regtest variant has:
- a different name:
Bitkit Regtest - a different id:
- Android:
to.synonym.bitkit.wallet.regtest - iOS
to.synonym.bitkit.regtest
- Android:
- a monochrome icon
Considerations
- It is expected have a
.env.productionfile with the corresponding configurations.
To Test
1️⃣ Regtest Android
- Run
yarn regtest:set - Run
yarn bundle:regtest - Run
yarn regtest:unset - Install the app on an emulator
- Expect to have the app
Bitkit Regtestinstalled with the default Bitcoin NetworkRegtest.
2️⃣ Mainnet Android
- Run
yarn bundlethen install the app - Install the app
- Expect to have the app
Bitkitinstalled with the default Bitcoin NetworkMainnet.
3️⃣ Regtest iOS
- Run
yarn regtest:set - Open the workspace in Xcode, switch to the
bitkit.regtestschemeNote (maybe optional if building via Xcode) Additional 1-time setup is required as described in this medium post
- need to register the new bundle id, get certificates, etc
- also might need to create a separate app in TestFlight App Store Connect
- Build the app for release
- Expect to have the app
Bitkit Regtestinstalled with the default Bitcoin NetworkRegtest. - Run
yarn regtest:unset
2️⃣ Mainnet iOS
- Close Xcode, run
yarn clean, reopen project and switch tobitkitscheme - Build the app for release
- Expect to have the app
Bitkitinstalled with the default Bitcoin NetworkMainnet.
➕ Other configurations
- Ensure
yarn startcan still run build and run the app on Android / iOS - Ensure
yarn android&yarn iosstill works
Linked Issues/Tasks
https://app.asana.com/0/0/1205821036778041/f
Type of change
- [x] Refactoring (improving code without creating new functionality)
Tests
- [x] No test
Screenshot / Video
N/a - build setup.
QA Notes
N/a - build setup.
Just making sure that normal development workflow works as expected and seems to be the case 👍
Followed instructions and Android is working for me, when building for iOS I get:
Unable to load contents of file list: '/Users/phil/Dev/synonymdev/bitkit/ios/Pods/Target Support Files/Pods-bitkit/Pods-bitkit-frameworks-Debug.Regtest-input-files.xcfilelist'
@ovitrif Any ideas? Could have to do with the regtest assets
Followed instructions and Android is working for me, when building for iOS I get:
Unable to load contents of file list: '/Users/phil/Dev/synonymdev/bitkit/ios/Pods/Target Support Files/Pods-bitkit/Pods-bitkit-frameworks-Debug.Regtest-input-files.xcfilelist'@ovitrif Any ideas? Could have to do with the regtest assets
@pwltr Can you try a yarn clean:ios beforehand? 🤔
Honestly I'm not sure which one of the commands have fixed it in my case, but I do recall having to resolve the same issue.
clean:ios seems to tap into the iOS dependencies, but it might have bean clean itself.
Xcode build issues feel very unstable to me, for example I couldn't get the app to build via Xcode for 2 days, then randomly it started to work 🤷🏻
@pwltr Can you try a
yarn clean:iosbeforehand? 🤔
Yeah that works! Should have known 🤷♂️. It's stuck on the splash screen now though:
No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
*** Terminating app due to uncaught exception 'RCTFatalException: No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.', reason: 'No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000180491128 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018008412c objc_exception_throw + 56
2 Bitkit Regtest 0x0000000104b03d10 RCTGetFatalHandler + 0
3 Bitkit Regtest 0x0000000104b19ea4 __28-[RCTCxxBridge handleError:]_block_invoke + 516
4 libdispatch.dylib 0x0000000107c200f0 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x0000000107c2193c _dispatch_client_callout + 16
6 libdispatch.dylib 0x0000000107c315e4 _dispatch_main_queue_drain + 1228
7 libdispatch.dylib 0x0000000107c31108 _dispatch_main_queue_callback_4CF + 40
8 CoreFoundation 0x00000001803f1a30 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
9 CoreFoundation 0x00000001803ec148 __CFRunLoopRun + 1936
10 CoreFoundation 0x00000001803eb5a4 CFRunLoopRunSpecific + 572
11 GraphicsServices 0x000000018e9fbae4 GSEventRunModal + 160
12 UIKitCore 0x00000001852f02e4 -[UIApplication _run] + 868
13 UIKitCore 0x00000001852f3f5c UIApplicationMain + 124
14 Bitkit Regtest 0x000000010494c74c main + 96
15 dyld 0x0000000106aa1544 start_sim + 20
16 ??? 0x0000000106bb20e0 0x0 + 4407894240
17 ??? 0x2962000000000000 0x0 + 2981945903272689664
)
libc++abi: terminating due to uncaught exception of type NSException
Xcode build issues feel very unstable to me, for example I couldn't get the app to build via Xcode for 2 days, then randomly it started to work 🤷🏻
I doubt this was the issue in your case but I find myself having to delete ios/.xcode.env.local often times.
Yeah that works! Should have known 🤷♂️. It's stuck on the splash screen now though:
No bundle URL present.
Thank you @pwltr for testing and sharing this.
I tried again in a fresh clone and I got the same issue when running the bitkit.regtest scheme via Xcode.
The thing is, this won't work anyways to set the default network to regtest, because it takes configuration from .env.development. But I do agree for testing purposes it makes sense to be able to actually run the regtest app, not only install it.
After a lot of trial & error, I found a fix that got it working for me.
It's important mention that the release configuration works differently, and I can't test it given I don't have the certificates, so I personally can't tell for sure if it will work right.
I'd really appreciate if @Jasonvdb could check if the setup works for iOS Regtest.Release, since that's the main problem the PR is trying to solve.
Note: if we can't get the current setup to work for iOS release builds, this might be an alternative, though it would take some time to set-up fastlane:
Updated with:
- rebase on
masterd62e7a2d - squash into 2 commits:
- Android build
- iOS build
Put on hold until we can build iOS releases using the self-hosted build machine. This way it will enable me to troubleshoot and verify it on iOS as well
@Jasonvdb I revisited this changeset and made the setup much simpler, also now I'm pretty sure the iOS regtest app should build correctly.
I also updated the testing steps in PR description as well as build instructions for regtest app in BUILD.md.
Happy to get your feedback when you can check this again 🙏🏻
Closing this for now, given it's stale for a long time. We can always reopen if we reassess its priority.