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

[Bug]: Project sync fails when resolving project type dependencies on a project with a target other than JS #10

Closed
blakelee opened this issue Jun 29, 2024 · 0 comments · Fixed by #11
Assignees
Labels
bug Something isn't working

Comments

@blakelee
Copy link

Summary

Adding android library to my plugins breaks gradle syncing.

What works

A pure KMP module like this works

plugins {
  alias(libs.plugins.kotlinMultiplatform)
  alias(libs.plugins.kotlinx.serialization)
}

kotlin {
  js(IR) {
    binaries.executable()
    browser()
    nodejs()
  }

  sourceSets {
    commonMain.dependencies {
      implementation(libs.kotlinx.datetime)
      implementation(libs.kotlinx.serialization)
    }
    jsMain {
      languageSettings.optIn("kotlin.js.ExperimentalJsExport")
    }
  }
}

What doesn't work

Adding an android library breaks it

plugins {
  alias(libs.plugins.kotlinMultiplatform)
  alias(libs.plugins.androidLibrary)
  alias(libs.plugins.kotlinx.serialization)
}

kotlin {
  js(IR) {
    binaries.executable()
    browser()
    nodejs()
  }

  androidTarget()

  sourceSets {
    commonMain.dependencies {
      implementation(libs.kotlinx.datetime)
      implementation(libs.kotlinx.serialization)
    }
    jsMain {
      languageSettings.optIn("kotlin.js.ExperimentalJsExport")
    }
  }
}

android {
  namespace = "net.blakelee.groupevents.model"
}

With this exception

org.gradle.api.internal.AbstractMutationGuard$IllegalMutationException: NamedDomainObjectContainer#configureEach(Action) on configuration container cannot be executed in the current context.
	at org.gradle.api.internal.AbstractMutationGuard.createIllegalStateException(AbstractMutationGuard.java:39)
	at org.gradle.api.internal.AbstractMutationGuard.assertMutationAllowed(AbstractMutationGuard.java:27)
	at org.gradle.api.internal.DefaultDomainObjectCollection.assertMutable(DefaultDomainObjectCollection.java:440)
	at org.gradle.api.internal.DefaultDomainObjectCollection.configureEach(DefaultDomainObjectCollection.java:168)
	at io.github.manriif.supabase.functions.kmp.JsDependencyKt.findProjectDependencies(JsDependency.kt:103)

@manriif manriif self-assigned this Jun 29, 2024
@manriif manriif added the bug Something isn't working label Jun 29, 2024
@manriif manriif transferred this issue from manriif/supabase-edge-functions-kt-example Jun 29, 2024
@manriif manriif changed the title Only pure KMP modules seem to work [Bug]: Project sync fails when resolving project type dependencies on a project with a target other than JS Jun 29, 2024
@manriif manriif linked a pull request Jun 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants