Skip to content

Commit f478623

Browse files
authored
Merge pull request #117 from lupuuss/release-3.0.0
Release 3.0.0
2 parents 396790d + 861144a commit f478623

301 files changed

Lines changed: 10801 additions & 9048 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ build/
33
!gradle/wrapper/gradle-wrapper.jar
44
!**/src/main/**/build/
55
!**/src/test/**/build/
6-
./test-mokkery/local.properties
6+
/test-mokkery-gradle/local.properties
77

88
### IntelliJ IDEA ###
99
.idea/modules.xml
@@ -43,5 +43,5 @@ bin/
4343
### Mac OS ###
4444
.DS_Store
4545
/.idea/
46-
/test-mokkery/.idea/
46+
/test-mokkery-gradle/.idea/
4747
/local.properties

build-mokkery/src/main/kotlin/Utils.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22
import org.gradle.api.Project
33
import org.gradle.kotlin.dsl.extra
4+
import org.gradle.kotlin.dsl.withType
5+
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
6+
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
7+
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
8+
import org.jetbrains.kotlin.gradle.tasks.CompilerPluginOptions
9+
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
410
import java.util.Properties
511

612
fun Project.loadLocalProperties() {
@@ -15,3 +21,24 @@ fun Project.loadLocalProperties() {
1521
}
1622
}
1723
}
24+
25+
fun Project.configureCompilerPlugin(id: String, vararg options: SubpluginOption) {
26+
val compilerOptions = CompilerPluginOptions().apply {
27+
options.forEach {
28+
addPluginArgument(id, it)
29+
}
30+
}
31+
tasks.withType<AbstractKotlinCompile<*>> {
32+
pluginOptions.add(compilerOptions)
33+
}
34+
tasks.withType<KotlinNativeCompile> {
35+
compilerPluginOptions.addPluginArgument(compilerOptions)
36+
}
37+
}
38+
39+
fun KotlinMultiplatformExtension.optInMokkeryDelicateAndInternals() {
40+
sourceSets.all {
41+
languageSettings.optIn("dev.mokkery.annotations.DelicateMokkeryApi")
42+
languageSettings.optIn("dev.mokkery.annotations.InternalMokkeryApi")
43+
}
44+
}

build-mokkery/src/main/kotlin/mokkery-multiplatform.gradle.kts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
44
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
5+
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
56

67

78
plugins {
89
kotlin("multiplatform")
910
}
1011

1112
kotlin {
12-
explicitApi()
1313

1414
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1515
applyDefaultHierarchyTemplate {
@@ -68,12 +68,6 @@ kotlin {
6868
@OptIn(ExperimentalKotlinGradlePluginApi::class)
6969
compilerOptions {
7070
freeCompilerArgs.add("-Xexpect-actual-classes")
71-
}
72-
73-
sourceSets {
74-
all {
75-
languageSettings.optIn("dev.mokkery.annotations.DelicateMokkeryApi")
76-
languageSettings.optIn("dev.mokkery.annotations.InternalMokkeryApi")
77-
}
71+
freeCompilerArgs.add("-Xcontext-parameters")
7872
}
7973
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ kotlin.code.style=official
33
kotlin.suppressGradlePluginWarnings=IncorrectCompileOnlyDependencyWarning
44
kotlin.native.ignoreDisabledTargets=true
55
org.gradle.jvmargs=-Xmx3g
6-
version=2.10.2
6+
version=3.0.0
77
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
88
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

gradle/libs.versions.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ bytebuddy = "1.17.8"
1212
gradle-portal-publish = "2.0.0"
1313
agp = "8.12.3"
1414
dexmaker = "2.28.6"
15+
kctesting = "0.11.0"
1516

1617
[plugins]
1718
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
1819
poko = { id = "dev.drewhamilton.poko", version.ref = "poko" }
1920
kotlinx-atomicfu = { id = "org.jetbrains.kotlinx.atomicfu", version.ref = "atomicfu" }
21+
kotlin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
2022
gradle-portal-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-portal-publish" }
21-
agp-library = { id = "com.android.library"}
23+
agp-library = { id = "com.android.library" }
2224

2325
[libraries]
26+
kctesting = { module = "dev.zacsweers.kctfork:core", version.ref = "kctesting" }
2427
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
2528
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
2629
kotlin-dom-api-compat = { module = "org.jetbrains.kotlin:kotlin-dom-api-compat", version.ref = "kotlin" }

mokkery-core/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ plugins {
44
id("com.github.gmazzo.buildconfig")
55
}
66

7+
kotlin {
8+
explicitApi()
9+
optInMokkeryDelicateAndInternals()
10+
}
11+
712
dependencies {
813
commonMainCompileOnly(libs.kotlin.stdlib)
914

mokkery-core/src/commonMain/kotlin/dev/mokkery/annotations/Annotations.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ public annotation class DelicateMokkeryApi
1616
level = RequiresOptIn.Level.ERROR, message = "This is an internal Mokkery API and it should not be used!"
1717
)
1818
public annotation class InternalMokkeryApi
19+
20+
/**
21+
* Marks parameter that accepts matchers.
22+
*/
23+
@Target(AnnotationTarget.VALUE_PARAMETER)
24+
@Retention(AnnotationRetention.BINARY)
25+
public annotation class Matcher

mokkery-coroutines/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ plugins {
44
alias(libs.plugins.poko)
55
}
66

7+
kotlin {
8+
explicitApi()
9+
optInMokkeryDelicateAndInternals()
10+
}
11+
712
dependencies {
813
commonMainApi(project(":mokkery-runtime"))
914
commonMainApi(libs.kotlinx.coroutines.core)

mokkery-coroutines/src/commonMain/kotlin/dev/mokkery/coroutines/answering/Awaitable.kt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import dev.mokkery.coroutines.internal.answering.AwaitReceiveChannel
1010
import dev.mokkery.coroutines.internal.answering.AwaitSendChannel
1111
import dev.mokkery.MokkerySuspendCallScope
1212
import dev.mokkery.call
13-
import dev.mokkery.toFunctionScope
1413
import kotlinx.coroutines.Deferred
1514
import kotlinx.coroutines.channels.ReceiveChannel
1615
import kotlinx.coroutines.channels.SendChannel
@@ -26,17 +25,7 @@ public interface Awaitable<out T> {
2625
/**
2726
* Suspends current function call until the awaited result is available.
2827
*/
29-
public suspend fun await(scope: MokkerySuspendCallScope): T {
30-
@Suppress("DEPRECATION_ERROR")
31-
return await(scope.toFunctionScope())
32-
}
33-
34-
/**
35-
* **DEPRECATED: Use [await] with [MokkerySuspendCallScope] instead!**
36-
*/
37-
@Deprecated(AnswerDeprecationMessage, level = DeprecationLevel.ERROR)
38-
@Suppress("DEPRECATION_ERROR")
39-
public suspend fun await(scope: dev.mokkery.answering.FunctionScope): T = throw NotImplementedError()
28+
public suspend fun await(scope: MokkerySuspendCallScope): T
4029

4130
/**
4231
* Provides a description of the awaitable action.
@@ -108,5 +97,3 @@ public interface Awaitable<out T> {
10897
}
10998
}
11099
}
111-
112-
internal const val AnswerDeprecationMessage = "Migrate to new `await` overload. Read `Answer` documentation for migration guide."

mokkery-gradle/build.gradle.kts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@file:Suppress("UnstableApiUsage")
22

3+
import org.jetbrains.kotlin.konan.target.HostManager
4+
import org.jetbrains.kotlin.konan.target.KonanTarget
5+
6+
37
plugins {
48
kotlin("jvm")
59
id("mokkery-publish")
@@ -18,6 +22,14 @@ kotlin {
1822
}
1923
}
2024

25+
fun Test.dependsOnPublishToMavenLocalOf(project: String) {
26+
dependsOn(project(project).tasks.named("publishToMavenLocal"))
27+
}
28+
29+
fun Test.dependsOnPublishPublicationToMavenLocalOf(project: String, name: String) {
30+
dependsOn(project(project).tasks.named("publish${name}PublicationToMavenLocal"))
31+
}
32+
2133
val functionalTest by testing.suites.creating(JvmTestSuite::class) {
2234
val compilations = kotlin.target.compilations
2335
compilations.getByName("functionalTest").associateWith(compilations.getByName("main"))
@@ -27,14 +39,33 @@ val functionalTest by testing.suites.creating(JvmTestSuite::class) {
2739
testLogging.showStandardStreams = true
2840
mustRunAfter("test")
2941
listOf(
30-
":mokkery-runtime",
31-
":mokkery-plugin",
3242
":mokkery-core",
33-
":mokkery-gradle",
43+
":mokkery-runtime",
3444
":mokkery-coroutines"
3545
).forEach {
36-
dependsOn(project(it).tasks.named("publishToMavenLocal"))
46+
if (it == ":mokkery-runtime") {
47+
dependsOnPublishPublicationToMavenLocalOf(it, "AndroidRelease")
48+
}
49+
dependsOnPublishPublicationToMavenLocalOf(it, "KotlinMultiplatform")
50+
dependsOnPublishPublicationToMavenLocalOf(it, "Jvm")
51+
dependsOnPublishPublicationToMavenLocalOf(it, "WasmJs")
52+
dependsOnPublishPublicationToMavenLocalOf(it, "Js")
53+
when (HostManager.host) {
54+
is KonanTarget.LINUX_X64 -> dependsOnPublishPublicationToMavenLocalOf(it, "LinuxX64")
55+
is KonanTarget.LINUX_ARM64 -> dependsOnPublishPublicationToMavenLocalOf(it, "LinuxArm64")
56+
is KonanTarget.MACOS_X64 -> {
57+
dependsOnPublishPublicationToMavenLocalOf(it, "MacosX64")
58+
}
59+
is KonanTarget.MACOS_ARM64 -> {
60+
dependsOnPublishPublicationToMavenLocalOf(it, "MacosArm64")
61+
dependsOnPublishPublicationToMavenLocalOf(it, "IosSimulatorArm64")
62+
}
63+
is KonanTarget.MINGW_X64 -> dependsOnPublishPublicationToMavenLocalOf(it, "MingwX64")
64+
else -> error("Unsupported target ${HostManager.host}")
65+
}
3766
}
67+
dependsOnPublishToMavenLocalOf(":mokkery-plugin")
68+
dependsOnPublishToMavenLocalOf(":mokkery-gradle")
3869
}
3970
}
4071
dependencies {

0 commit comments

Comments
 (0)