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

Unable to import the library into my Compose Desktop project #8

Open
Genie23 opened this issue Aug 13, 2021 · 5 comments
Open

Unable to import the library into my Compose Desktop project #8

Genie23 opened this issue Aug 13, 2021 · 5 comments

Comments

@Genie23
Copy link

Genie23 commented Aug 13, 2021

Hello,

I try to import your library in my project to make graphics, but without success.

My build.gradle.kts :

import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.5.21"
    id("org.jetbrains.compose") version "1.0.0-alpha4-build310"
}

group = "fr.genie23"
version = "1.0.0"

repositories {
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    google()
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.21")
    implementation(compose.desktop.currentOs)
    implementation("ma.hu:compose-charts:0.3.1")
    implementation("org.apache.pdfbox:pdfbox:2.0.24")
    implementation("org.apache.pdfbox:fontbox:2.0.24")
    implementation("org.apache.pdfbox:jempbox:1.8.16")
    implementation("org.apache.pdfbox:xmpbox:2.0.24")
    implementation("org.apache.pdfbox:preflight:2.0.24")
    implementation("org.apache.pdfbox:pdfbox-tools:2.0.24")
    implementation("org.bouncycastle:bcprov-jdk15on:1.69")
    implementation("org.bouncycastle:bcmail-jdk15on:1.69")
    implementation("org.bouncycastle:bcpkix-jdk15on:1.69")
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "11"
}

tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

tasks.register<Copy>("copyRelease") {
    group = "compose desktop"
    description = "Copy release builded executable into out folder."
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
    from(
        "build/compose/binaries/main/deb",
        "build/compose/binaries/main/dmg",
        "build/compose/binaries/main/exe",
        "build/compose/binaries/main/rpm"
    )
    into("out")
}

compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            packageName = "Free CoManagement"
            description = "Logiciel de fusion de documents PDF"
            targetFormats(TargetFormat.Dmg, TargetFormat.Exe, TargetFormat.Deb, TargetFormat.Rpm)
            windows {
                iconFile.set(project.file("src/main/resources/icons/logo.64x64.ico"))
                dirChooser = true
                menuGroup = "Genie23.fr"
            }
            macOS {
                iconFile.set(project.file("src/main/resources/icons/logo.64x64.icns"))
            }
            linux {
                iconFile.set(project.file("src/main/resources/icons/logo.64x64.png"))
                menuGroup = "Genie23.fr"
            }
        }
    }
}

And the error it generates for me when I run the gradle task runDistributable:

Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve ma.hu:compose-charts:0.3.1.
     Required by:
         project :
      > No matching variant of ma.hu:compose-charts:0.3.1 was found. The consumer was configured to find an API of a library compatible with Java 16, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'releaseApiPublication' capability ma.hu:compose-charts:0.3.1 declares an API of a library, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 16)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
          - Variant 'releaseRuntimePublication' capability ma.hu:compose-charts:0.3.1 declares a runtime of a library, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 16)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

The version number, I got it here. How do I do it?

@steelahhh
Copy link
Collaborator

Thank you for reporting this!

Only Jetpack Compose is supported at the moment because of some reliance on Android's Canvas

Unfortunately, support for JetBrains Compose is not planned for now

@Genie23
Copy link
Author

Genie23 commented Aug 13, 2021

Oh, it's not the same thing? I missed it

@olonho
Copy link

olonho commented Feb 8, 2022

Would you accept contribution making the library multiplatform?

@steelahhh
Copy link
Collaborator

Absolutely, all contrubitions are welcome!

@gsteckman
Copy link
Contributor

I'm also interested in multiplatform. I was able to convert PieChartRenderer to use only Compose Canvas without difficulty. I'll take a look at the other charts and if I don't run into any stumbling blocks submit a PR.

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

4 participants