Skip to content

Comments

Resources improvements for native macOS app#5219

Merged
terrakok merged 1 commit intoJetBrains:masterfrom
Thomas-Vos:resources-improvements-macos
Feb 21, 2025
Merged

Resources improvements for native macOS app#5219
terrakok merged 1 commit intoJetBrains:masterfrom
Thomas-Vos:resources-improvements-macos

Conversation

@Thomas-Vos
Copy link
Contributor

@Thomas-Vos Thomas-Vos commented Jan 28, 2025

See old PR for details: #5169

Requires skiko update (JetBrains/compose-multiplatform-core#1804)

@Thomas-Vos
Copy link
Contributor Author

@terrakok Skiko is now already updated on jb-main branch. Would it be possible to run CI on this PR to check if all is working?

@Thomas-Vos Thomas-Vos force-pushed the resources-improvements-macos branch from e22b11b to e5d45f2 Compare February 9, 2025 23:32
@Thomas-Vos
Copy link
Contributor Author

@terrakok tested on an Intel Mac and the tests now pass with the updated skiko version:

Screenshot 2025-02-10 at 00 33 52

In gradle-plugins module I set compose.version=1.8.0+dev2049 in gradle.properties and used local build of resources lib (set 0.1.0-SNAPSHOT version for resources in ComposePlugin.kt).

@Thomas-Vos
Copy link
Contributor Author

Could this be reviewed, please? Is there anything that needs to be changed?

@terrakok terrakok merged commit 76d9411 into JetBrains:master Feb 21, 2025
0 of 18 checks passed
terrakok added a commit that referenced this pull request Feb 21, 2025
@igordmn
Copy link
Collaborator

igordmn commented Feb 21, 2025

Apologise, the PR was reverted.

Could you fix the CI failures and make a new PR?
https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Dev/4997310
https://github.com/JetBrains/compose-multiplatform/actions/runs/13460804661

ubuntu/windows:

ResourcesTest > testMultiModuleResources(kotlin=2.1.0, gradle=8.10.2, agp=8.1.0) FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at ResourcesTest.kt:301

macos:

ResourcesTest > checkTestResources(kotlin=2.1.0, gradle=8.10.2, agp=8.1.0) FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at ResourcesTest.kt:826

ResourcesTest > testMultiModuleResources(kotlin=2.1.0, gradle=8.10.2, agp=8.1.0) FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at ResourcesTest.kt:316

@terrakok
Copy link
Member

org.jetbrains.compose.test.tests.integration.ResourcesTest.testMultiModuleResources(kotlin=2.1.0, gradle=8.8, agp=8.5.0) fails on Linux with:

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find me.sample.library:cmplib-macosarm64:1.0.
Searched in the following locations:
  - https://repo.maven.apache.org/maven2/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - https://dl.google.com/dl/android/maven2/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - https://packages.jetbrains.team/files/p/mpp/kgp-for-compose2/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - https://maven.pkg.jetbrains.space/public/p/compose/dev/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - file:/root/.m2/repository/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
  - file:/mnt/agent/temp/buildTmp/junit3414287715548457763/my-mvn/me/sample/library/cmplib-macosarm64/1.0/cmplib-macosarm64-1.0.pom
Required by:
    project :appModule > me.sample.library:cmplib:1.0

Thomas-Vos added a commit to Thomas-Vos/compose-multiplatform that referenced this pull request Feb 24, 2025
Thomas-Vos added a commit to Thomas-Vos/compose-multiplatform that referenced this pull request Feb 24, 2025
@Thomas-Vos
Copy link
Contributor Author

@igordmn @terrakok thanks for letting me know, opened a new PR: #5245

It would be nice if TeamCity works on PRs as well, just like how Ktor does it. That would make contributing easier.

ubuntu/windows:

Reproduced on Ubuntu, caused by a bug in checkExperimentalTargets.kt, fixed by second commit in new PR.

macos:

My bad, I thought GitHub CI would override compose.version in gradle.properties just like TeamCity, but it does not. GitHub CI was broken in this PR so did not notice the issue, but seems to work again in PR and shows this is now fixed.

Now there is only failed test on GitHub CI due to MissingResourceException, which is because CI does not use latest version of resources component library, it has changes which are required for the test to succeed.

terrakok pushed a commit that referenced this pull request Mar 11, 2025
This PR fixes compose resources for native macOS app (see currently
broken chat app using runDebugExecutableMacosArm64).

This PR also adds support for embedding resources into native macOS
framework. Similar to how it works on iOS. This allows using the macOS
compose code in an Xcode project. Just like iOS, using kotlin code as
framwork. Then call the main function from the Xcode project to run the
compose app.

#5219
#5169

## Testing
- For executable: run chat app using runDebugExecutableMacosArm64
- For framework: Tested by adding macOS support to the iOS Xcode project
in chat app (not in this PR). Can add the sample app if needed. There
were also tests added to verify this.

## Release Notes
N/A
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.

3 participants