JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.27k stars 1.18k forks source link

How to get packageName/packageVersion/vendor #4339

Closed LazyIonEs closed 8 months ago

LazyIonEs commented 8 months ago
val kitVersion by extra("1.0.0")

compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "appName"
            packageVersion = kitVersion
            description = "description"
            copyright = "© 2024 Name. All rights reserved."
            vendor = "Name"
            licenseFile.set(project.rootProject.file("LICENSE"))
            ...
        }
    }
}

I now want to create an about page within the application, which contains the application name, application version and other information, but I don’t know how to obtain these parameters in build.gradle.kts, How to write code

Mainly on mac/windows

dima-avdeev-jb commented 8 months ago

Hello! You can use some gradle plugins for code generation. For example pay attention to https://github.com/gmazzo/gradle-buildconfig-plugin. And you can configure some values with such information right in your gradle scripts. I Application you will read this values from the automatically generated class.

Junzz0 commented 4 months ago

This method is also useful: System.getProperty("jpackage.app-version")

https://stackoverflow.com/a/73121886

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.