Skip to content

Commit

Permalink
MocKMP 2.0: support for Kotlin 2!
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Nov 30, 2024
1 parent f80704b commit c500c79
Show file tree
Hide file tree
Showing 79 changed files with 3,645 additions and 1,240 deletions.
23 changes: 0 additions & 23 deletions .github/actions/check/action.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ jobs:
runs-on: macOS-latest
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.PGP_SIGNING_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
steps:
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
uses: ./.github/actions/check
run: ./gradlew --stacktrace --scan :tests-projects:check
shell: bash
- name: Upload
run: ./gradlew --stacktrace --scan publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository-id }}
run: ./gradlew --stacktrace --scan :mockmp:publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository-id }}
shell: bash

drop-or-release-staging-repository:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build and publish a snapshot
on:
push:
branches:
- master
- main
- 'snapshot/*'
- 'kotlin-*'
paths-ignore:
Expand All @@ -17,13 +17,14 @@ jobs:
build-upload:
runs-on: macOS-latest
env:
SONATYPE_USERNAME: ${{ secrets.sonatype_username }}
SONATYPE_PASSWORD: ${{ secrets.sonatype_password }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
steps:
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
uses: ./.github/actions/check
run: ./gradlew --stacktrace --scan :tests-projects:check
shell: bash
- name: Upload
run: ./gradlew --stacktrace --scan publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true
run: ./gradlew --stacktrace --scan :mockmp:publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true
shell: bash
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
uses: ./.github/actions/check
run: ./gradlew --stacktrace --scan :tests-projects:check
shell: bash
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
build/
out/
.gradletasknamecache
*local.properties
tests-projects/local.properties

# JS
node_modules/
package-lock.json

# Kotlin
.kotlin/
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
:icons: font
:version: 1.17.0

WARNING: MocKMP is currently NOT compatible with Kotlin 2.x.
We are currently working on the new MocKMP version 2.0 that will be.

A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.

Built in collaboration with https://www.deezer.com/[Deezer].
Expand Down
7 changes: 0 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Gradle
org.gradle.jvmargs = -Xmx4g -XX:MaxMetaspaceSize=2g
org.gradle.parallel = true

# KSP
ksp.incremental.intermodule = true

# Kosi
org.kodein.no-default-junit = true
org.kodein.native.enableCrossCompilation=true
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-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

This file was deleted.

This file was deleted.

4 changes: 3 additions & 1 deletion build.gradle.kts → mockmp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ plugins {

allprojects {
group = "org.kodein.mock"
version = "1.17.0"
version = "2.0.0"
}

intermediateProjectTasks()
12 changes: 12 additions & 0 deletions mockmp/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
kotlin("jvm") version "2.0.21"
`kotlin-dsl`
}

repositories {
mavenCentral()
}

dependencies {
implementation(gradleApi())
}
32 changes: 32 additions & 0 deletions mockmp/buildSrc/src/main/kotlin/intermediateProjectTasks.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import org.gradle.api.Project

/*
In a composite build, tasks run from the root will not automatically propagate to subprojects (see
https://github.com/gradle/gradle/issues/20863).
This plugin is for root build scripts that do not themselves have a "publish" task. It adds a
"publish" task that depends on the "publish" tasks of all subprojects, to emulate typical Gradle
behavior.
*/
fun Project.intermediateProjectTasks() {
apply { plugin("org.gradle.lifecycle-base") }
afterEvaluate {
listOf(
"publishToMavenLocal" to "publishing",
"publishAllPublicationsToOssrhStagingRepository" to "release",
"publishPlugins" to "plugin portal",
).forEach { (taskName, taskGroup) ->
if (taskName !in project.tasks.names) {
project.tasks.register(taskName) {
group = taskGroup
dependsOn(subprojects.map { ":${it.path}:$taskName" })
}
}
}

listOf("build", "clean", "assemble").forEach { taskName ->
tasks.named(taskName) {
dependsOn(subprojects.map { ":${it.path}:$taskName" })
}
}
}
}
11 changes: 11 additions & 0 deletions mockmp/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Gradle
org.gradle.jvmargs = -Xmx4g -XX:MaxMetaspaceSize=2g
org.gradle.parallel = true

# KSP
ksp.incremental.intermodule = true
#ksp.useKSP2 = true

# Kosi
org.kodein.no-default-junit = true
org.kodein.native.enableCrossCompilation=true
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml → mockmp/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
buildConfig = "3.1.0"
coroutines = "1.7.3"
datetime = "0.4.0"
javassist = "3.29.2-GA"
kotlinPoet = "1.15.1"
ksp = "1.9.22-1.0.17"
objenesis = "3.2"
buildConfig = "5.3.5"
coroutines = "1.9.0-RC"
datetime = "0.6.0"
javassist = "3.30.2-GA"
kotlinPoet = "1.17.0"
ksp = "2.0.21-1.0.28"
objenesis = "3.4"

[plugins]
buildConfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildConfig" }
Expand Down
Loading

0 comments on commit c500c79

Please sign in to comment.