nguyen tuan
01/03/2024, 2:02 AMplugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("dev.petuska.npm.publish") version "3.4.0"
}
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
js(IR) {
binaries.library()
browser()
}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
framework {
baseName = "kotlinmultiplatformsharedmodule"
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
npmPublish {
registries {
register("npmjs") {
uri.set(uri("<https://registry.npmjs.org>")) //
authToken.set("obfuscated")
}
}
}
android {
namespace = "com.example.kotlinmultiplatformsharedmodule"
compileSdk = 32
defaultConfig {
minSdk = 21
targetSdk = 32
}
}
I also use https://github.com/mpetuska/npm-publish, but i still got ‘Node Distributions at https://nodejs.org/dist’ was added by unknown code’ when try to build.
If I add KMP to react project without build it will not recognize the import module when run the app.
Do you guys have any ideas for this issue?Adam S
01/04/2024, 11:54 AMAdam S
01/04/2024, 11:56 AMnguyen tuan
01/05/2024, 2:58 AMpluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// Declare the Node.js & Yarn download repositories
exclusiveContent {
forRepository {
ivy("<https://nodejs.org/dist/>") {
name = "Node Distributions at $url"
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
metadataSources { artifact() }
content { includeModule("org.nodejs", "node") }
}
}
filter { includeGroup("org.nodejs") }
}
exclusiveContent {
forRepository {
ivy("<https://github.com/yarnpkg/yarn/releases/download>") {
name = "Yarn Distributions at $url"
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
metadataSources { artifact() }
content { includeModule("com.yarnpkg", "yarn") }
}
}
filter { includeGroup("com.yarnpkg") }
}
ivy("<https://github.com/>") {
name = "GitHub Release"
// used to download YAML Test Suite data from GitHub
patternLayout {
artifact("[organization]/[module]/archive/[revision].[ext]")
artifact("[organization]/[module]/archive/refs/tags/[revision].[ext]")
artifact("[organization]/[module]/archive/refs/tags/v[revision].[ext]")
}
metadataSources { artifact() }
}
}
}
rootProject.name = "kmmsharelib"
include ':appkmm'
include ':kotlinmultiplatformsharedmodule'
Can you give me some advices?Adam S
01/05/2024, 9:37 AMsettings.gradle
to settings.gradle.kts
:)nguyen tuan
01/08/2024, 12:05 PMpluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// Declare the Node.js & Yarn download repositories
exclusiveContent {
forRepository {
ivy("<https://nodejs.org/dist/>") {
name = "Node Distributions at $url"
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
metadataSources { artifact() }
content { includeModule("org.nodejs", "node") }
}
}
filter { includeGroup("org.nodejs") }
}
exclusiveContent {
forRepository {
ivy("<https://github.com/yarnpkg/yarn/releases/download>") {
name = "Yarn Distributions at $url"
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
metadataSources { artifact() }
content { includeModule("com.yarnpkg", "yarn") }
}
}
filter { includeGroup("com.yarnpkg") }
}
ivy("<https://github.com/>") {
name = "GitHub Release"
// used to download YAML Test Suite data from GitHub
patternLayout {
artifact("[organization]/[module]/archive/[revision].[ext]")
artifact("[organization]/[module]/archive/refs/tags/[revision].[ext]")
artifact("[organization]/[module]/archive/refs/tags/v[revision].[ext]")
}
metadataSources { artifact() }
}
}
}
rootProject.name = "kmmsharelib"
include(":appkmm")
include(":kotlinmultiplatformsharedmodule")
Can you help to fix this issue?Adam S
01/08/2024, 4:06 PMcannot determine the dependencies of task ‘:kotlinmultiplatformsharedmodule:compileKotlinJs’
- it looks like a separate issue that you'll need to provide more information about. I recommend a new thread :) It would help to see the full error, and what Gradle/Kotlin version you're using.Adam S
01/08/2024, 4:06 PMivy("<https://github.com/>")
repo, unless you're planning to download source code from GitHub using Gradle