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

Use Published Library With Multiplatform Project #10

Closed
hfhbd opened this issue Nov 25, 2020 · 5 comments
Closed

Use Published Library With Multiplatform Project #10

hfhbd opened this issue Nov 25, 2020 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@hfhbd
Copy link
Contributor

hfhbd commented Nov 25, 2020

Hey,
I created a simple Multiplatform project, using this UUID library in commonMain

// gradle.build.kts
sourceSets {
    commonMain {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core:0.0.1")
    }  
}

Branch: https://github.com/hfhbd/ComposeTodo/tree/simple
Commit: hfhbd/ComposeTodo@e4c5395 and the CI

However, in each target, only this UUID library is not found by Gradle. You still need to include the explicit library for each source set.

sourceSets {
    commonMain {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core:0.0.1")
        }
    }
    val jsMain by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core-js:0.0.1")
        }
    }
    val iosMain by getting {
        dependencies {
        }
    }
    val iosArm64Main by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core-iosarm64:0.0.1")
        }
    }
    val iosX64Main by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core-iosx64:0.0.1")
        }
    }
    val jvmMain by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx.experimental:kotlinx-uuid-core-jvm:0.0.1")
        }
    }   
}

Workaround: hfhbd/ComposeTodo@e40928e and the CI

@cy6erGn0m Do you know why this problem exists? Is something of the published library still missing?

@cy6erGn0m
Copy link
Owner

Looks like somethig is wrong with module metadata or pom files that should have some placeholder.

@cy6erGn0m
Copy link
Owner

The following fixes your issue. Gradle doesn't want to pick up metadata for some reason:

repositories {
    maven {
        setUrl("https://dl.bintray.com/cy6ergn0m/uuid")
        metadataSources { gradleMetadata() } // this does the trick!
    }
}

@cy6erGn0m
Copy link
Owner

From this https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html#sub:interactions-other-build-tools

the pom.xml or ivy.xml file will contain a marker comment which tells Gradle that Gradle Module Metadata exists for this module

So I've lost the marker comment for some reason

@hfhbd
Copy link
Contributor Author

hfhbd commented Nov 26, 2020

The following fixes your issue. Gradle doesn't want to pick up metadata for some reason:

repositories {
    maven {
        setUrl("https://dl.bintray.com/cy6ergn0m/uuid")
        metadataSources { gradleMetadata() } // this does the trick!
    }
}

Thank you! This is working.

@cy6erGn0m cy6erGn0m added this to the 0.0.2 milestone Nov 26, 2020
@cy6erGn0m cy6erGn0m added the bug Something isn't working label Nov 26, 2020
@cy6erGn0m cy6erGn0m self-assigned this Nov 26, 2020
@cy6erGn0m
Copy link
Owner

Fixed in 0.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants