https://kotlinlang.org logo
#splitties
Title
# splitties
l

louiscad

06/17/2019, 10:58 AM
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

ribesg

06/17/2019, 11:01 AM
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

ribesg

06/17/2019, 11:04 AM
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

louiscad

06/17/2019, 12:53 PM
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

ribesg

06/17/2019, 12:55 PM
Yeah... a MacOS CI 😕
l

louiscad

06/17/2019, 12:58 PM
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

ribesg

06/17/2019, 1:10 PM
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

louiscad

06/17/2019, 1:11 PM
But will these not overlap?
r

ribesg

06/17/2019, 1:11 PM
No, one will be
lib-android-debug
l

louiscad

06/17/2019, 1:12 PM
And the other will have
-release
suffix?
r

ribesg

06/17/2019, 1:12 PM
message has been deleted
No
l

louiscad

06/17/2019, 1:13 PM
That means that I'm breaking it by setting a custom
artifactId
in
mavenPublication { … }
?
r

ribesg

06/17/2019, 1:13 PM
Maybe, I’m using this for the Android target
Copy code
android {
        publishAllLibraryVariants()
    }
l

louiscad

06/17/2019, 1:18 PM
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

ribesg

06/17/2019, 1:57 PM
I tried once to build only the android targets to see if I could build them on a non-MacOS CI and failed
7 Views