kuuuurt / multiplatform-paging

Kotlin Multiplatform library for Pagination
Apache License 2.0
250 stars 22 forks source link

Paging lib is invisible after adding the dependency to commonMain. #11

Closed TomWayne98 closed 3 years ago

TomWayne98 commented 3 years ago

Hello,

I have tried to add the library to the empty projects and everything worked fine. However, when I added the dependency to project which already contains some other libraries I am getting this error:

Unable to build Kotlin project configuration

Unable to build Kotlin project configuration

org.gradle.internal.resolve.ArtifactNotFoundException: Could not find multiplatform-paging-0.3.9-samplessources.jar (io.github.kuuuurt:multiplatform-paging:0.3.9).

After this I can still hardcode the import paths to the project and use the Paging but IDE do not see it and points it as an unresolved refferce (despite the fact that project still compiles).

Any idea how to solve it?

My build.gradle looks like this:

plugins {
    id("com.android.library")
    kotlin("multiplatform")
    kotlin("plugin.serialization")
    id("io.gitlab.arturbosch.detekt")
    id("maven-publish")
    id("com.prof18.kmp.fatframework.cocoa") version "0.0.1"
}

version = "1.0-SNAPSHOT"

repositories {
    jcenter()
    gradlePluginPortal()
    google()
    mavenCentral()
    maven {
        url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
    }
}

/**
 * Publishing of ios framework
 * see this for info how to do it: https://github.com/prof18/kmp-fatframework-cocoa
 *
 * Publishing of Android framework
 * call ./gradlew :kmpcorelib:assemble -> it i will create the aar file in root dir
 */
fatFrameworkCocoaConfig {
    fatFrameworkName = "KMPCore"
    namePrefix = "KMPCore"
    outputPath = "$rootDir/../cocoapods_repo"
    versionName = "1.0"

    cocoaPodRepoInfo {
        summary = "This is a Betsys KMP framework for iOS client"
        homepage = "git@gitlab.betsys.com:mobile-apps/kmp-ios.git"
        license = "Apache"
        authors = "\"BetSys\""
        gitUrl = "git@gitlab.betsys.com:mobile-apps/kmp-ios.git"
    }
}

group = "com.betsys.kmpcorelib"

detekt {
    autoCorrect = true
    config = files("$rootDir/config/detekt.yml")
    baseline = file("$rootDir/config/baseline.xml")
    input = files("src/commonMain/kotlin")
    reports {
        html.enabled = true
        xml.enabled = true
        txt.enabled = true
    }
}

val ktorVersion = "1.5.0"
val sqlDelightVersion: String by project
val napierVersion = "1.4.1"
val koinVersion ="3.0.1-beta-2"

kotlin {
    android()
    // We cant use simple ios() target now, since it doesnt support Arm32 architecture
    // For that reason we have specify each target explicitly
    // Same for folders with iOS code. We havet to use duplicit iosX64Main etc. instead of one iosMain folder
    iosArm32  {
        binaries.framework("KMPCore")
    }
    iosArm64 {
        binaries.framework("KMPCore")
    }
    iosX64  {
        binaries.framework("KMPCore")
    }

    android {
        publishLibraryVariants("release", "debug")
        publishLibraryVariantsGroupedByFlavor = true
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-serialization:$ktorVersion")
                implementation("io.ktor:ktor-client-logging:$ktorVersion")
                implementation("io.ktor:ktor-client-mock:$ktorVersion")
                implementation("io.insert-koin:koin-core:$koinVersion")
                implementation("com.benasher44:uuid:0.2.3")
                api("io.github.kuuuurt:multiplatform-paging:0.3.9")
            }
        }

        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))

            }
        }
        val androidMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-android:$ktorVersion")
                implementation("com.google.android.material:material:1.2.0")
                implementation("com.github.aakira:napier:$napierVersion")
                implementation("io.ktor:ktor-client-okhttp:$ktorVersion")

            }
        }
        val androidTest by getting {
            dependencies {
                implementation(kotlin("test-junit"))
                implementation("junit:junit:4.12")
            }
        }

        val iosArm64Main by getting {
            dependencies {
                implementation("io.ktor:ktor-client-ios:$ktorVersion")
                implementation("com.github.aakira:napier:$napierVersion")
                implementation("io.ktor:ktor-client-ios:$ktorVersion")
            }
        }
        val iosX64Main by getting {
            dependencies {
                implementation("io.ktor:ktor-client-ios:$ktorVersion")
                implementation("com.github.aakira:napier:$napierVersion")
            }
        }

        val iosArm32Main by getting {
            dependencies {
                implementation("io.ktor:ktor-client-ios:$ktorVersion")
            }
        }
        val iosArm64Test by getting
        val iosArm32Test by getting
        val iosX64Test by getting
    }
}

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

    defaultConfig {
        minSdkVersion(19)
        targetSdkVersion(30)
        versionCode = 1
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }

    packagingOptions {
        excludes.add("META-INF/*.kotlin_module")
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
}

publishing {
    repositories {
        maven {
            name = "reposilite"
            url =
                uri("http://maven.betsys.com/${if ((project.version as String).endsWith("-SNAPSHOT")) "snapshots/" else "releases/"}")

            credentials {
                username = "deployer"
                password = "0g3eRmIXPtV5iBnmCPC56MQC8FLZQCVf3df9S+uZ9OCqOd/1z0rLfYpn2SJgcMZd"
            }
        }
    }
}
kuuuurt commented 3 years ago

Hi @TomWayne98. Thanks for bringing this issue up. I realized that I've been using 0.3.8 which was on bintray on my projects. I currently released 0.3.11 but it's taking a while for the release to get propagated in mavenCentral. Once it's available, the issue should be fixed. Sorry for the inconvenience!