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
refactor(android): support for Titanium 9.0.0 and gradle #329
Conversation
- Updated module version to 5.0.0. - Updated min supported Titanium version to 9.0.0. * Needed since Titanium's switch to gradle is a breaking change, preventing old hyperloop module from working. - Added "platform/android/build.gradle" support for dependencies. - Modified module to generate a "hyperloop.bootstrap.js" used to bind Java class name require strings to generated JS file proxies. * Removed require() code replacement hyperloop used to do. - Added listern for new Titanium build hook "build.android.requestResourcesDirPaths". * Used to add hyperloop's generated JS files directory to the app build. Titanium will pass this directory to its "_build.js" copyResources() function. * Removed all other event hooks from hyperloop. Replaced by new event hook which is simpler. - Removed "ant" usage and its related build files.
@jquick-axway Could you merge latest master into your branch so ci can build the PR? Builds were failing because of #330 . |
So I have not dug super deep into this, but I wanted to confirm what I was seeing here. Before this PR we would:
And this PR instead does:
If so, that is awesome! It avoids unnecessary I/O modifications so build times should be better; it makes a nice use of something I had sort of hacked into the SDK internals; it still retains most of the same workflow/idea. I like it. |
I assume we'll need to tweak the Jenkinsfile as well to change how the module is built? |
@sgtcoolguy, your before/after analysis is spot on. The key detail is I'm using Google's With this PR, hyperloop has access to dependencies:
Breaking-Change: Benchmarks:
Performance-wise we've gone 1 step forward and 1 step back. Me replacing the require/import code substitution with the bootstrap/binding approach is definitely faster. However, the part that's killing the build times is me feeding the hyperloop generated JS files to the You could argue that the real issue is that hyperloop generates way more JS files than needed, which is true. Hyperloop generates a JS file for every Java class required-in, the Java classes referenced by those Java classes, and continue on-and-on from there. Perhaps an alternative solution would be to not generate the JS wrappers at build time and instead set up the proxy objects dynamically via reflection. We could lazy load the Java types as needed. It would add some runtime overhead, but reduce the APK size and build times. I think the build times need to be better. I need to ponder this some more. |
So just to spitball here:
|
@sgtcoolguy, I benchmarked "clean" builds by deleting the app project's Doing a clean app build the normal way (ex: change deploy type), the hyperloop side will still build incrementally since the Hyperloop will only update the metabase JSON if libraries have been added/removed. Hyperloop only generates/removes proxy JS files as needed incrementally thanks to @janvennemann past changes. So, we're fine here. The build performance overhead my PR adds is that the generated JS proxy files are now being "processed" via our |
- Updated dexmaker library from version 1.4 to 2.25.1
- Added generated JS proxy files to "unprocessed" list. * Make builds times 2x to 3x times faster.
PR updated:
New benchmarks between Titanium 8.3.0 and 9.0.0 with hyperloop-examples...
|
- Removed hyperloop module existence check in hook. * No longer possible. Used to happen when hook was a separate plugin. - Now fetches module version from "manifest" file directly to check for module version change.
Updated PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
FR Passed.
SDK : 9.0.0 local build |
JIRA:
Note:
This PR requires Titanium PR tidev/titanium-sdk#11339 to be merged-in first since it adds gradle support.
Summary:
./platform/android/build.gradle
file in app project.hyperloop.bootstrap.js
file.android.build.requestResourcesDirPaths
.Resource/hyperloop
to app build.copyResources()
function.Benchmarks:
Performed with hyperloop-example between Titanium 8.3.0 and 9.0.0.
General Hyperloop Test:
Titanium Java Class Access Test:
### Is app in foreground: true
get logged every 1 second.Inner Java Class Access Test:
EXTERNAL_CONTENT_URI
gets logged.Java Package and Gradle File Test:
Tests "build.gradle" dependency support and require/import of Java packages.
./platform/android/build.gradle
repositories { google() jcenter() } dependencies { implementation 'com.google.android.exoplayer:exoplayer-core:2.8.0' }
app.js