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

build: regtest app variant #1458

Closed
wants to merge 2 commits into from
Closed

build: regtest app variant #1458

wants to merge 2 commits into from

Conversation

ovitrif
Copy link
Contributor

@ovitrif ovitrif commented Jan 4, 2024

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
  • a monochrome icon

Considerations

  • It is expected have a .env.production file with the corresponding configurations.

To Test

1️⃣ Regtest Android

  1. Run yarn regtest:set
  2. Run yarn bundle:regtest
  3. Run yarn regtest:unset
  4. Install the app on an emulator
  5. Expect to have the app Bitkit Regtest installed with the default Bitcoin Network Regtest.

2️⃣ Mainnet Android

  1. Run yarn bundle then install the app
  2. Install the app
  3. Expect to have the app Bitkit installed with the default Bitcoin Network Mainnet.

3️⃣ Regtest iOS

  1. Run yarn regtest:set
  2. Open the workspace in Xcode, switch to the bitkit.regtest scheme

    Note (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
  3. Build the app for release
  4. Expect to have the app Bitkit Regtest installed with the default Bitcoin Network Regtest.
  5. Run yarn regtest:unset

2️⃣ Mainnet iOS

  1. Close Xcode, run yarn clean, reopen project and switch to bitkit scheme
  2. Build the app for release
  3. Expect to have the app Bitkit installed with the default Bitcoin Network Mainnet.

➕ Other configurations

  • Ensure yarn start can still run build and run the app on Android / iOS
  • Ensure yarn android & yarn ios still works

Linked Issues/Tasks

https://app.asana.com/0/0/1205821036778041/f

Type of change

  • Refactoring (improving code without creating new functionality)

Tests

  • No test

Screenshot / Video

N/a - build setup.

QA Notes

N/a - build setup.

@ovitrif ovitrif requested a review from Jasonvdb January 4, 2024 20:10
@ovitrif ovitrif self-assigned this Jan 4, 2024
@pwltr
Copy link
Collaborator

pwltr commented Jan 4, 2024

Just making sure that normal development workflow works as expected and seems to be the case 👍

pwltr
pwltr previously requested changes Jan 4, 2024
package.json Outdated Show resolved Hide resolved
scripts/post-regtest-bundle.js Outdated Show resolved Hide resolved
@pwltr pwltr requested review from pwltr and removed request for pwltr January 4, 2024 21:30
@pwltr pwltr dismissed their stale review January 4, 2024 21:32

all good

@ovitrif ovitrif force-pushed the build/regtest-variant branch from 6ac1db5 to d27dad1 Compare January 8, 2024 13:45
@ovitrif ovitrif requested a review from pwltr January 8, 2024 13:46
@pwltr
Copy link
Collaborator

pwltr commented Jan 8, 2024

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

@ovitrif
Copy link
Contributor Author

ovitrif commented Jan 8, 2024

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
Copy link
Collaborator

pwltr commented Jan 8, 2024

@pwltr Can you try a yarn clean:ios beforehand? 🤔

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.

@ovitrif ovitrif force-pushed the build/regtest-variant branch from d27dad1 to b46dc2c Compare January 10, 2024 20:29
@ovitrif
Copy link
Contributor Author

ovitrif commented Jan 10, 2024

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.

@ovitrif
Copy link
Contributor Author

ovitrif commented Jan 16, 2024

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:

@ovitrif ovitrif force-pushed the build/regtest-variant branch 2 times, most recently from 1ffe300 to 0292da9 Compare January 30, 2024 17:37
@ovitrif
Copy link
Contributor Author

ovitrif commented Jan 30, 2024

Updated with:

  • rebase on master d62e7a2
  • squash into 2 commits:
    1. Android build
    2. iOS build

@ovitrif ovitrif dismissed pwltr’s stale review January 30, 2024 17:40

AFAIK we addressed all points, but I still see "1 change requested" although the comment is outdated and 'resolved'

@JeanlChristophe JeanlChristophe added this to the Beignet milestone Feb 9, 2024
@ovitrif
Copy link
Contributor Author

ovitrif commented Feb 13, 2024

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

@ovitrif ovitrif force-pushed the build/regtest-variant branch from 0292da9 to 97ded3f Compare February 28, 2024 18:06
@ovitrif
Copy link
Contributor Author

ovitrif commented Feb 28, 2024

@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 🙏🏻

ovitrif added 2 commits March 6, 2024 14:43
- build: fix color of regtest android app circle icon
- build: replace regtest build icon to monochrome
- chore: add alias task to restore rn cli and metro functionality
- refactor: specify debuggable variants explicitly
- refactor: remove regtest color overrides
- chore: update BUILD.md
- chore: add scripts for building regtest app
- chore: add app icon for regtest flavour
- chore: add app_name for regtest flavour
- refactor: flag app_name non-translatable
- chore: add regtest android build flavour
- simplify build setup scripts for regtest
- use custom variable for app name
- disable test build config in regtest scheme
- build: remove unused bundling script
- build: fix run of regtest app via xcode
- build: remove duplicated scripts value
- docs: fix typo in BUILD.md
- docs: update readme for iOS regtest builds
- build: add bundle:regtest:ios task
- build: update buildable name to new default
- build: set release cfg for regtest scheme
- build: add bundle:ios node task
- build: set name and icon for regtest release cfg
- build: add Release.Regtest cfg
- build: add separate bitkit.regtest scheme
- build: set name and icon for regtest debug
- build: set display name to PRODUCT_NAME
- build: add debug regtest build to flipper config
- build: rename regtest debug app
- build: add Debug.Regtest config
- chore: add ios regtest icon
@ovitrif ovitrif force-pushed the build/regtest-variant branch from 97ded3f to 154cb58 Compare March 6, 2024 13:56
@ovitrif
Copy link
Contributor Author

ovitrif commented Apr 30, 2024

Closing this for now, given it's stale for a long time.
We can always reopen if we reassess its priority.

@ovitrif ovitrif closed this Apr 30, 2024
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.

4 participants