Grease icon indicating copy to clipboard operation
Grease copied to clipboard

[Feature request] kmp support

Open umesh0492 opened this issue 10 months ago • 5 comments

umesh0492 avatar Feb 20 '25 10:02 umesh0492

This seems to be supported already. Could you please share your thoughts or tell what the problem is here?

0xera avatar Feb 20 '25 14:02 0xera

Please share the sample code snippet @0xera . As I am getting the error of `A problem occurred configuring project ':moduleA'.

Failed to notify project evaluation listener. Cannot query the value of property 'component' because it has no value available. Cannot query the value of property 'component' because it has no value available. `

umesh0492 avatar Feb 21 '25 11:02 umesh0492

Just added in pluggin -> id("io.deepmedia.tools.grease") version ("0.3.4") Using -> com.vanniktech.maven.publish

Kotlin 2.1.10 gradle -> 8.11 JVM 17

umesh0492 avatar Feb 21 '25 11:02 umesh0492

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidLibrary)
    alias(libs.plugins.kotlinxSerialization)
    alias(libs.plugins.dokka)
    alias(internal.plugins.maven.publish)
    alias(internal.plugins.binary.validator)
    id("io.deepmedia.tools.grease") version ("0.3.4")
}

version = "0.0.1"

kotlin {
    // https://kotlinlang.org/docs/multiplatform-expect-actual.html#expected-and-actual-classes
    // To suppress this warning about usage of expected and actual classes
    @OptIn(ExperimentalKotlinGradlePluginApi::class)
    compilerOptions {
        freeCompilerArgs.add("-Xexpect-actual-classes")
    }

    androidTarget {
        publishLibraryVariants("release")
    }
    sourceSets {

        commonMain {
            dependencies {
                api(someLib)
            }
        }

        androidMain {
           dependencies {
                implementation(someLib)
          }
      }
  }
}

android {
    compileSdk = (findProperty("android.compileSdk") as String).toInt()
    namespace = "com.moduleA"
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

    defaultConfig {
        minSdk = (findProperty("android.minSdk") as String).toInt()
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
}


mavenPublishing {
    // Define coordinates for the published artifact
    configure(
        KotlinMultiplatform(
            javadocJar = JavadocJar.Dokka("dokkaGenerateModuleHtml"),
            sourcesJar = true,
        )
    )
    coordinates(
        artifactId = "moduleA",
    )
}

umesh0492 avatar Feb 21 '25 12:02 umesh0492

@natario1

umesh0492 avatar Feb 24 '25 08:02 umesh0492