LouisCAD / Splitties

A collection of hand-crafted extensions for your Kotlin projects.
https://splitties.louiscad.com
Apache License 2.0
2.53k stars 159 forks source link

Multiplatform publishing not working on 3.0.0-beta02 & 3.0.0-beta03 #280

Closed frett closed 3 years ago

frett commented 3 years ago

When I update my multiplatform dependencies to use the new versions of splitties from maven central I get the following build error:

* What went wrong:
Execution failed for task ':compileKotlinIos'.
> Could not resolve all files for configuration ':iosCompileKlibraries'.
   > Could not find com.louiscad.splitties:bitflags-iosx64:3.0.0-beta02.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/louiscad/splitties/bitflags-iosx64/3.0.0-beta02/bitflags-iosx64-3.0.0-beta02.pom
       - https://repo.maven.apache.org/maven2/com/louiscad/splitties/bitflags-iosx64/3.0.0-beta02/bitflags-iosx64-3.0.0-beta02.pom
     Required by:
         project : > com.louiscad.splitties:splitties-bitflags:3.0.0-beta02

it appears that the main module found here has the following invalid relative url defined in it:

    {
      "name": "iosX64ApiElements-published",
      "attributes": {...},
      "available-at": {
        "url": "../../bitflags-iosx64/3.0.0-beta03/bitflags-iosx64-3.0.0-beta03.module",
        "group": "com.louiscad.splitties",
        "module": "bitflags-iosx64",
        "version": "3.0.0-beta03"
      }
    },
LouisCAD commented 3 years ago

Can you show how you declared the dependency?

frett commented 3 years ago

I'm using the new VERSION_CATALOGS gradle feature.

libs.version.toml:

[versions]
splitties = "3.0.0-beta03"

[libraries]
splitties-bitflags = { module = "com.louiscad.splitties:splitties-bitflags", version.ref = "splitties" }

build.gradle.kts:

kotlin {
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(libs.splitties.bitflags)
            }
        }
    }
}

PR with the upgrade: https://github.com/CruGlobal/kotlin-mpp-godtools-tool-parser/pull/88

frett commented 3 years ago

~hmm, it appears to be running fine in Github Actions, but not on my local machine. I'll do a bit of debugging on my end.~

I take that back, it's only failing for the ios target, it works for the other targets

LouisCAD commented 3 years ago

Do you still have the issue when adding the following into your gradle.properties file?

Documentation: https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
frett commented 3 years ago

yeah, still have the same issue when setting those flags.

frett commented 3 years ago

I created a minimal reproduction project here: https://github.com/frett/splitties-mpp-dependency-issue

when the dependency is set to 3.0.0-beta01 the build succeeds, when it's set to 3.0.0-beta03 the build fails

LouisCAD commented 3 years ago

Thanks for the report and the reproducer, and sorry for the vacations related delay.

I'm on it, with a solution that should prevent this from happening again, no matter what subtle changes take place in the Kotlin Gradle plugin.

LouisCAD commented 3 years ago

Fixed in 3.0.0-beta04 that I just released. Should be available on MavenCentral within half an hour.