Commit 9d621e5c authored by Igor Demin's avatar Igor Demin

Convert SkijaInjectSample to Gradle Kotlin DSL

parent 948b1b74
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'application'
}
repositories {
mavenLocal()
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-eap'
}
maven {
url 'https://maven.pkg.jetbrains.space/public/p/compose/dev'
}
}
def osName = System.getProperty("os.name")
def targetOs = ""
if (osName == "Mac OS X") {
targetOs = "macos"
} else if (osName.startsWith("Win")) {
targetOs = "windows"
} else if (osName.startsWith("Linux")) {
targetOs = "linux"
} else {
throw Error("Unsupported OS: $osName")
}
def osArch = System.getProperty("os.arch")
def targetArch = ""
if (osArch == "x86_64" || osArch == "amd64") {
targetArch = "x64"
} else if (osArch == "aarch64") {
targetArch = "arm64"
} else {
throw Error("Unsupported arch: $osArch")
}
def target = "${targetOs}-${targetArch}"
def version = "0.0.0-SNAPSHOT"
if (project.hasProperty('skiko.version')) {
version = project.properties['skiko.version']
}
dependencies {
implementation platform('org.jetbrains.kotlin:kotlin-bom')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.4.1'
implementation "org.jetbrains.skiko:skiko-jvm-runtime-$target:$version"
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
}
application {
mainClassName = 'SkijaInjectSample.AppKt'
}
run {
systemProperty("skiko.fps.enabled", "true")
systemProperties(System.properties)
}
test {
systemProperty("skiko.test.screenshots.dir", new File(project.projectDir, "src/test/screenshots").absolutePath)
// Tests should be deterministic, so disable scaling.
// On MacOs we need the actual scale, otherwise we will have aliased screenshots because of scaling.
if (System.getProperty("os.name") != "Mac OS X") {
systemProperty("sun.java2d.dpiaware", "false")
systemProperty("sun.java2d.uiScale", "1")
}
}
\ No newline at end of file
plugins {
kotlin("jvm") version "1.3.72"
application
}
repositories {
mavenLocal()
jcenter()
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
val osName = System.getProperty("os.name")
val targetOs = when {
osName == "Mac OS X" -> "macos"
osName.startsWith("Win") -> "windows"
osName.startsWith("Linux") -> "linux"
else -> error("Unsupported OS: $osName")
}
val osArch = System.getProperty("os.arch")
var targetArch = when (osArch) {
"x86_64", "amd64" -> "x64"
"aarch64" -> "arm64"
else -> error("Unsupported arch: $osArch")
}
val target = "${targetOs}-${targetArch}"
var version = "0.0.0-SNAPSHOT"
if (project.hasProperty("skiko.version")) {
version = project.properties["skiko.version"] as String
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.4.1")
implementation("org.jetbrains.skiko:skiko-jvm-runtime-$target:$version")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
application {
mainClass.set("SkijaInjectSample.AppKt")
}
tasks.named<JavaExec>("run") {
systemProperty("skiko.fps.enabled", "true")
System.getProperties().entries
.associate {
(it.key as String) to (it.value as String)
}
.filterKeys { it.startsWith("skiko.") }
.forEach { systemProperty(it.key, it.value) }
}
tasks.withType<Test> {
systemProperty("skiko.test.screenshots.dir", File(project.projectDir, "src/test/screenshots").absolutePath)
// Tests should be deterministic, so disable scaling.
// On MacOs we need the actual scale, otherwise we will have aliased screenshots because of scaling.
if (System.getProperty("os.name") != "Mac OS X") {
systemProperty("sun.java2d.dpiaware", "false")
systemProperty("sun.java2d.uiScale", "1")
}
}
\ No newline at end of file
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html
*/
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url "https://dl.bintray.com/kotlin/kotlin-eap"
}
}
}
rootProject.name = 'SkijaInjectSample'
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://dl.bintray.com/kotlin/kotlin-eap")
}
}
}
rootProject.name = "SkijaInjectSample"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment