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

Add app-desktop module #452

Merged

Conversation

nyafunta9858
Copy link

@nyafunta9858 nyafunta9858 commented Aug 14, 2024

Issue

Overview (Required)

  • Add a Compose for Desktop application's module, named app-desktop.
  • Add KmpDesktop plugin class.
  • Add Main class for app-desktop which only says Hello.
  • Add to import KmpCompose plugin into KmpDesktop plugin.

Links

Movie (Optional)

Launch from Run Configuration Launch from source code Launch from Gradle Tasks Generate dmg package
2024-08-15.23.56.41.mov
2024-08-15.23.52.07.mov
2024-08-15.23.53.53.mov
2024-09-07.21.12.46.mov

Notes

  • Run (build and launch) the desktop application
./gradlew :app-desktop:run
  • Generate the desktop application dmg package.
./gradlew :app-desktop:packageDmg

It is probably better to use :app-desktop:packageDistributionForCurrentOS but this app is built only for debugging by contributors, so I set only for macOS dmg package format to configuration of targetFormats, now.
Therefore, it is enough to use packageDmg for checking build normally.


nativeDistributions {
// TODO: set output formats of each platform
targetFormats(TargetFormat.Dmg, /*TargetFormat.Msi, TargetFormat.Deb*/)
Copy link
Author

@nyafunta9858 nyafunta9858 Aug 14, 2024

Choose a reason for hiding this comment

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

It needs to set up a configuration for each platform we need.
But... it probably no need to set it up if only executes from IDE or as a Gradle Task.

reference:
https://github.com/JetBrains/compose-multiplatform/blob/master/examples/imageviewer/desktopApp/build.gradle.kts

iconFile.set(iconsRoot.resolve("desktop-icon.png"))
}
// Setup Windows and Linux configuration if needed.
// windows {
Copy link
Author

@nyafunta9858 nyafunta9858 Aug 14, 2024

Choose a reason for hiding this comment

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

It needs to set up a configuration for each platform we need.
But... it may be enough to be supported only for the macOS for a while.

reference:
https://github.com/JetBrains/compose-multiplatform/blob/master/examples/imageviewer/desktopApp/build.gradle.kts

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 14, 2024 15:51 Inactive
@@ -3,6 +3,7 @@ plugins {
id("droidkaigi.primitive.kmp.android")
id("droidkaigi.primitive.kmp.ios")
id("droidkaigi.primitive.kmp.compose")
id("droidkaigi.primitive.kmp.desktop")
Copy link
Author

Choose a reason for hiding this comment

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

KmpDesktop plugin is applied here, but the main necessary definition is jvm() call.

It seems to be required to call from the desktop app.

Copy link
Author

Choose a reason for hiding this comment

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

Added the same as the Android logo icon.
It requires to preparation of icons for each platform as necessary.

reference:
https://github.com/JetBrains/compose-multiplatform/tree/master/examples/imageviewer/desktopApp/desktop-icons

@nyafunta9858 nyafunta9858 changed the title [WIP] Add app-desktop module Add app-desktop module Aug 15, 2024
@nyafunta9858 nyafunta9858 marked this pull request as ready for review August 15, 2024 15:09
Copy link

Detekt check failed. Please run ./gradlew detekt --auto-correct to fix the issues.

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 16, 2024 01:32 Inactive
@takahirom
Copy link
Member

Is there a Gradle task we can use to verify the desktop build for CI? I'm concerned it could break at any time.

@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 16, 2024

@takahirom
Thank you for your checking 🙏
We can use :app-desktop:packageDmg to check the build is normal on CI!
I use :app-desktop:run when launching the desktop app on Android Studio, but :app-desktop:packageDmg includes all steps of it, and creating dmg binary to install on macOs.

I have already added a workaround to gradle.properties, because it seemed to fail in checkRuntime, a step in :app-desktop:packageDmg, depending on the JDK distribution like the attached image.
image

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 16, 2024 07:23 Inactive
@github-actions github-actions bot temporarily deployed to deploygate-distribution August 16, 2024 08:03 Inactive
@takahirom
Copy link
Member

Maybe it is related to this issue and PR. We might have to use snapshot version of AndroidX 😇
#453

@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 16, 2024

@takahirom
This may be bad news. I updated the compose multiplatform plugin (org.jetbrains.compose) version from 1.6.11 to 1.7.0-alpha02 for importing compose navigation into app-desktop, but I noticed this update made several unit tests fail.
And I tried to test with the v1.6.11 compose multiplatform plugin and all test cases succeeded... ummmm
What shall I do this problem?

@takahirom
Copy link
Member

takahirom commented Aug 17, 2024

As I was saying, we might have to update the snapshot version of AndroidX, but I'm not sure if it's safe.

Here are a couple of points to consider:

@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 17, 2024

I see, I understand it. And I'm sorry for my misreading.
Thank you for your advice, I'll try to research solution that can avoid each issues.

@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 17, 2024

@takahirom
I will share my progress of investigation this PR's issues.
(It's still tough situation...)

In progress

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 18, 2024 07:48 Inactive
@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 19, 2024

I've investigated a lot about the above issues, but I couldn't find a solution not to crash the desktop app, other than Compose Multiplatform Plugin bump up to 1.7.0-alpha01 or higher.
Therefore, in my opinion, I guess to be better the following steps to be taken. Please let me know your opinion. 🙏

  1. To complete issue Add app-desktop module for faster development #300, remove references to navigation-compose from app-desktop module to avoid the crash issue. And then I will request your review again.
  2. Create an issue ticket to resolve some problems this PR has been encountered.
  3. In the above issue, we will be waiting for an update compose to fix Robolectric timeout issue.

@nyafunta9858
Copy link
Author

nyafunta9858 commented Aug 24, 2024

@takahirom
I have finished removing dependencies to the Navigation Compose from the app-desktop module and added several todo comments that it needs to fix some issues to be available to use Navigation Compose on Compose Desktop.
And I checked both tasks were succeeded, unit tests and create desktop app package, :app-desktop:packageDistributionForCurrentOS and :app-desktop:packageDmg.

So once again, could you please review this PR whenever you are free?
Thanks for your kindness 🙏

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 25, 2024 00:27 Inactive
@takahirom
Copy link
Member

@nyafunta9858 I have a big news. foundation 1.8.0-alpha01 has been released and we should be able to upgrade the foundation 🎉

@nyafunta9858
Copy link
Author

Thanks for your beneficial information, @takahirom !
I too have encountered the following issue, so I'd like to retry building the desktop app and verifying unit tests after resolving it!
#984

@takahirom
Copy link
Member

@nyafunta9858 I've merged the PR!

@github-actions github-actions bot temporarily deployed to deploygate-distribution September 7, 2024 12:09 Inactive
@nyafunta9858
Copy link
Author

@takahirom
I have committed some changes, and checked launching the desktop-app that depends on Navigation Compose normally.
So once again, could you please review this PR whenever you are free?
Thanks for your kindness 🙏

@takahirom
Copy link
Member

@nyafunta9858 It might be a little confusing when we introduce the app-desktop module with the Hello KaigiApp text. Could you connect one screen, for example, the contributor screen? This might be good for confirming the technology. I think this PR is still small and fine.

@takahirom takahirom changed the base branch from main to app-desktop September 8, 2024 02:43
@takahirom
Copy link
Member

I think we can create a feature branch for this. Once it works with one screen, I would like to merge it into the main branch. Thank you for investigating KMP possibilities. I'll merge this into the feature branch.

@takahirom takahirom merged commit 7742e5f into DroidKaigi:app-desktop Sep 8, 2024
6 checks passed
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.

Add app-desktop module for faster development
2 participants