Browse Source

Updated build script to download jcef binaries.

pull/4/head
spvessel 4 years ago
parent
commit
5ba779817c
  1. 10
      cef/README.md
  2. 37
      cef/build.gradle.kts

10
cef/README.md

@ -1,15 +1,5 @@
CEF integration for Desktop Jetpack Compose.
Setup:
1. Clone the java-cef repository (``git clone https://bitbucket.org/chromiumembedded/java-cef.git``) into ``/third_party`` directory.
2. Apply patch ``/third_party/java-cef-jb-compose-patch/jb_compose_support.patch`` to ``/third_party/java-cef``
3. Download [skiko-jvm-0.1.6.jar](https://github.com/JetBrains/skiko/releases) library and copy it to ``/third_party/java-cef/third_party/jogamp/jar`` directory.
4. Follow instructions to compile java-cef ([BranchesAndBuilding](https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding.md)) **until you reach step 3 of the instruction**.
5. Make **jcef.jar** - execute command in terminal (from ``/third_party/java-cef/tools`` directory):
Windows: ``make_jar.bat win64``
Linux: ``make_jar.sh linux64``
6. Copy **jcef.jar** file from ``/third_party/java-cef/out/win64`` (or ``/third_party/java-cef/out/linux64`` for Linux) to ``/libs`` directory.
Run example:
To run application execute in terminal: ``./gradlew run``

37
cef/build.gradle.kts

@ -1,12 +1,44 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import de.undercouch.gradle.tasks.download.Download
import kotlin.text.capitalize
plugins {
kotlin("jvm") version "1.4.0"
id("org.jetbrains.compose") version "0.1.0-unmerged30"
id("de.undercouch.download") version "4.1.1"
application
}
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 }
}
repositories {
google()
jcenter()
@ -14,16 +46,15 @@ repositories {
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("org.jetbrains.jcef:jcef-skiko:0.1")
implementation(compose.desktop.all)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
dependsOn(cefUnZip)
}
val libraryPath = "third_party/java-cef/jcef_build/native/Release"
application {
applicationDefaultJvmArgs = listOf("-Djava.library.path=$libraryPath")
mainClassName = "org.jetbrains.compose.desktop.AppKt"

Loading…
Cancel
Save