Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to multiplatform #11

Merged
merged 48 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
bc64b1f
update gradle v6.0.1 -> v6.6.1
fullkomnun Dec 23, 2020
e01af85
update kotlin v1.3.61 -> v1.4.21
fullkomnun Dec 23, 2020
95e529f
prepare buildSrc and gradle.properties to go multiplatform
fullkomnun Dec 23, 2020
0d5f7ed
update gradle v6.6.1 -> v6.7.1
fullkomnun Dec 23, 2020
ad9b8a5
converted to multiplatform with jvm and nodeJS targets
fullkomnun Dec 23, 2020
52afdf2
configure 'com.github.ben-manes.versions' gradle plugin
fullkomnun Jan 11, 2021
3429317
enabled strict 'explicitApi' mode for all modules
fullkomnun Jan 16, 2021
c404e56
use Kotlin DSL extension of 'tasks.named(...)' to avoid IDE errors
fullkomnun Jan 16, 2021
fefd453
increase mocha tests timeout to 10s
fullkomnun Jan 31, 2021
ec98a74
add js browser target
fullkomnun Jan 31, 2021
79c0e66
set jvm test target to 1.8 (default is 1.6)
fullkomnun Feb 5, 2021
d6981bd
update kotlin v1.4.21 -> v.1.4.30
fullkomnun Feb 5, 2021
20989d8
remove js browser target and avoid setting jvmTarget for now
fullkomnun Feb 6, 2021
41e97a9
remove *.gradle files from older multiplatform implementation
fullkomnun Feb 6, 2021
d1ceef2
update gradle v6.7.1 -> v6.8.1
fullkomnun Feb 6, 2021
5fed6cd
set jvm target to 1.8 (default is 1.6)
fullkomnun Feb 6, 2021
bbb7340
added GitHub actions based ci
fullkomnun Feb 6, 2021
ef90cc4
config dependencyResolutionManagement in settings.gradle.kts
fullkomnun Feb 7, 2021
16847ac
define logging for all test tasks
fullkomnun Feb 7, 2021
4333330
create root aggregate test report for all sub-modules
fullkomnun Feb 7, 2021
bd7d60b
amend github action workflows
fullkomnun Feb 7, 2021
5fd6e8f
fix jacoco config
fullkomnun Feb 7, 2021
3050643
remove unnecessary repo
fullkomnun Feb 7, 2021
3b001d6
set GitHub credentials for deployment in workflow
fullkomnun Feb 7, 2021
5a07be3
added 'maven-publish' plugin and config for GitHub Packages
fullkomnun Feb 7, 2021
4cb9282
if build fails - bundle and upload build reports
fullkomnun Feb 7, 2021
e715e08
add a failing test to check ci build failure report
fullkomnun Feb 7, 2021
6bd7cfe
remove failing test - now ci should pass
fullkomnun Feb 7, 2021
8a53dcc
added upload failed build reports to ci
fullkomnun Feb 7, 2021
184b0ed
ci workflow - publish 'master-SNAPSHOT' versions to GitHub Packages
fullkomnun Feb 7, 2021
df7b60a
Merge pull request #1 from fullkomnun/convert_to_multiplatform
Feb 7, 2021
810984d
fix GitHub Packages maven repo name that affects expected property na…
fullkomnun Feb 7, 2021
ec6c9a3
Merge pull request #2 from fullkomnun/convert_to_multiplatform
Feb 7, 2021
88ee2b2
update README.md for multiplatform support
fullkomnun Feb 8, 2021
9c112e9
make suer maven 'groupId' of published modules is in lowercase
fullkomnun Feb 8, 2021
27671e1
Merge pull request #3 from fullkomnun/convert_to_multiplatform
Feb 8, 2021
24be71c
add CI badge to README.md
fullkomnun Feb 8, 2021
2d9e198
add a github release workflow
fullkomnun Feb 8, 2021
c0b9b72
Merge pull request #4 from fullkomnun/convert_to_multiplatform
Feb 8, 2021
1cf913c
Update release.yml
Feb 8, 2021
974526d
Update mpp-module.gradle.kts
Feb 8, 2021
bcdaa03
pass 'version' property to gradle when publishing
fullkomnun Feb 8, 2021
fc7b32f
Merge branch 'master' into convert_to_multiplatform
Feb 8, 2021
fdc76c3
pass 'version' system property to gradle when publishing
fullkomnun Feb 8, 2021
96c9eff
Merge remote-tracking branch 'origin/convert_to_multiplatform' into c…
fullkomnun Feb 8, 2021
791fa95
fix names of workflows
fullkomnun Feb 8, 2021
645c02d
update gradle v6.8.1 -> v6.8.2
fullkomnun Feb 19, 2021
aa091af
update README.md
fullkomnun Feb 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
apply {
from("https://raw.githubusercontent.com/ligi/gradle-common/master/versions_plugin_stable_only.gradle")
}

buildscript {
repositories {
jcenter()
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("com.github.ben-manes:gradle-versions-plugin:${Versions.versionsPlugin}")
}

}

allprojects {

repositories {
Expand All @@ -23,39 +7,11 @@ allprojects {

}


subprojects {
repositories {
jcenter()
maven("https://jitpack.io")
maven("https://kotlin.bintray.com/kotlinx")
}

apply(plugin = "jacoco")
apply(plugin = "maven")
apply(plugin = "kotlin")

tasks.withType<Test> {
useJUnitPlatform()
}

configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
}

afterEvaluate {

dependencies {
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")

"testImplementation"("org.assertj:assertj-core:3.14.0")
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.jupiter}")
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.jupiter}")

"testImplementation"("org.jetbrains.kotlin:kotlin-test")
}

}
}

7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
plugins {
idea
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

repositories {
gradlePluginPortal()
jcenter()
}

idea {
module {
isDownloadJavadoc = false
isDownloadSources = false
}
}

dependencies {
implementation(kotlin("gradle-plugin", "${property("kgp")}"))
implementation("com.github.ben-manes", "gradle-versions-plugin", "${property("plugin.com.github.ben-manes.versions")}")
}
1 change: 1 addition & 0 deletions buildSrc/gradle.properties
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
object Versions {
const val kotlin = "1.3.61"
const val versionsPlugin = "0.27.0"
const val jupiter = "5.5.2"
const val jacocoPlugin = "0.8.5"
const val assertk = "0.23"
}
96 changes: 96 additions & 0 deletions buildSrc/src/main/kotlin/mpp-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
kotlin("multiplatform")
id("java-library") // required for jacoco plugin
jacoco
id("com.github.ben-manes.versions")
}

kotlin {
targets {
jvm()
js(BOTH) {
nodejs {
testTask {
useMocha {
timeout = "5s"
}
}
}
}
}
sourceSets {
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}

val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}

val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
all {
languageSettings.enableLanguageFeature("InlineClasses")
}
}
}

jacoco {
toolVersion = Versions.jacocoPlugin
}

tasks.withType<JacocoReport> {
dependsOn("jvmTest")
group = "Reporting"
description = "Generate Jacoco coverage reports."
val coverageSourceDirs = arrayOf(
"commonMain/src",
"jvmMain/src"
)
val classFiles = File("${buildDir}/classes/kotlin/jvm/")
.walkBottomUp()
.toSet()
classDirectories.setFrom(classFiles)
sourceDirectories.setFrom(files(coverageSourceDirs))
additionalSourceDirs.setFrom(files(coverageSourceDirs))

executionData
.setFrom(files("${buildDir}/jacoco/jvmTest.exec"))
reports {
xml.isEnabled = true
csv.isEnabled = false
html.isEnabled = true
html.destination =
File("${buildDir}/jacoco-reports/html")
}
}

/**
* The Gradle Versions Plugin is another Gradle plugin to discover dependency updates
* plugins.id("com.github.ben-manes.versions")
* Run it with $ ./gradlew --scan dependencyUpdates
* https://github.com/ben-manes/gradle-versions-plugin
* **/
tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}

rejectVersionIf {
isNonStable(candidate.version)
}
checkConstraints = true
}
3 changes: 3 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("mpp-module")
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package org.komputing.khex

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import kotlin.test.*

class TheHexFun {

Expand Down
19 changes: 17 additions & 2 deletions extensions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
dependencies {
implementation(project(":core"))
plugins {
id("mpp-module")
}

kotlin {
sourceSets {
commonMain {
dependencies {
implementation(project(":core"))
}
}
commonTest {
dependencies {
implementation("com.willowtreeapps.assertk:assertk:${Versions.assertk}")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package org.komputing.khex.extensions

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEmpty
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import org.komputing.khex.model.HexString
import kotlin.test.Test
import kotlin.test.assertEquals

/**
Expand Down
35 changes: 30 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
# sytleguide
# gradle.properties

## Gradle Build Settings | jvmargs have been optimized for github Actions

org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx6g -XX:+UseG1GC
org.gradle.parallel=true
org.gradle.vfs.watch=true

## Kotlin Build Settings

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.4.21

## Kotlinx Version Definitions

# gradle
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
kotlinx.coroutines=1.4.1

org.gradle.parallel=true
plugin.com.github.ben-manes.versions=0.36.0
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-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists