Skip to content

Commit

Permalink
Add native targets (#23)
Browse files Browse the repository at this point in the history
* update .gitignore with gradle template

* update to kotlin 1.6.21, bignum 0.3.4 and gradle 7.4.2

* use new memory model

* add native targets

requires pr: komputing/KHex#14

* kotlin 1.8.21 update dependencies

* remove depreciated native targets, add linuxArm64

* fix depreciated warnings

* gradle 8.1.1
  • Loading branch information
luca992 authored May 18, 2023
1 parent 67d0038 commit 26f9a6f
Show file tree
Hide file tree
Showing 9 changed files with 1,246 additions and 211 deletions.
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
build
out
.idea
local.properties
local.properties

### Gradle template
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle/wrapper/gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Versions {
const val khex = "1.1.2"
const val bignum = "0.3.1"
const val khex = "1.1.5"
const val bignum = "0.3.8"
}
21 changes: 17 additions & 4 deletions buildSrc/src/main/kotlin/mpp-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ plugins {
id("maven-publish")
}

val darwinTargets = arrayOf(
"macosX64", "macosArm64",
"iosArm64", "iosX64", "iosSimulatorArm64",
"tvosArm64", "tvosX64", "tvosSimulatorArm64",
"watchosArm32", "watchosArm64", "watchosX64", "watchosSimulatorArm64",
)
val linuxTargets = arrayOf("linuxX64", "linuxArm64")
val mingwTargets = arrayOf("mingwX64")
val nativeTargets = linuxTargets + darwinTargets + mingwTargets

kotlin {
explicitApi()
targets {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
}
js(BOTH) {
js(IR) {
compilations {
this.forEach { compilation ->
compilation.compileKotlinTask.kotlinOptions.apply {
Expand All @@ -37,6 +47,9 @@ kotlin {
}
}
}
for (target in nativeTargets) {
targets.add(presets.getByName(target).createTarget(target))
}
}
sourceSets {
commonTest {
Expand Down Expand Up @@ -83,7 +96,7 @@ tasks {
* **/
tasks.named("dependencyUpdates", DependencyUpdatesTask::class).configure {
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
Expand All @@ -96,7 +109,7 @@ tasks.named("dependencyUpdates", DependencyUpdatesTask::class).configure {
}

System.getenv("GITHUB_REPOSITORY")?.let { githubRepo ->
val (owner, repoName) = githubRepo.split('/').map(String::toLowerCase)
val (owner, repoName) = githubRepo.split('/').map(String::lowercase)
group = "com.github.$owner.$repoName"
version = System.getProperty("version")
publishing {
Expand Down
12 changes: 2 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ org.gradle.vfs.watch=true

kotlin.code.style=official
kotlin.incremental=true
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.stability.nowarn=true
kotlin.native.enableDependencyPropagation=false

## Kapt Build Settings

kapt.include.compile.classpath=false
kapt.incremental.apt=true
kapt.use.worker.api=true

## Kotlin Gradle Plugin

kgp=1.5.10
kgp=1.8.21

## Gradle Plugins

plugin.com.github.ben-manes.versions=0.38.0
plugin.com.github.ben-manes.versions=0.46.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 26f9a6f

Please sign in to comment.