This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use version catalog + build.gradle.kts -> build.gradle to improve bui…
…ld startup (#590)
- Loading branch information
Showing
52 changed files
with
714 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
buildSrc/src/main/kotlin/com/soywiz/korlibs/NativeTools.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.soywiz.korlibs | ||
|
||
import com.soywiz.korlibs.modules.* | ||
import org.gradle.api.* | ||
|
||
object NativeTools { | ||
@JvmStatic | ||
fun configureCInteropWin32(project: Project, name: String) { | ||
if (project.doEnableKotlinNative) { | ||
project.kotlin { | ||
for (target in nativeTargets(project)) { | ||
if (target.isWin) { | ||
target.compilations["main"].cinterops { | ||
maybeCreate(name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@JvmStatic | ||
fun configureCInteropLinux(project: Project, name: String) { | ||
if (project.doEnableKotlinNative) { | ||
project.kotlin { | ||
for (target in nativeTargets(project)) { | ||
if (target.isLinux) { | ||
target.compilations["main"].cinterops { | ||
maybeCreate(name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun configureAllCInterop(project: Project, name: String) { | ||
if (project.doEnableKotlinNative) { | ||
project.kotlin { | ||
for (target in allNativeTargets(project)) { | ||
target.compilations["main"].cinterops { | ||
maybeCreate(name) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun configureAndroidDependency(project: Project, dep: Any) { | ||
project.dependencies { | ||
project.afterEvaluate { | ||
if (project.configurations.findByName("androidMainApi") != null) { | ||
add("androidMainApi", dep) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun configureExtraSourceSets(project: Project) { | ||
project.afterEvaluate { | ||
kotlin { | ||
for (targetName in listOf("linuxX64", "linuxArm32Hfp", "macosX64", "macosArm64")) { | ||
//println("targetName=$targetName") | ||
val target = targets.findByName(targetName) ?: continue | ||
//println("target=$target") | ||
val folder = project.file("src/${targetName}Main/kotlin") | ||
//println(" - $folder") | ||
target.compilations["main"].defaultSourceSet.kotlin.srcDir(folder) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun groovyConfigurePublishing(project: Project, multiplatform: Boolean) { | ||
project.configurePublishing(multiplatform = multiplatform) | ||
} | ||
|
||
@JvmStatic | ||
fun groovyConfigureSigning(project: Project) { | ||
project.configureSigning() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[versions] | ||
jna = "5.11.0" | ||
jcodec = "0.2.5" | ||
proguard-gradle = "6.2.2" # 7.2.0-beta2 | ||
kotlinx-coroutines = "1.6.1" | ||
|
||
[libraries] | ||
jna-core = { module = "net.java.dev.jna:jna", version.ref = "jna" } | ||
jna-platform = { module = "net.java.dev.jna:jna-platform", version.ref = "jna" } | ||
jcodec-core = { module = "org.jcodec:jcodec", version.ref = "jcodec" } | ||
proguard-gradle = { module = "net.sf.proguard:proguard-gradle", version.ref = "proguard-gradle" } | ||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } | ||
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } | ||
|
||
[bundles] | ||
jna = ["jna-core", "jna-platform"] | ||
|
||
#[plugins] | ||
#jmh = { id = "me.champeau.jmh", version = "0.6.5" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
description = "Memory utilities for Kotlin" | ||
|
||
dependencies { | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
description = "Portable Audio library for Kotlin" | ||
|
||
com.soywiz.korlibs.NativeTools.configureAllCInterop(project, "minimp3") | ||
com.soywiz.korlibs.NativeTools.configureAllCInterop(project, "stb_vorbis") | ||
|
||
dependencies { | ||
add("commonMainApi", project(":korio")) | ||
add("jvmMainApi", libs.bundles.jna) | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.