You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
66 lines
1.8 KiB
4 years ago
|
import org.jetbrains.compose.compose
|
||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||
4 years ago
|
import de.undercouch.gradle.tasks.download.Download
|
||
|
import kotlin.text.capitalize
|
||
4 years ago
|
|
||
|
plugins {
|
||
4 years ago
|
// __KOTLIN_COMPOSE_VERSION__
|
||
3 years ago
|
kotlin("jvm") version "1.5.21"
|
||
4 years ago
|
// __LATEST_COMPOSE_RELEASE_VERSION__
|
||
3 years ago
|
id("org.jetbrains.compose") version "1.0.0-alpha1"
|
||
4 years ago
|
id("de.undercouch.download") version "4.1.1"
|
||
4 years ago
|
application
|
||
|
}
|
||
|
|
||
4 years ago
|
val libraryPath = "third_party/java-cef"
|
||
|
val hostOs = System.getProperty("os.name")
|
||
|
val target = when {
|
||
|
hostOs == "Mac OS X" -> "macos"
|
||
|
hostOs == "Linux" -> "linux"
|
||
|
hostOs.startsWith("Win") -> "windows"
|
||
|
else -> throw Error("Unknown os $hostOs")
|
||
|
}
|
||
|
|
||
|
val cefDownloadZip = run {
|
||
|
val zipName = "jcef-runtime-$target.zip"
|
||
|
val zipFile = File("third_party/$zipName")
|
||
|
|
||
|
tasks.register("downloadCef", Download::class) {
|
||
|
onlyIf { !zipFile.exists() }
|
||
|
src("https://bintray.com/jetbrains/skija/download_file?file_path=$zipName")
|
||
|
dest(zipFile)
|
||
|
onlyIfModified(true)
|
||
|
}.map { zipFile }
|
||
|
}
|
||
|
|
||
|
val cefUnZip = run {
|
||
|
val targetDir = File("third_party/java-cef").apply { mkdirs() }
|
||
|
tasks.register("unzipCef", Copy::class) {
|
||
|
from(cefDownloadZip.map { zipTree(it) })
|
||
|
into(targetDir)
|
||
|
}.map { targetDir }
|
||
|
}
|
||
|
|
||
4 years ago
|
repositories {
|
||
|
google()
|
||
4 years ago
|
mavenCentral()
|
||
4 years ago
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||
|
// temp
|
||
4 years ago
|
maven("https://packages.jetbrains.team/maven/p/ui/dev")
|
||
|
}
|
||
|
|
||
|
dependencies {
|
||
4 years ago
|
implementation("org.jetbrains.jcef:jcef-skiko:0.1")
|
||
4 years ago
|
implementation(compose.desktop.currentOs)
|
||
4 years ago
|
}
|
||
|
|
||
|
tasks.withType<KotlinCompile>().configureEach {
|
||
|
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
|
||
4 years ago
|
dependsOn(cefUnZip)
|
||
4 years ago
|
}
|
||
|
|
||
|
application {
|
||
|
applicationDefaultJvmArgs = listOf("-Djava.library.path=$libraryPath")
|
||
|
mainClassName = "org.jetbrains.compose.desktop.AppKt"
|
||
|
}
|