Skip to content

Commit d372ad2

Browse files
authored
Update to 1.8.21 (#1071)
1 parent 2dafda4 commit d372ad2

File tree

18 files changed

+114
-55
lines changed

18 files changed

+114
-55
lines changed

build.gradle.kts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import org.jetbrains.dokka.gradle.DokkaTask
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
24

35
@Suppress("DSL_SCOPE_VIOLATION")
46
plugins {
@@ -96,14 +98,3 @@ configure(subprojects - project(":arrow-meta-docs")) {
9698
}
9799
}
98100
}
99-
100-
val toolchain = project.extensions.getByType<JavaToolchainService>()
101-
allprojects {
102-
tasks.withType<JavaCompile>().configureEach {
103-
javaCompiler.set(toolchain.compilerFor {
104-
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
105-
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
106-
languageVersion.set(JavaLanguageVersion.of(javaVersion))
107-
})
108-
}
109-
}

docs/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ plugins {
1111
alias(libs.plugins.arrowGradleConfig.kotlin)
1212
}
1313

14+
kotlin {
15+
explicitApi = null
16+
17+
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
18+
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
19+
jvmToolchain {
20+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
21+
}
22+
}
23+
1424
dependencies {
1525
runtimeOnly(libs.kotlin.stdlibJDK8)
1626
runtimeOnly(projects.arrowMeta)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pom.smc.url=https://github.com/arrow-kt/arrow-meta/
1010
pom.smc.connection=scm:git:git://github.com/arrow-kt/arrow-meta.git
1111
pom.smc.developerConnection=scm:git:ssh://[email protected]/arrow-kt/arrow-meta.git
1212

13-
jvmTargetVersion=1.8
13+
jvmTargetVersion=11
1414

1515
# Gradle options
1616
org.gradle.jvmargs=-Xmx4g

gradle/projects.libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[versions]
2-
arrow = "1.1.5"
3-
arrowGradleConfig = "0.11.0"
2+
arrow = "1.2.0-RC"
3+
arrowGradleConfig = "0.12.0-rc.3"
44
assertj = "3.24.2"
55
classgraph = "4.8.157"
66
dokka = "1.8.10"
77
intellijOpenApi = "7.0.3"
88
javaAssist = "3.29.2-GA"
99
junit = "5.9.2"
10-
kotlin = "1.8.10"
10+
kotlin = "1.8.21"
1111
kotlinCompileTesting = "1.5.0"
1212
javaCompileTesting = "0.21.0"
1313
kotlinBinaryCompatibilityValidator = "0.13.0"
1414
detekt = "1.22.0"
15-
ksp = "1.8.10-1.0.9"
15+
ksp = "1.8.21-1.0.11"
1616

1717
[libraries]
1818
arrowCore = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }

libs/arrow-meta/api/arrow-meta.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,13 @@ public final class arrow/meta/phases/codegen/ir/IrUtils : org/jetbrains/kotlin/i
729729
public fun createExpressionBody (IILkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
730730
public fun createExpressionBody (IILorg/jetbrains/kotlin/ir/expressions/IrExpression;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
731731
public fun createExpressionBody (Lorg/jetbrains/kotlin/ir/expressions/IrExpression;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
732-
public fun createFakeOverrideFunction (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;Lorg/jetbrains/kotlin/ir/types/IrType;ZZZZZZZ)Lorg/jetbrains/kotlin/ir/declarations/IrSimpleFunction;
733-
public fun createFakeOverrideProperty (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;ZZZZZZ)Lorg/jetbrains/kotlin/ir/declarations/IrProperty;
734732
public fun createField (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/ir/symbols/IrFieldSymbol;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/ir/types/IrType;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;ZZZ)Lorg/jetbrains/kotlin/ir/declarations/IrField;
735733
public fun createFlexibleType (Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;)Lorg/jetbrains/kotlin/types/model/KotlinTypeMarker;
736734
public fun createFunction (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/ir/symbols/IrSimpleFunctionSymbol;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;Lorg/jetbrains/kotlin/ir/types/IrType;ZZZZZZZZLorg/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource;)Lorg/jetbrains/kotlin/ir/declarations/IrSimpleFunction;
735+
public fun createFunctionWithLateBinding (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;Lorg/jetbrains/kotlin/ir/types/IrType;ZZZZZZZ)Lorg/jetbrains/kotlin/ir/declarations/IrSimpleFunction;
737736
public fun createLocalDelegatedProperty (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/ir/symbols/IrLocalDelegatedPropertySymbol;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/ir/types/IrType;Z)Lorg/jetbrains/kotlin/ir/declarations/IrLocalDelegatedProperty;
738737
public fun createProperty (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/ir/symbols/IrPropertySymbol;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;ZZZZZZZLorg/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource;)Lorg/jetbrains/kotlin/ir/declarations/IrProperty;
738+
public fun createPropertyWithLateBinding (IILorg/jetbrains/kotlin/ir/declarations/IrDeclarationOrigin;Lorg/jetbrains/kotlin/name/Name;Lorg/jetbrains/kotlin/descriptors/DescriptorVisibility;Lorg/jetbrains/kotlin/descriptors/Modality;ZZZZZZ)Lorg/jetbrains/kotlin/ir/declarations/IrProperty;
739739
public fun createSimpleType (Lorg/jetbrains/kotlin/types/model/TypeConstructorMarker;Ljava/util/List;ZZLjava/util/List;)Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;
740740
public fun createStarProjection (Lorg/jetbrains/kotlin/types/model/TypeParameterMarker;)Lorg/jetbrains/kotlin/ir/types/impl/IrStarProjectionImpl;
741741
public synthetic fun createStarProjection (Lorg/jetbrains/kotlin/types/model/TypeParameterMarker;)Lorg/jetbrains/kotlin/types/model/TypeArgumentMarker;

libs/arrow-meta/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ plugins {
1010

1111
kotlin {
1212
explicitApi = null
13+
14+
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
15+
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
16+
jvmToolchain {
17+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
18+
}
1319
}
1420

1521
tasks.compileKotlin {

libs/arrow-meta/src/main/kotlin/arrow/meta/Meta.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ typealias CliPlugin = Plugin<CompilerContext>
4545

4646
/**
4747
* Enables syntactic sugar for plugin creation via: "pluginId" { meta(
48+
*
4849
* ```
4950
* ..phases
5051
* ```
52+
*
5153
* ) }
5254
*/
5355
operator fun String.invoke(phases: CompilerContext.() -> List<ExtensionPhase>): CliPlugin =
@@ -59,7 +61,6 @@ operator fun String.invoke(phases: CompilerContext.() -> List<ExtensionPhase>):
5961
*
6062
* Plugin authors are encouraged to define [CliPlugin] extensions by making them part of the [Meta]
6163
* receiver:
62-
*
6364
* ```kotlin
6465
* val Meta.helloWorld: CliPlugin get() =
6566
* "Hello World" {

libs/arrow-meta/src/main/kotlin/arrow/meta/dsl/analysis/AnalysisSyntax.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppressio
2626
/**
2727
* The Analysis phase determines if the parsed AST type checks and resolves properly. As part of
2828
* this phase, we have access to events happening before and after resolution. Before resolution, we
29-
* are given the chance to modify the compiler trees in the form of `KtElement` via the [Quote
30-
* Template System].
29+
* are given the chance to modify the compiler trees in the form of `KtElement` via the
30+
* [Quote Template System].
3131
*/
3232
interface AnalysisSyntax {
3333

libs/arrow-meta/src/main/kotlin/arrow/meta/dsl/config/ConfigSyntax.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface ConfigSyntax {
3030
*
3131
* @updateConfiguration enables a DSL using [CompilerContext], and it can update
3232
* [CompilerConfiguration] through its mutable API.
33+
*
3334
* @return [Config] [ExtensionPhase].
3435
*/
3536
fun updateConfig(

libs/arrow-meta/src/main/kotlin/arrow/meta/phases/analysis/KtUtils.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
2929
import org.jetbrains.kotlin.types.KotlinType
3030
import org.jetbrains.kotlin.types.TypeConstructor
3131
import org.jetbrains.kotlin.types.TypeProjection
32-
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
3332

3433
fun KtDeclarationWithBody.body(): KtExpression? = bodyExpression ?: bodyBlockExpression
3534

@@ -146,9 +145,10 @@ fun resolveFunctionTypeEq(): Eq<KotlinType> = Eq { t1, t2 ->
146145
* intersect(typeConstructorEq(), types).isNotEmpty()
147146
* //sampleEnd
148147
* ```
149-
* @see [org.jetbrains.kotlin.types.TypeUtils] for more abstractions
148+
*
150149
* @param eq can be define for e.g.: [TypeConstructor], [MemberScope] or typeArguments List<
151-
* [TypeProjection]>, etc.
150+
* [TypeProjection]>, etc.
151+
* @see [org.jetbrains.kotlin.types.TypeUtils] for more abstractions
152152
* @see functionTypeEq
153153
*/
154154
fun <C : CallableDescriptor> C.intersect(
@@ -163,8 +163,9 @@ fun <C : CallableDescriptor> C.intersect(
163163
/**
164164
* given [eq] this function returns a List of [KotlinType] that are contained by both [list] and
165165
* [other]
166+
*
166167
* @param eq can be defined for [TypeConstructor], [MemberScope] or typeArguments List<
167-
* [TypeProjection]>, etc.
168+
* [TypeProjection]>, etc.
168169
* @see intersect
169170
*/
170171
fun <D : DeclarationDescriptor> D.intersect(
@@ -191,9 +192,8 @@ fun KtAnnotated.isAnnotatedWith(regex: Regex): Boolean =
191192

192193
val KtClass.companionObject: KtObjectDeclaration?
193194
get() =
194-
declarations
195-
.singleOrNull { it.safeAs<KtObjectDeclaration>()?.isCompanion() == true }
196-
.safeAs<KtObjectDeclaration>()
195+
declarations.singleOrNull { (it as? KtObjectDeclaration)?.isCompanion() == true }
196+
as? KtObjectDeclaration
197197

198198
fun DeclarationDescriptor.skipGeneration(): Boolean =
199199
platform != CommonPlatforms.defaultCommonPlatform &&

libs/arrow-meta/src/main/kotlin/arrow/meta/phases/codegen/ir/IrUtils.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstituto
4848
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
4949
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
5050
import org.jetbrains.kotlin.types.KotlinType
51-
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
5251

5352
class IrUtils(
5453
val pluginContext: IrPluginContext,
@@ -227,8 +226,7 @@ fun IrMemberAccessExpression<*>.getTypeSubstitutionMap(
227226
container.allTypeParameters.withIndex().associate { it.value to getTypeArgument(it.index)!! }
228227

229228
val IrMemberAccessExpression<*>.typeSubstitutions: Map<IrTypeParameter, IrType>
230-
get() =
231-
symbol.owner.safeAs<IrTypeParametersContainer>()?.let(::getTypeSubstitutionMap) ?: emptyMap()
229+
get() = (symbol.owner as? IrTypeParametersContainer)?.let(::getTypeSubstitutionMap) ?: emptyMap()
232230

233231
/** returns a Pair of the descriptor and it's substituted KotlinType at the call-site */
234232
private fun IrSimpleFunction.substitutedValueParameters(

libs/arrow-meta/src/test/kotlin/arrow/meta/ir/syntax/IrSyntaxTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class IrSyntaxTest {
137137
// TODO: IrErrorDeclaration::class.java,
138138
// TODO: IrErrorExpression::class.java,
139139
// TODO: IrErrorCallExpression::class.java
140-
),
140+
),
141141
"""
142142
package test
143143
@@ -192,8 +192,8 @@ class IrSyntaxTest {
192192
9 - 6
193193
}
194194
}
195-
""".trimIndent(
196-
)
195+
"""
196+
.trimIndent()
197197
)
198198
}
199199
}

libs/gradle-plugin-commons/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ tasks.processResources {
1616
}
1717
}
1818

19+
kotlin {
20+
explicitApi = null
21+
22+
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
23+
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
24+
jvmToolchain {
25+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
26+
}
27+
}
28+
1929
dependencies {
2030
compileOnly(gradleApi())
2131
compileOnly(libs.kotlin.stdlibJDK8)

libs/gradle-plugin-commons/src/main/kotlin/arrow/meta/plugin/gradle/ArrowMetaGradlePlugin.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package arrow.meta.plugin.gradle
22

33
import io.github.classgraph.ClassGraph
44
import java.io.File
5-
import java.lang.module.ModuleDescriptor.Version
65
import java.util.Properties
6+
import kotlin.math.max
77
import org.gradle.api.InvalidUserDataException
88
import org.gradle.api.Project
99
import org.gradle.api.provider.Provider
@@ -124,4 +124,27 @@ public interface ArrowMetaGradlePlugin : KotlinCompilerPluginSupportPlugin {
124124
private companion object {
125125
private const val VERSION_KEY = "compilerPluginVersion"
126126
}
127+
128+
private data class Version(val components: List<Int>) : Comparable<Version> {
129+
override fun compareTo(other: Version): Int =
130+
compareComponents(this.components, other.components)
131+
132+
private fun compareComponents(x: List<Int>, y: List<Int>): Int {
133+
val maxComponent = max(x.size, y.size)
134+
for (i in 0 until maxComponent) {
135+
val xComponent = x.getOrElse(i) { 0 }
136+
val yComponent = y.getOrElse(i) { 0 }
137+
if (xComponent != yComponent) return (xComponent - yComponent)
138+
}
139+
// if we get there, that means they're equal
140+
return 0
141+
}
142+
143+
companion object {
144+
fun parse(version: String): Version? {
145+
val elements = version.split('.', '-', '+').map { it.toIntOrNull() }
146+
return if (elements.any { it == null }) null else Version(elements.filterNotNull())
147+
}
148+
}
149+
}
127150
}

libs/meta-test/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ plugins {
1010

1111
kotlin {
1212
explicitApi = null
13+
14+
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
15+
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
16+
jvmToolchain {
17+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
18+
}
1319
}
1420

1521
dependencies {

libs/meta-test/src/main/kotlin/arrow/meta/plugin/testing/CompilationAssertions.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ private const val VARIABLE = "[^(]+"
2828
* developed by [Thilo Schuchort](https://github.com/tschuchortdev).
2929
*
3030
* Main schema:
31-
*
3231
* ```
3332
* assertThis(
3433
* CompilerTest(
@@ -43,7 +42,6 @@ private const val VARIABLE = "[^(]+"
4342
* (`code`). Then, the expected behavior (`assert`) will be checked.
4443
*
4544
* For instance:
46-
*
4745
* ```
4846
* assertThis(
4947
* CompilerTest(
@@ -58,7 +56,7 @@ private const val VARIABLE = "[^(]+"
5856
* ```
5957
*
6058
* @param compilerTest necessary data to run the compilation, source code to be compiled and
61-
* expected behavior
59+
* expected behavior
6260
* @see [CompilerTest]
6361
*/
6462
fun assertThis(compilerTest: CompilerTest): Unit = compilerTest.run(interpreter)

libs/meta-test/src/main/kotlin/arrow/meta/plugin/testing/CompilerTestDSL.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ interface AssertSyntax {
180180
* property.
181181
*
182182
* For instance:
183-
*
184183
* ```
185184
* compilesWith { it.contains("Unsafe operation") }
186185
* ```
@@ -197,7 +196,6 @@ interface AssertSyntax {
197196
* checked by a provided function.
198197
*
199198
* For instance:
200-
*
201199
* ```
202200
* failsWith { it.contains("Expecting a top level declaration") }
203201
* ```

0 commit comments

Comments
 (0)