- How to work with local gutenberg-mobile checkout
- How to test a gutenberg-mobile PR in WPiOS
- How to work with Aztec in WPiOS
The LOCAL_GUTENBERG environment variable is useful when you want to iterate on the native iOS code (Swift, Objective-C) in gutenberg-mobile while testing it inside the WPiOS app. This also includes the case when you update a dependency in gutenberg-mobile that includes native code.
The LOCAL_GUTENBERG flag sets which JS bundle WPiOS uses. It does not impact which WPiOS run scheme is selected or whether or not Metro is used. When the flag is enabled, the bundle available within the local gutenberg-mobile checkout is used. That's why, when using this flag, it is better to run the Metro server or recreate JS bundles in the local gutenberg-mobile checkout so that the native and JS code are in sync.
To use it, you need to set LOCAL_GUTENBERG environment variable to the local gutenberg-mobile folder relative to the WPiOS folder.
By default LOCAL_GUTENBERG is set to ../gutenberg-mobile.
- First
cdinto your cloned WPiOS project folder and runrake dependencies - (a) If
gutenberg-mobileis at../gutenberg-mobileyou can directly run:
LOCAL_GUTENBERG=true bundle exec pod install- (b) Otherwise pass in the relative
gutenberg-mobilefolder like this:
LOCAL_GUTENBERG=../../xyz/gutenberg-mobile bundle exec pod install- Start the metro server in
gutenberg-mobilewithnpm run start:reset - Launch the WPiOS workspace (
.xcworkspace) in Xcode and run the app - You can change any JS files and metro should pick the changes up
- If you change any native files (Swift, Objective-C, etc.) you should re-run the WPiOS app for the changes to be reflected
Assuming that there is no open WPiOS PR:
- Open
Gutenberg/config.ymlfrom the root of WPiOS directory - Find the line where gutenberg reference is set:
tag: v1.110.0 - Find latest commit hash of the
gutenberg-mobilePR - Remove the line referencing the tag (e.g.,
tag: v1.110.0) and add a line referencing the commit:commit: 123456789 - Run
bundle exec pod installinside WPiOS - Switch to the relevant branch in
gutenberg-mobileand start the metro server withnpm run start:reset - Launch the WPiOS workspace (
.xcworkspace) in Xcode and run the app
Additionally to share a WPiOS installable build (IPA)
- Within
gutenberg-mobile, stop the metro server and create bundles runningnpm run bundle - Commit and push the bundle changes to
gutenberg-mobile - Update the commit hash in the WPiOS Podfile again and run
bundle exec pod installagain - Commit and push the changes to
PodfileandPodfile.lock - Open a WPiOS PR
- Manually trigger the installable build CI job by clicking the link in the PR comments
Additionally to release a alpha version of gutenberg-mobile and update WPiOS PR to use it
- Merge the
gutenberg-mobilePR (make sure the bundles are up-to-date before merging) - Tag the merge commit bumping the latest tag's minor version and adding an
-alphaQto the end like:v1.50.0 -> v1.51.0-alpha1 - If there's already an alpha, the alpha version could be increased like:
v1.51.0-alpha1->v1.51.0-alpha2 - Open the
Gutenberg/config.ymlagain and update the gutenberg reference to use the new alpha tag:tag: v1.51.0-alpha2 - Run
bundle exec pod install - Commit and push the changes to
PodfileandPodfile.lock
- While running WPiOS, changes can be made directly to the Aztec iOS codebase.
- Create a PR directly in the AztecEditor-iOS repository.
Additionally to share a WPiOS installable build
Note: These steps are to be considered a fragile hack used for the sole purpose of creating installable builds for testing PRs changes. If the main Aztec version changes in the process creating/testing the installable build, it may fail.
- In the
gutenberg-mobilerepo, navigate to theios-xcframework/Podfilefile and uncomment the following line:
# pod 'WordPress-Aztec-iOS', git: 'https://github.com/wordpress-mobile/WordPress-Aztec-iOS.git', commit: ''
- Update the
commitargument with the latest hash from your open Aztec PR. - After changing, run
bundle exec pod installto update the Podfile.lock. - Push the changes to a new
gutenberg-mobilePR. - Next, in the WPiOS repository, follow the instructions in the WPiOS' Podfile to de-comment the lines with a
commitargument and comment out the default line that points to a tag. - Update the
commitargument to reference the hash from your open PR and push the changes - In
Gutenberg/config.yml, update the commit hash to thegutenberg-mobilePR you created. - Run
bundle exec pod install.
Additionally to incorporate a merged Aztec change
- After your Aztec PR has been tested, approved, and merged, go through the steps to draft and publish a new release via the releases pages.
- In Gutenberg, update the Aztec tag found under
packages/react-native-aztec/RNTAztecView.podspec. - In Gutenberg Mobile, update the Aztec tag found under
ios-xcframework/Podfile. Remember to update the Gutenberg submodule reference following the change in the previous step. - In WPiOS, update the Aztec tag found in the Podfile. Remember to also follow the steps to point to your latest Gutenberg Mobile changes.