I've not yet figured out how to get publishing to ...
# splitties
l
I've not yet figured out how to get publishing to work (other than through mavenLocal), so if you want to try, I recommend to wait a little unless you want to clone it and dig a bit
r
I’ve got this
Copy code
publishing {
    repositories {
        maven {
            url = if (Versions.isSnapshot) {
                uri("snapshot-repo-uri")
            } else {
                uri("release-repo-uri")
            }
            credentials {
                username = "username"
                password = "password"
            }
        }
    }
}
That’s all I need, with the maven-publish plugin
Then on the android target I call
publishAllLibraryVariants()
, and my iOS targets are defined like this
Copy code
for ((targetName, presetName, id) in iosTargets) {
        targetFromPreset(presets.getByName<KotlinNativeTargetPreset>(presetName), targetName) {
            mavenPublication {
                artifactId = "${project.name}-$id"
            }
        }
    }
r
Yeah I’m publishing to a private artifactory instance, it’s pretty much instant
Compared to the time it takes to build the iOS targets...
l
Oh yeah, that is so slow… I hope it'll improve before I add iOS support to too many splits. On a more positive note, that may encourage me to add a CI to the project so my laptop can stay cool.
r
Yeah... a MacOS CI 😕
l
Travis CI does it as I saw it run checks on macOS last time I submitted a PR to SqlDelight
Did you ever encounter such an error?
Variant 'android-releaseApiElements' capability com.louiscad.splittiessplitties fun pack android base with views dsl3.0.0-dev-015:
- Incompatible attribute:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
r
Yes, you need to publish both release and debug
I did not find a way to say that release dependencies were fine to use with debug build
l
But will these not overlap?
r
No, one will be
lib-android-debug
l
And the other will have
-release
suffix?
r
message has been deleted
No
l
That means that I'm breaking it by setting a custom
artifactId
in
mavenPublication { … }
?
r
Maybe, I’m using this for the Android target
Copy code
android {
        publishAllLibraryVariants()
    }
l
Oh, found this by navigation from `publishAllLibraryVariants()`:
Copy code
if (!publishLibraryVariantsGroupedByFlavor) {
    defaultArtifactIdSuffix =
        dashSeparatedName(
            (getFlavorNames(androidVariant) + getBuildTypeName(androidVariant).takeIf { it != "release" })
                .map { it?.toLowerCase() }
        ).takeIf { it.isNotEmpty() }
}
That explains
I've tried to add an option to skip the Kotlin/Native targets, but it's bringing an error when I activate it:
Copy code
* What went wrong:
Could not determine the dependencies of task ':fun-packs:android-base:publishAndroidDebugPublicationToMavenLocal'.
> Publishing is not able to resolve a dependency on a project with multiple publications that have different coordinates.
  Found the following publications in project ':modules:bitflags':
    - Maven publication 'kotlinMultiplatform' with coordinates com.louiscad.splitties:splitties-bitflags-mpp:3.0.0-dev-015
    - Maven publication 'macosX64' with coordinates com.louiscad.splitties:splitties-bitflags-macosx64:3.0.0-dev-015
    - Maven publication 'iosX64' with coordinates com.louiscad.splitties:splitties-bitflags-iosx64:3.0.0-dev-015
    - Maven publication 'iosArm64' with coordinates com.louiscad.splitties:splitties-bitflags-iosarm64:3.0.0-dev-015
    - Maven publication 'iosArm32' with coordinates com.louiscad.splitties:splitties-bitflags-iosarm32:3.0.0-dev-015
Have you ever encountered such a thing?
r
I tried once to build only the android targets to see if I could build them on a non-MacOS CI and failed