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

[Feature request] kmp support #26

Open
umesh0492 opened this issue Feb 20, 2025 · 5 comments
Open

[Feature request] kmp support #26

umesh0492 opened this issue Feb 20, 2025 · 5 comments

Comments

@umesh0492
Copy link

No description provided.

@0xera
Copy link
Collaborator

0xera commented Feb 20, 2025

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

@umesh0492
Copy link
Author

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
Copy link
Author

umesh0492 commented Feb 21, 2025

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
Copy link
Author

umesh0492 commented Feb 21, 2025

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
Copy link
Author

@natario1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants