Skip to content

Conversation

Thomas-Vos
Copy link

@Thomas-Vos Thomas-Vos commented Apr 14, 2025

This PR creates a new linuxMain source set which depends on nativeMain. It can be created with linux(), this is similar to how it is done for other targets.

Replaced individual linuxX64()/linuxArm64() targets with this new linux() call. I did not add linux support to any new modules, this PR is so the actual PR supporting Linux for Compose UI will be a bit smaller. The additional linuxMain source set is required for that.

Testing

N/A

Release Notes

N/A

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

It seems it's not required change, but "convenience" util

We're working on to align buildSrc with AOSP (ETA is not clear now), so I'd avoid such not-necessary changes there to avoid future merge complications

@Thomas-Vos
Copy link
Author

Thomas-Vos commented May 16, 2025

@MatkovIvan The Linux compose PR needs to add many code to a linuxMain source set (as code is shared between linux x64 and arm64). So I opened this PR to add it. Please suggest how to do this without touching buildSrc. I am not sure it would be better to add this to every build.gradle.

@MatkovIvan
Copy link
Member

        linuxMain {
            dependsOn(skikoMain)
        }

        targets.configureEach { target ->
            if (target.platformType == KotlinPlatformType.native) {
                if (target.konanTarget.family == Family.LINUX) {
                    target.compilations["main"].defaultSourceSet.dependsOn(linuxMain)
                    target.compilations["test"].defaultSourceSet.dependsOn(linuxTest)
                }
            }
        }

savedstate/savedstate/build.gradle might be a good example

@Thomas-Vos
Copy link
Author

Ok, I will do that instead as you prefer.

@Thomas-Vos Thomas-Vos closed this May 17, 2025
@Thomas-Vos
Copy link
Author

I guess it would still be nice if my changes could be added to AOSP to align linux with the other targets.

@JakeWharton
Copy link

You could contribute them to AOSP directly. Then they will trickle down to here.

@Thomas-Vos
Copy link
Author

Thomas-Vos commented May 17, 2025

It appears the files changed in buildSrc in this PR do not exist in AOSP version. The changes are all in compose-multiplatform-core specific files, so I cannot add it in AOSP. It needs to be added in the Jetbrains fork.

I do not see how this could cause any conflicts if changes in buildSrc are all Jetbrains specific code. @MatkovIvan could you reconsider merging this? Or should I just drop the whole idea of a linuxMain sourceset? It is needed by many compose modules to add linux support.

@Thomas-Vos Thomas-Vos reopened this May 17, 2025
@MatkovIvan
Copy link
Member

It appears the files changed in buildSrc in this PR do not exist in AOSP version. The changes are all in compose-multiplatform-core specific files, so I cannot add it in AOSP. It needs to be added in the Jetbrains fork.

Exactly. That's why merging this will require by-hand adoption to AOSP version later.

You could contribute them to AOSP directly.

It's a good option even if it's not used in fork's jb-main right now

Or should I just drop the whole idea of a linuxMain sourceset? It is needed by many compose modules to add linux support.

I still see it as helper convenience util, but not as a requirement for adding linuxMain sourcesets. Could you please clarify why the existing approach of adding sourcesets like linuxMain doesn't work for you?

@MatkovIvan could you reconsider merging this?

My objections are not strong here. cc @igordmn for final word

@Thomas-Vos
Copy link
Author

It is not that adding it in every build.gradle will not work, but I think a new function would be a better solution. If you look at the other platforms, you see functions like android(), desktop(), darwin(). A new linux() function instead of existing linuxX64() and linuxArm64() would be the best I think. It would be in line with other targets and there would be less code in the individual build.gradle files. If that is not what you would prefer it not a problem for adding Linux support.

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

I've re-checked the current status of AOSP and it's already there, so no blockers from me.

Sorry for previous confusion and thanks for the contribution

@igordmn
Copy link
Collaborator

igordmn commented May 20, 2025

Please, fix CI.

P.S. it is not a complete list of checks, we have an issue running them for external PRs on TeamCity at the moment

@Thomas-Vos
Copy link
Author

@igordmn fixed by rebasing and adding linux() shortcut to the affected modules. https://github.com/Thomas-Vos/compose-multiplatform-core/actions/runs/15138676522

@igordmn igordmn merged commit 42cfce6 into JetBrains:jb-main May 20, 2025
3 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.

4 participants