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

chore(android): gradle 8 #14014

Merged
merged 20 commits into from
Sep 17, 2024
Merged

Conversation

AbdullahFaqeir
Copy link
Contributor

chore(android): let there be gradle 8
chore(android): fixed deprecations in kroll-apt project
chore(android): made kroll-apt incremental to enhance build time

GitHub issue: #13579

This PR is dedicated to my mentor Nafe Abboushi.

chore(android): fixed deprecations in kroll-apt project
chore(android): made kroll-apt incremental to enhance build time
@m1ga m1ga self-requested a review March 23, 2024 20:25
Copy link
Contributor

@m1ga m1ga left a comment

Choose a reason for hiding this comment

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

Are the changes to the JAVA files necessary for the update? The more stuff that is changed, the more we have to test 😉

Also I wouldn't update the min and targetSDK with this PR. If we still can use 21 we should do that too. Same with target 34. I have a PR for that here #13940 as the broadcast receiver has to be adjusted.

So if that is not needed for the gradle PR please keep it as it is and do it in a separate PR (less changes, less testing).

I couldn't build a SDK locally. It's almost working but the last step titaniumPublication(MavenPublication) tries to publish it online instead of making a local repo? I've canceled it as it was uploading stuff 😄 Didn't want to publish something I don't need.

There aren't all cmake version available during build process. I have a different PR about that #13966 and I had to use 3.22.1 as that is available on all platforms.

fix(android): gradle 8 compatibility update to template build.gradle
fix(android): revert dependency updates
fix(android): revert minSdk and targetSdk
Copy link
Contributor Author

@AbdullahFaqeir AbdullahFaqeir left a comment

Choose a reason for hiding this comment

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

All reviews applied.

fix(android): update _build.js & _buildModule.js for new gradle
@m1ga m1ga mentioned this pull request Mar 26, 2024
@m1ga m1ga changed the title chore(android): let there be gradle 8 chore(android): gradle 8 Mar 26, 2024
@m1ga
Copy link
Contributor

m1ga commented Mar 26, 2024

I have to do some testing but the first round was very good and I was able to build kitchensink an my app now 👍

Review will follow once I have more time to test

@m1ga m1ga self-assigned this Mar 26, 2024
Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

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

This is AWESOME! I don't wanna lose momentum on this PR.

I found a few indention nitpicks. I haven't tested the PR yet, but I spent some time researching some of the changes such as no longer need to call .setPackageName(). Good stuff!

What sort of testing do we need to do to get this over the finish line? I can test on Windows doing emulator builds as well as build-only device/dist builds. I don't have any working Android devices. Sigh.

android/build.gradle Show resolved Hide resolved
android/app/build.gradle Outdated Show resolved Hide resolved
android/templates/build/ti.constants.gradle Outdated Show resolved Hide resolved
android/titanium/build.gradle Outdated Show resolved Hide resolved
android/titanium/build.gradle Outdated Show resolved Hide resolved
android/titanium/build.gradle Show resolved Hide resolved
android/titanium/build.gradle Outdated Show resolved Hide resolved
android/untar.gradle Show resolved Hide resolved
@m1ga
Copy link
Contributor

m1ga commented May 1, 2024

What sort of testing do we need to do to get this over the finish line?

👍 @cb1kenobi I would love to split this up into smaller steps as this is a big PR:
#13579 (comment)
I have made older PRs: first one only updates the gradle files to the newer syntax, 2nd one updates cmake and checkstyle (looks much but it's only linting). Then we only have the gradle 8 parts in here and can focus on that as it's a bigger change.

Copy link
Collaborator

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

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

A few questions and changes we should verify. And can you please rebase with latest master to resolve the merge conflicts?

android/app/build.gradle Outdated Show resolved Hide resolved
android/app/build.gradle Outdated Show resolved Hide resolved
android/build.gradle Show resolved Hide resolved
android/cli/commands/_buildModule.js Show resolved Hide resolved
android/templates/build/root.build.gradle Show resolved Hide resolved
@AbdullahFaqeir
Copy link
Contributor Author

AbdullahFaqeir commented Sep 13, 2024

@m1ga
Was this put in the system in any way or not, I hope so, and if not I would love to get back and work on it

@AbdullahFaqeir
Copy link
Contributor Author

A few questions and changes we should verify. And can you please rebase with latest master to resolve the merge conflicts?

Of course

@m1ga
Copy link
Contributor

m1ga commented Sep 13, 2024

Did a first quick test.

EDIT: I've pushed the material.R changes! SDK will build now 👍

After that: SDK builds fine and I tested it with two apps with existing modules and they work fine. Kitchensink works too. Hyperloop-examples breaks:

[ERROR] [GRADLE] A problem occurred configuring project ':gradle-project'.
[ERROR] [GRADLE] > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
[ERROR] [GRADLE]    > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
[ERROR] [GRADLE]      
[ERROR] [GRADLE]      If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
[ERROR] [GRADLE] 

same when building modules:

[ERROR] [GRADLE] A problem occurred configuring project ':module'.
[ERROR] [GRADLE] > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
[ERROR] [GRADLE]    > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
[ERROR] [GRADLE]      
[ERROR] [GRADLE]      If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
[ERROR] [GRADLE] 

android/gradle.properties Outdated Show resolved Hide resolved
@hansemannn
Copy link
Collaborator

@m1ga PR's can be checked out most easily with the Github CLI and gh pr checkout 14014 in this case. It clones the branch and checks it out. You can then push into the branch and the commits occur here.

@m1ga
Copy link
Contributor

m1ga commented Sep 13, 2024

@hansemannn nice! That worked 👍 SDK will build now, modules & hyperloop currently fail with the error above.

@AbdullahFaqeir would be nice if you can find out where the namespace is missing. Apps without hyperloop work fine but I didn't check all controls yet.

@AbdullahFaqeir
Copy link
Contributor Author

@m1ga @hansemannn I fixed it to build for modules, couldn't build tho on my Silicon machine, but it the fix for sure went after that stage.

@m1ga
Copy link
Contributor

m1ga commented Sep 14, 2024

awesome! SDK builds, apps build, modules build 👍 We are getting closer.

@m1ga
Copy link
Contributor

m1ga commented Sep 14, 2024

one thing we'll need to tell the module developers: minSdk 12.6.0 is required when you build modules with this SDK as it is building with a higher Java version. The other way (old modules in 12.6.0 apps) works fine.

@AbdullahFaqeir
Copy link
Contributor Author

one thing we'll need to tell the module developers: minSdk 12.6.0 is required when you build modules with this SDK as it is building with a higher Java version. The other way (old modules in 12.6.0 apps) works fine.

@m1ga while generating the manifest file?

@m1ga
Copy link
Contributor

m1ga commented Sep 14, 2024

when building an app with a module that was build with this PR you'll see
´Unsupported class file major version 61as the module was build with JAVA_17 and the app is trying to build with JAVA_11 (current 12.4.0). But since we have theminSdk` value in the module manifest it's fine. The developer just have to update it when using 12.6.0 to build the module

@AbdullahFaqeir
Copy link
Contributor Author

when building an app with a module that was build with this PR you'll see ´Unsupported class file major version 61as the module was build with JAVA_17 and the app is trying to build with JAVA_11 (current 12.4.0). But since we have theminSdk` value in the module manifest it's fine. The developer just have to update it when using 12.6.0 to build the module

@m1ga Exactly!

@AbdullahFaqeir
Copy link
Contributor Author

@m1ga @hansemannn I believe the PR is ready to be merged?

@m1ga
Copy link
Contributor

m1ga commented Sep 14, 2024

@AbdullahFaqeir I think we should add the new hyperloop module to this PR too as it is needed for it to work. For that tidev/hyperloop.next#391 should build the Github repo so we have a release version. If it is released we can change the version number in:

"url": "https://github.com/tidev/hyperloop.next/releases/download/v7.0.6/hyperloop-7.0.6.zip",
"integrity": "sha512-ZHmm7GINiCyrjvNMn232G1Tkby6PhwsmSxPZlPNDWH4jRn6iCpjIqX1Ha12MBedma01a4hlvARLaiUQ9j3SPow=="

so it will be delivered with the SDK

@m1ga m1ga self-requested a review September 16, 2024 11:55
Copy link
Contributor

@m1ga m1ga left a comment

Choose a reason for hiding this comment

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

My tests look good:

  • building the SDK ✔️
  • building app with multiple existing modules with this SDK ✔️
  • building modules and the included example app ✔️
  • building hyperloop-examples ✔️
  • building kitchensink-v2 ✔️

@cb1kenobi
Copy link
Contributor

Tested on Windows 11, Titanium CLI 7.1.4, Node.js 22.6.0, Java 20.0.1 and my dead simple app (no modules) works great!

Copy link
Collaborator

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

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

LGTM!

@AbdullahFaqeir
Copy link
Contributor Author

LET'S GOOOO 🚀🚀🚀

@hansemannn hansemannn merged commit 50d8604 into tidev:master Sep 17, 2024
5 checks passed
@cb1kenobi
Copy link
Contributor

Excellent work!

@AhmedMSayed
Copy link
Contributor

Halla walla, That's Awesome @AbdullahFaqeir you saved my day

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.

5 participants