Skip to content

Update react-native-bridge to build an AAR to publish on Bintray and use in WordPress Android - #28216

Merged
mchowning merged 10 commits into
WordPress:composite_wpandroid_buildfrom
mokagio:mokagio/build-for-bintray
Jan 22, 2021
Merged

mchowning merged 10 commits into
WordPress:composite_wpandroid_buildfrom
mokagio:mokagio/build-for-bintray

Conversation

@mokagio

@mokagio mokagio commented Jan 15, 2021 •

Copy link
Copy Markdown
Contributor

Description

This is part of the Composite Android build for Gutenberg, an effort to simplify and speed up the build and workflow for developers of the WordPress Android app.

The changes in this PR are the minimum require to build an AAR that can both be published to Bintray and used by the WordPress app.

The diff includes changes to the package-lock.json because CI told me so even though I didn't changed the package.json itself 🤔 .

This supersedes #27836.

How has this been tested?

I generated and published an AAR from this changeset and verified it works in the WordPress app via this PR.

Types of changes

This PR tweaks the react-native-bridge/android build configuration only.

Checklist:

  • My code is tested. There's no infrastructure to test these changes automatically. I only performed manual testing, i.e.: run the generated AAR in the WrodPress Android app and verified it works.
  • My code follows the WordPress code style. N.A.
  • My code follows the accessibility standards. N.A.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. N.A.

This will allow adding Aztec to the Gutenberg AAR to allow clients to
fallback to it.
Notice the addition of a white color resource. This was required by the
fat AAR generation.

Without it, the task would fail as follows:

```
> Task :reBundleAarRelease
[fat-aar]target: /path/to/repo/packages/react-native-bridge/android/build/outputs/aar/@wordpress_react-native-bridge-release.aar

> Task :verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':verifyReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  /path/to/repo/packages/react-native-bridge/android/build/intermediates/res/merged/release/drawable/ic_check_24px.xml:6: error: resource color/white (aka org.wordpress.mobile.ReactNativeGutenbergBridge:color/white) not found.
  ...
```
@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 15, 2021
Comment on lines +398 to +401
// FIXME: Once this works properly poit to 'wordpress-mobile'
userOrg = 'mokagio'
// FIXME: Once this works properly poit to the original gutenberg (or gutenberg-mobile) repo. See also: https://github.com/oguzkocer/gutenberg/commit/0ca71b1abe3ea22b77abb3f390534e66e39161d5#diff-320e7dacc9e9a83ac8128d299319f82cf6dfa2609e0ebbc043d13de33ea92773R350-R353
vcsUrl = 'https://github.com/wordpress-mobile/gutenberg-mobile.git'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I discussed this with @oguzkocer and @mchowning. I'll update to point to wordpress-mobile before merging this.

Comment on lines +123 to +127
assets.srcDirs += '../../../../src/block-support'
// Despite being in a folder called "resources", the files in
// unsupported-block-editor are accessed as assets by their
// consumers: the WordPressEditor library.
assets.srcDirs += '../../../../resources/unsupported-block-editor'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These are not required for the AAR generation, but we'll use them to address wordpress-mobile/WordPress-Android#13747.

@mchowning mchowning Jan 22, 2021 •

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.

Right, this is something we'll take another look at before merging to master. 👍

@mokagio

mokagio commented Jan 15, 2021

Copy link
Copy Markdown
Contributor Author

I'm concerned by the Android E2E tests failing. @mchowning any tips on how to start looking into it?

@mchowning

Copy link
Copy Markdown
Contributor

This is looking good. I tested it and it is generally working quite well! 👍 The only issue I'm seeing is that, unless I'm mistaken, the build is not generating the javascript bundle by default. So if you clean, the aar that is generated is like ~200kb (instead of >3mb) because there is no js bundle. Once you generate the js bundle once, you won't have this problem unless you run the clean task because it is cached (or if you were to change the js code, you wouldn't see your changes when you used the resulting aar). You should be able to reproduce this by running ./gradlew clean assembleRelease and then looking at the resulting aar. To get the bundle generation we need to set the buildGutenbergFromSourceFlag by doing something like this, which works for me:

./gradlew clean assembleRelease -PbuildGutenbergMobileJSBundle=true

I realize that this setup is going to change a lot, particularly with @oguzkocer 's composite build changes, so I don't think we need to have this fully worked out at this point. With that said, I think we would be better off building the js bundle default, and requiring that we affirmatively do something (set a variable, etc.) to tell the build to skip building the js bundle. wdyt?

I'm concerned by the Android E2E tests failing.

Our E2E tests can be flaky 😞 (although this seems to be failing somewhat consistently). The tests passed for me locally, so I think it may not be worth worrying about them at this point since we're only merging to a feature branch. I also don't think the performance test failures have anything to do with your changes. I think there's a decent chance that once we bring in the latest changes from master the CI issues will resolve themselves.

I don't view any of these issues as blockers since we're targeting a feature branch, so I'll go ahead and approve. Just let me (or, if I'm not around, any other gutenberg dev) know if you want to get this merged (I'm assuming you won't be able to merge it yourself yet).

@mchowning mchowning added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Jan 22, 2021
@mchowning

Copy link
Copy Markdown
Contributor

Going ahead and merging this so @oguzkocer can work on top of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants