Skip to content

Commit

Permalink
WIP Split library primitives into parameterize-api
Browse files Browse the repository at this point in the history
TODO Tests?

Deprecated in original library
  • Loading branch information
BenWoodworth committed Sep 27, 2024
1 parent 2bbbab2 commit 067b9d7
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 86 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ the need for an extra level of nesting nesting inside the group of tests.

| Artifact | Description |
|---------------------|---------------------------------------------------------------------------------------------------|
| `parameterize-api` | Library primitives, including the `ParameterizeScope` interface and `Parameter` functions. |
| `parameterize-core` | The core functionality, with `parameterize {}` as the entry point for running parameterized code. |


Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/dokka-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ tasks.withType<DokkaTask>().configureEach {
reportUndocumented = true
failOnWarning = true

// TODO Suppress friend api annotations?

val releaseVersionRef = version.toString()
.takeIf { version -> version.matches(Regex("""\d+\.\d+\.\d+""")) }
?.let { version -> "v$version" }
Expand Down
53 changes: 53 additions & 0 deletions parameterize-api/api/parameterize-api.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
public abstract interface annotation class com/benwoodworth/parameterize/ExperimentalParameterizeApi : java/lang/annotation/Annotation {
}

public final class com/benwoodworth/parameterize/LazyParameterScope {
public static final synthetic fun box-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Lcom/benwoodworth/parameterize/LazyParameterScope;
public static fun constructor-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Lcom/benwoodworth/parameterize/ParameterizeScope;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lcom/benwoodworth/parameterize/ParameterizeScope;Lcom/benwoodworth/parameterize/ParameterizeScope;)Z
public fun hashCode ()I
public static fun hashCode-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)I
public static final fun provideDelegate-13mUnGw (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Lcom/benwoodworth/parameterize/ParameterizeScope;
}

public abstract interface class com/benwoodworth/parameterize/ParameterizeScope {
public abstract fun getValue (Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public abstract fun provideDelegate-13mUnGw (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter {
public fun <init> (Ljava/lang/Object;)V
public final fun getArgument ()Ljava/lang/Object;
public fun toString ()Ljava/lang/String;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$Parameter {
public static final synthetic fun box-impl (Lkotlin/sequences/Sequence;)Lcom/benwoodworth/parameterize/ParameterizeScope$Parameter;
public static fun constructor-impl (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lkotlin/sequences/Sequence;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;)Z
public final fun getArguments ()Lkotlin/sequences/Sequence;
public fun hashCode ()I
public static fun hashCode-impl (Lkotlin/sequences/Sequence;)I
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Lkotlin/sequences/Sequence;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Lkotlin/sequences/Sequence;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$ParameterDelegate {
}

public final class com/benwoodworth/parameterize/ParameterizeScopeKt {
public static final fun parameter (Lcom/benwoodworth/parameterize/ParameterizeScope;Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
public static final fun parameter (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
public static final fun parameterLazyIterable (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
public static final fun parameterLazySequence (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
public static final fun parameterOf (Lcom/benwoodworth/parameterize/ParameterizeScope;[Ljava/lang/Object;)Lkotlin/sequences/Sequence;
}

53 changes: 53 additions & 0 deletions parameterize-api/api/parameterize-api.klib.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Klib ABI Dump
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
// - Show declarations: true

// Library unique name: <com.benwoodworth.parameterize:parameterize-api>
open annotation class com.benwoodworth.parameterize/ExperimentalParameterizeApi : kotlin/Annotation { // com.benwoodworth.parameterize/ExperimentalParameterizeApi|null[0]
constructor <init>() // com.benwoodworth.parameterize/ExperimentalParameterizeApi.<init>|<init>(){}[0]
}

abstract interface com.benwoodworth.parameterize/ParameterizeScope { // com.benwoodworth.parameterize/ParameterizeScope|null[0]
abstract fun <#A1: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter<#A1>).getValue(kotlin/Any?, kotlin.reflect/KProperty<*>): #A1 // com.benwoodworth.parameterize/ParameterizeScope.getValue|getValue@com.benwoodworth.parameterize.ParameterizeScope.DeclaredParameter<0:0>(kotlin.Any?;kotlin.reflect.KProperty<*>){0§<kotlin.Any?>}[0]
abstract fun <#A1: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A1>).provideDelegate(kotlin/Any?, kotlin.reflect/KProperty<*>): com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter<#A1> // com.benwoodworth.parameterize/ParameterizeScope.provideDelegate|provideDelegate@com.benwoodworth.parameterize.ParameterizeScope.Parameter<0:0>(kotlin.Any?;kotlin.reflect.KProperty<*>){0§<kotlin.Any?>}[0]

final class <#A1: kotlin/Any?> ParameterDelegate // com.benwoodworth.parameterize/ParameterizeScope.ParameterDelegate|null[0]

final class <#A1: out kotlin/Any?> DeclaredParameter { // com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter|null[0]
constructor <init>(#A1) // com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter.<init>|<init>(1:0){}[0]

final val argument // com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter.argument|{}argument[0]
final fun <get-argument>(): #A1 // com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter.argument.<get-argument>|<get-argument>(){}[0]

final fun toString(): kotlin/String // com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter.toString|toString(){}[0]
}

final value class <#A1: out kotlin/Any?> Parameter { // com.benwoodworth.parameterize/ParameterizeScope.Parameter|null[0]
constructor <init>(kotlin.sequences/Sequence<#A1>) // com.benwoodworth.parameterize/ParameterizeScope.Parameter.<init>|<init>(kotlin.sequences.Sequence<1:0>){}[0]

final val arguments // com.benwoodworth.parameterize/ParameterizeScope.Parameter.arguments|{}arguments[0]
final fun <get-arguments>(): kotlin.sequences/Sequence<#A1> // com.benwoodworth.parameterize/ParameterizeScope.Parameter.arguments.<get-arguments>|<get-arguments>(){}[0]

final fun equals(kotlin/Any?): kotlin/Boolean // com.benwoodworth.parameterize/ParameterizeScope.Parameter.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // com.benwoodworth.parameterize/ParameterizeScope.Parameter.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // com.benwoodworth.parameterize/ParameterizeScope.Parameter.toString|toString(){}[0]
}
}

final value class com.benwoodworth.parameterize/LazyParameterScope { // com.benwoodworth.parameterize/LazyParameterScope|null[0]
constructor <init>(com.benwoodworth.parameterize/ParameterizeScope) // com.benwoodworth.parameterize/LazyParameterScope.<init>|<init>(com.benwoodworth.parameterize.ParameterizeScope){}[0]

final fun <#A1: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A1>).provideDelegate(kotlin/Any?, kotlin.reflect/KProperty<*>): com.benwoodworth.parameterize/ParameterizeScope.DeclaredParameter<#A1> // com.benwoodworth.parameterize/LazyParameterScope.provideDelegate|provideDelegate@com.benwoodworth.parameterize.ParameterizeScope.Parameter<0:0>(kotlin.Any?;kotlin.reflect.KProperty<*>){0§<kotlin.Any?>}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // com.benwoodworth.parameterize/LazyParameterScope.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // com.benwoodworth.parameterize/LazyParameterScope.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // com.benwoodworth.parameterize/LazyParameterScope.toString|toString(){}[0]
}

final fun <#A: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope).com.benwoodworth.parameterize/parameter(kotlin.collections/Iterable<#A>): com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A> // com.benwoodworth.parameterize/parameter|[email protected](kotlin.collections.Iterable<0:0>){0§<kotlin.Any?>}[0]
final fun <#A: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope).com.benwoodworth.parameterize/parameter(kotlin.sequences/Sequence<#A>): com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A> // com.benwoodworth.parameterize/parameter|[email protected](kotlin.sequences.Sequence<0:0>){0§<kotlin.Any?>}[0]
final fun <#A: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope).com.benwoodworth.parameterize/parameterOf(kotlin/Array<out #A>...): com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A> // com.benwoodworth.parameterize/parameterOf|[email protected](kotlin.Array<out|0:0>...){0§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope).com.benwoodworth.parameterize/parameter(crossinline kotlin/Function1<com.benwoodworth.parameterize/LazyParameterScope, kotlin.collections/Iterable<#A>>): com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A> // com.benwoodworth.parameterize/parameter|[email protected](kotlin.Function1<com.benwoodworth.parameterize.LazyParameterScope,kotlin.collections.Iterable<0:0>>){0§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?> (com.benwoodworth.parameterize/ParameterizeScope).com.benwoodworth.parameterize/parameter(crossinline kotlin/Function1<com.benwoodworth.parameterize/LazyParameterScope, kotlin.sequences/Sequence<#A>>): com.benwoodworth.parameterize/ParameterizeScope.Parameter<#A> // com.benwoodworth.parameterize/parameter|[email protected](kotlin.Function1<com.benwoodworth.parameterize.LazyParameterScope,kotlin.sequences.Sequence<0:0>>){0§<kotlin.Any?>}[0]
37 changes: 37 additions & 0 deletions parameterize-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2024 Ben Woodworth
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("kotlin-multiplatform-conventions")
id("dokka-conventions")
id("binary-compatibility-validator-conventions")
id("publishing-conventions")
id("ci-conventions")
}

repositories {
mavenCentral()
}

kotlin {
sourceSets {
configureEach {
languageSettings {
optIn("com.benwoodworth.parameterize.internal.ParameterizeApiFriendModuleApi")
}
}
}
}
35 changes: 35 additions & 0 deletions parameterize-api/src/commonMain/kotlin/Annotations.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024 Ben Woodworth
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.benwoodworth.parameterize

import kotlin.annotation.AnnotationTarget.*

/**
* Marks declarations that are still **experimental** in Parameterize, which means that the design of the corresponding
* declarations has open issues which may (or may not) lead to their changes in the future. Roughly speaking, there is a
* chance that those declarations will be deprecated in the near future or the semantics of their behavior may change in
* some way that may break some code.
*/
@MustBeDocumented
@Retention(AnnotationRetention.BINARY)
@Target(
CLASS, ANNOTATION_CLASS, TYPEALIAS,
PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER
)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
public annotation class ExperimentalParameterizeApi
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
* limitations under the License.
*/

@file:Suppress("KDocUnresolvedReference")

package com.benwoodworth.parameterize

import com.benwoodworth.parameterize.ParameterizeScope.DeclaredParameter
import com.benwoodworth.parameterize.ParameterizeScope.Parameter
import com.benwoodworth.parameterize.internal.ParameterizeApiFriendModuleApi
import kotlin.experimental.ExperimentalTypeInference
import kotlin.jvm.JvmInline
import kotlin.jvm.JvmName
Expand Down Expand Up @@ -120,8 +123,13 @@ public interface ParameterizeScope {
*
* @see Parameter
*/
public class DeclaredParameter<out T> internal constructor(
internal val argument: T
public class DeclaredParameter<out T>
/** @suppress */
@ParameterizeApiFriendModuleApi
constructor(
/** @suppress */
@ParameterizeApiFriendModuleApi
public val argument: T
) {
/**
* Returns a string representation of the current argument.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2024 Ben Woodworth
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.benwoodworth.parameterize.internal

@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY)
internal annotation class ParameterizeApiFriendModuleApi
48 changes: 0 additions & 48 deletions parameterize-core/api/parameterize-core.api
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
public abstract interface annotation class com/benwoodworth/parameterize/ExperimentalParameterizeApi : java/lang/annotation/Annotation {
}

public final class com/benwoodworth/parameterize/LazyParameterScope {
public static final synthetic fun box-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Lcom/benwoodworth/parameterize/LazyParameterScope;
public static fun constructor-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Lcom/benwoodworth/parameterize/ParameterizeScope;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lcom/benwoodworth/parameterize/ParameterizeScope;Lcom/benwoodworth/parameterize/ParameterizeScope;)Z
public fun hashCode ()I
public static fun hashCode-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)I
public static final fun provideDelegate-13mUnGw (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Lcom/benwoodworth/parameterize/ParameterizeScope;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Lcom/benwoodworth/parameterize/ParameterizeScope;
}

public final class com/benwoodworth/parameterize/ParameterizeConfiguration {
public static final field Companion Lcom/benwoodworth/parameterize/ParameterizeConfiguration$Companion;
public final fun getDecorator ()Lkotlin/jvm/functions/Function3;
Expand Down Expand Up @@ -103,37 +89,3 @@ public final class com/benwoodworth/parameterize/ParameterizeKt {
public static synthetic fun parameterize$default (Lcom/benwoodworth/parameterize/ParameterizeConfiguration;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
}

public abstract interface class com/benwoodworth/parameterize/ParameterizeScope {
public abstract fun getValue (Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public abstract fun provideDelegate-13mUnGw (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/reflect/KProperty;)Lcom/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$DeclaredParameter {
public fun toString ()Ljava/lang/String;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$Parameter {
public static final synthetic fun box-impl (Lkotlin/sequences/Sequence;)Lcom/benwoodworth/parameterize/ParameterizeScope$Parameter;
public static fun constructor-impl (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lkotlin/sequences/Sequence;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lkotlin/sequences/Sequence;Lkotlin/sequences/Sequence;)Z
public final fun getArguments ()Lkotlin/sequences/Sequence;
public fun hashCode ()I
public static fun hashCode-impl (Lkotlin/sequences/Sequence;)I
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Lkotlin/sequences/Sequence;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Lkotlin/sequences/Sequence;
}

public final class com/benwoodworth/parameterize/ParameterizeScope$ParameterDelegate {
}

public final class com/benwoodworth/parameterize/ParameterizeScopeKt {
public static final fun parameter (Lcom/benwoodworth/parameterize/ParameterizeScope;Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
public static final fun parameter (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
public static final fun parameterLazyIterable (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
public static final fun parameterLazySequence (Lcom/benwoodworth/parameterize/ParameterizeScope;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
public static final fun parameterOf (Lcom/benwoodworth/parameterize/ParameterizeScope;[Ljava/lang/Object;)Lkotlin/sequences/Sequence;
}

Loading

0 comments on commit 067b9d7

Please sign in to comment.