Skip to content

Configure project to fetch Gutenberg as an AAR from Bintray by default - #13642

Merged
mokagio merged 12 commits into
gutenberg-composite-buildfrom
react-native-from-bintray-binary-only
Jan 19, 2021
Merged

mokagio merged 12 commits into
gutenberg-composite-buildfrom
react-native-from-bintray-binary-only

Conversation

@mokagio

@mokagio mokagio commented Dec 21, 2020 •

Copy link
Copy Markdown
Contributor

☝️ Before merging this we need to be publishing Gutenberg to the WordPress org. For that, we need to finish the work in WordPress/gutenberg#27836.


This makes the project use the Gutenberg React Native Android bridge AAR version published to Bintray.

To test, make sure to set wp.BUILD_GUTENBERG_FROM_SOURCE=false in your gradle.properties to make the build system use the Bintray package, then run the app and try to publish a post. Verify that the build and editor still work with the property set to true.

Current limitations

  • The package used comes from my Bintray repository. This needs to be addressed before merging this PR, but before doing so it would be appropriate to be able to run the Bintray publishing from CI, which is not possible yet.
  • There is no support for composite build, yet. That is, we still rely on having mobile-gutenberg and gutenberg as submodules in the repository. This will likely be addressed in a dedicated followup PR, given the scope of the task.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile

peril-wordpress-mobile Bot commented Dec 21, 2020 •

Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile

peril-wordpress-mobile Bot commented Dec 21, 2020 •

Copy link
Copy Markdown

You can test the changes on this Pull Request by downloading the APK here.

@mokagio

mokagio commented Dec 21, 2020

Copy link
Copy Markdown
Contributor Author

Asking @mchowning and @loremattei for review, despite the PR still being a draft to double-check everything works and makes sense. Thanks! 🙇

Comment thread WordPress/build.gradle Outdated
//
// A starting point might be the fact that the
// @wordpress_react-native-bridge-release AAR contains only the
// -release.aar version of Hermes in its libs folder

@mchowning mchowning Dec 22, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In testing this earlier, I also noticed that the hermes dependency bundled in the aar was way too small of a file (only 22 bytes). 😕

@mchowning

Copy link
Copy Markdown
Contributor

I only had time to do a quick test, but using 959b3c5 from this PR and 39bb2901be from the gutenberg PR, both the from-source and from-binary builds worked for me! 🎉 This is some great work @mokagio !

@oguzkocer oguzkocer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mokagio This looks good to me for the Phase 1 merge. I left a minor comment that's not a blocker (I can make the change as part of the composite build work if you prefer) and it's just waiting the base branch to be updated. There also seems to be a second similar PR, so I wasn't sure which one you wanted to merge. If you can set things up for merge, I can do that tomorrow.

Comment thread settings.gradle Resolved

@oguzkocer oguzkocer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mokagio I am so sorry to leave a second review, but as I was working on composite build, I've noticed a couple issues and thought it'd be good to address them before we merge this in. I hope that's OK!

Comment thread WordPress/build.gradle Resolved
Comment thread WordPress/build.gradle Resolved
@mokagio
mokagio force-pushed the react-native-from-bintray-binary-only branch from 959b3c5 to 52c194a Compare January 8, 2021 03:43
@mokagio

mokagio commented Jan 8, 2021

Copy link
Copy Markdown
Contributor Author

@oguzkocer thank you for the reviews(s 😄) and for helping me out shaping this to be in a better form.

I'll try to address your comments ASAP 👍

@mokagio
mokagio changed the base branch from develop to gutenberg-composite-build January 8, 2021 03:44
We only use it in the editor library, so the import that's there is
enough.
That's where it should live because it's required only by
WordPressEditor, even though at this point in time we need to import it
via the WordPress because of the "Direct local .aar dependencies are not
supported" error.

@oguzkocer oguzkocer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For phase 1, this looks good to me. I think we should mark this PR as ready for review and merge it directly to gutenberg-composite-build branch. However, before that, one thing we should probably track is the commit we use to build the bintray version of gutenberg for each PR. Since the gutenbergMobileVersion does not contain that information, we should probably add the gutenberg and gb-mobile commits as a comment above the ext.gutenbergMobileVersion line, so we can reproduce a build if necessary.

What do you think @mokagio?

@mokagio
mokagio marked this pull request as ready for review January 13, 2021 01:49
@mokagio

mokagio commented Jan 13, 2021

Copy link
Copy Markdown
Contributor Author

one thing we should probably track is the commit we use to build the bintray version of gutenberg for each PR

Absolutely! I hadn't considered that and simply rolled with the approach I originally used to generate the version based on a timestamp. That was useful at the start, but we should definitely use the commit instead.

In fact, rather than compromise and leave a comment which could easily become outdated, I'll just go ahead and generate a new version that uses the SHA as its identifier.

I'll use the commit SHA from gutenberg-mobile repo, as checking out that one will also checkout the appropriate gutenberg commit.

In WordPress-Utils-Android, we use <PR number>-<commit SHA> as the version. We might apply the same approach here once I'll get CI publishing to work.

This will make it easier to reconstruct the state of the codebase if we
want to run a local build using the code that produced that binary.
@mokagio

mokagio commented Jan 14, 2021

Copy link
Copy Markdown
Contributor Author

@oguzkocer, I thought f2cf853 solved the "Direct local .aar..." issue, but I discovered it doesn't 😞

If I run assembleRelease from there, I get that error.

Something worth noting is that assembleJalapenoDebug (which is what CI uses) doesn't incur in that problem, and neither does assembleVanillaRelease. 🤔 Am I just holding it wrong? Should I not use assembleRelease?

If the answer to that question is yes, then I guess the PR is really, finally ready to merge 😄

@oguzkocer

Copy link
Copy Markdown
Contributor

@mokagio That direct local .aar issue is related to us trying to embed Hermes binary in the Gutenberg end, right? Since that embed is not working right now and we have a workaround for it (where we add it manually in WPAndroid) shouldn't we just remove that? It has given me some issues on my end as well and I just commented it out.

I also don't think assembleRelease is a valid command simply because it's lacking a variant such as vanilla, jalapeno, wasabi etc. However, maybe it's supposed to select the default variant, I am not sure.

I am not able to give this a try today, but I can try it out tomorrow if you can't do it.

@mokagio

mokagio commented Jan 15, 2021

Copy link
Copy Markdown
Contributor Author

Since that embed is not working right now and we have a workaround for it (where we add it manually in WPAndroid) shouldn't we just remove that? It has given me some issues on my end as well and I just commented it out.

😮 yeah that makes sense. I tried it and it worked 👏

@mchowning

Copy link
Copy Markdown
Contributor

I also don't think assembleRelease is a valid command simply because it's lacking a variant such as vanilla, jalapeno, wasabi etc. However, maybe it's supposed to select the default variant, I am not sure.

FWIW, I think assembleRelese should run all the variants:

$ ./gradlew assembleRelease --dry-run | grep -E 'assemble.*Release'
:@react-native-community_masked-view:assembleRelease SKIPPED
:@react-native-community_slider:assembleRelease SKIPPED
...
:react-native-gutenberg-bridge:assembleRelease SKIPPED
...
:WordPress:assembleJalapenoRelease SKIPPED
:WordPress:assembleVanillaRelease SKIPPED
:WordPress:assembleWasabiRelease SKIPPED
:WordPress:assembleZalphaRelease SKIPPED
:WordPress:assembleRelease SKIPPED
:WordPressMocks:assembleRelease SKIPPED
...

We were on mine while ironing out the details of the setup. Now that it
works fine, I don't fear "polluting" the official org as much.
@peril-wordpress-mobile

Copy link
Copy Markdown
Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@mokagio

mokagio commented Jan 15, 2021 •

Copy link
Copy Markdown
Contributor Author

@oguzkocer @mchowning gentlemen, I think this is now really ready to merge. I tried it myself but since there's a lot of stuff going on under the hood that I did to address some of the comments since @oguzkocer approval, can I bug you to have another look to see if this works for you, too?

(If it does, feel free to merge)

Thanks a lot 🙇

@oguzkocer oguzkocer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me as a first step, so I'd vote for merging it. The only issue seems to be ci/circleci: gutenberg-bundle-build CI task. If that's not a blocker (something we can address in another PR or just ignore), feel free to merge this to the WIP branch @mokagio.

Please note that I'll be making a lot of changes to these for composite builds, so it helps me to merge this as soon as possible.

@mokagio
mokagio merged commit 2eb152f into gutenberg-composite-build Jan 19, 2021
@mokagio
mokagio deleted the react-native-from-bintray-binary-only branch January 19, 2021 01:30
@mokagio

mokagio commented Jan 19, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @oguzkocer 👍

Interesting that the build failure is due to CI running out of memory:

Loading dependency graph, done.
error ENOMEM: not enough memory, write. Run CLI with --verbose flag for more details.

That's something I'm seeing on the gutenberg-mobile PR to publish to Bintray on CI, too. Maybe some of the work I did broke something in the Node setup, or we need to better tune the memory config in CI, or both.

@mchowning

Copy link
Copy Markdown
Contributor

Interesting that the build failure is due to CI running out of memory:

Loading dependency graph, done.
error ENOMEM: not enough memory, write. Run CLI with --verbose flag for more details.

That's something I'm seeing on the gutenberg-mobile PR to publish to Bintray on CI, too. Maybe some of the work I did broke something in the Node setup, or we need to better tune the memory config in CI, or both.

We've been seeing that error sometimes on WPAndroid PRs, so most likely it's a preexisting issue (i.e., we need to better tune the memory config on CI) and not a new one (most WPAndroid devs probably never see that error because CI is pulling a previously built bundle from the cache for them).

@mokagio

mokagio commented Jan 21, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for the extra context @mchowning.

I've seen that often while working on wordpress-mobile/gutenberg-mobile#2945 and I think I got it to a stable place memory wise 🤞

@dcalhoun dcalhoun added the Gutenberg Editing and display of Gutenberg blocks. label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks. Tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants