Skip to content

Commit

Permalink
Update to 1.8.21 (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
serras committed Apr 29, 2023
1 parent 2dafda4 commit d372ad2
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 55 deletions.
13 changes: 2 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand Down Expand Up @@ -96,14 +98,3 @@ configure(subprojects - project(":arrow-meta-docs")) {
}
}
}

val toolchain = project.extensions.getByType<JavaToolchainService>()
allprojects {
tasks.withType<JavaCompile>().configureEach {
javaCompiler.set(toolchain.compilerFor {
val jvmTargetVersion = properties["jvmTargetVersion"].toString()
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
languageVersion.set(JavaLanguageVersion.of(javaVersion))
})
}
}
10 changes: 10 additions & 0 deletions docs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ plugins {
alias(libs.plugins.arrowGradleConfig.kotlin)
}

kotlin {
explicitApi = null

val jvmTargetVersion = properties["jvmTargetVersion"].toString()
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}

dependencies {
runtimeOnly(libs.kotlin.stdlibJDK8)
runtimeOnly(projects.arrowMeta)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pom.smc.url=https://github.com/arrow-kt/arrow-meta/
pom.smc.connection=scm:git:git://github.com/arrow-kt/arrow-meta.git
pom.smc.developerConnection=scm:git:ssh://git@github.com/arrow-kt/arrow-meta.git

jvmTargetVersion=1.8
jvmTargetVersion=11

# Gradle options
org.gradle.jvmargs=-Xmx4g
Expand Down
8 changes: 4 additions & 4 deletions gradle/projects.libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[versions]
arrow = "1.1.5"
arrowGradleConfig = "0.11.0"
arrow = "1.2.0-RC"
arrowGradleConfig = "0.12.0-rc.3"
assertj = "3.24.2"
classgraph = "4.8.157"
dokka = "1.8.10"
intellijOpenApi = "7.0.3"
javaAssist = "3.29.2-GA"
junit = "5.9.2"
kotlin = "1.8.10"
kotlin = "1.8.21"
kotlinCompileTesting = "1.5.0"
javaCompileTesting = "0.21.0"
kotlinBinaryCompatibilityValidator = "0.13.0"
detekt = "1.22.0"
ksp = "1.8.10-1.0.9"
ksp = "1.8.21-1.0.11"

[libraries]
arrowCore = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }
Expand Down
4 changes: 2 additions & 2 deletions libs/arrow-meta/api/arrow-meta.api
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,13 @@ public final class arrow/meta/phases/codegen/ir/IrUtils : org/jetbrains/kotlin/i
public fun createExpressionBody (IILkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
public fun createExpressionBody (IILorg/jetbrains/kotlin/ir/expressions/IrExpression;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
public fun createExpressionBody (Lorg/jetbrains/kotlin/ir/expressions/IrExpression;)Lorg/jetbrains/kotlin/ir/expressions/IrExpressionBody;
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;
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;
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;
public fun createFlexibleType (Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;)Lorg/jetbrains/kotlin/types/model/KotlinTypeMarker;
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;
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;
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;
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;
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;
public fun createSimpleType (Lorg/jetbrains/kotlin/types/model/TypeConstructorMarker;Ljava/util/List;ZZLjava/util/List;)Lorg/jetbrains/kotlin/types/model/SimpleTypeMarker;
public fun createStarProjection (Lorg/jetbrains/kotlin/types/model/TypeParameterMarker;)Lorg/jetbrains/kotlin/ir/types/impl/IrStarProjectionImpl;
public synthetic fun createStarProjection (Lorg/jetbrains/kotlin/types/model/TypeParameterMarker;)Lorg/jetbrains/kotlin/types/model/TypeArgumentMarker;
Expand Down
6 changes: 6 additions & 0 deletions libs/arrow-meta/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ plugins {

kotlin {
explicitApi = null

val jvmTargetVersion = properties["jvmTargetVersion"].toString()
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}

tasks.compileKotlin {
Expand Down
3 changes: 2 additions & 1 deletion libs/arrow-meta/src/main/kotlin/arrow/meta/Meta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ typealias CliPlugin = Plugin<CompilerContext>

/**
* Enables syntactic sugar for plugin creation via: "pluginId" { meta(
*
* ```
* ..phases
* ```
*
* ) }
*/
operator fun String.invoke(phases: CompilerContext.() -> List<ExtensionPhase>): CliPlugin =
Expand All @@ -59,7 +61,6 @@ operator fun String.invoke(phases: CompilerContext.() -> List<ExtensionPhase>):
*
* Plugin authors are encouraged to define [CliPlugin] extensions by making them part of the [Meta]
* receiver:
*
* ```kotlin
* val Meta.helloWorld: CliPlugin get() =
* "Hello World" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppressio
/**
* The Analysis phase determines if the parsed AST type checks and resolves properly. As part of
* this phase, we have access to events happening before and after resolution. Before resolution, we
* are given the chance to modify the compiler trees in the form of `KtElement` via the [Quote
* Template System].
* are given the chance to modify the compiler trees in the form of `KtElement` via the
* [Quote Template System].
*/
interface AnalysisSyntax {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface ConfigSyntax {
*
* @updateConfiguration enables a DSL using [CompilerContext], and it can update
* [CompilerConfiguration] through its mutable API.
*
* @return [Config] [ExtensionPhase].
*/
fun updateConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeConstructor
import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.kotlin.utils.addToStdlib.safeAs

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

Expand Down Expand Up @@ -146,9 +145,10 @@ fun resolveFunctionTypeEq(): Eq<KotlinType> = Eq { t1, t2 ->
* intersect(typeConstructorEq(), types).isNotEmpty()
* //sampleEnd
* ```
* @see [org.jetbrains.kotlin.types.TypeUtils] for more abstractions
*
* @param eq can be define for e.g.: [TypeConstructor], [MemberScope] or typeArguments List<
* [TypeProjection]>, etc.
* [TypeProjection]>, etc.
* @see [org.jetbrains.kotlin.types.TypeUtils] for more abstractions
* @see functionTypeEq
*/
fun <C : CallableDescriptor> C.intersect(
Expand All @@ -163,8 +163,9 @@ fun <C : CallableDescriptor> C.intersect(
/**
* given [eq] this function returns a List of [KotlinType] that are contained by both [list] and
* [other]
*
* @param eq can be defined for [TypeConstructor], [MemberScope] or typeArguments List<
* [TypeProjection]>, etc.
* [TypeProjection]>, etc.
* @see intersect
*/
fun <D : DeclarationDescriptor> D.intersect(
Expand All @@ -191,9 +192,8 @@ fun KtAnnotated.isAnnotatedWith(regex: Regex): Boolean =

val KtClass.companionObject: KtObjectDeclaration?
get() =
declarations
.singleOrNull { it.safeAs<KtObjectDeclaration>()?.isCompanion() == true }
.safeAs<KtObjectDeclaration>()
declarations.singleOrNull { (it as? KtObjectDeclaration)?.isCompanion() == true }
as? KtObjectDeclaration

fun DeclarationDescriptor.skipGeneration(): Boolean =
platform != CommonPlatforms.defaultCommonPlatform &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstituto
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.addToStdlib.safeAs

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

val IrMemberAccessExpression<*>.typeSubstitutions: Map<IrTypeParameter, IrType>
get() =
symbol.owner.safeAs<IrTypeParametersContainer>()?.let(::getTypeSubstitutionMap) ?: emptyMap()
get() = (symbol.owner as? IrTypeParametersContainer)?.let(::getTypeSubstitutionMap) ?: emptyMap()

/** returns a Pair of the descriptor and it's substituted KotlinType at the call-site */
private fun IrSimpleFunction.substitutedValueParameters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class IrSyntaxTest {
// TODO: IrErrorDeclaration::class.java,
// TODO: IrErrorExpression::class.java,
// TODO: IrErrorCallExpression::class.java
),
),
"""
package test
Expand Down Expand Up @@ -192,8 +192,8 @@ class IrSyntaxTest {
9 - 6
}
}
""".trimIndent(
)
"""
.trimIndent()
)
}
}
Expand Down
10 changes: 10 additions & 0 deletions libs/gradle-plugin-commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ tasks.processResources {
}
}

kotlin {
explicitApi = null

val jvmTargetVersion = properties["jvmTargetVersion"].toString()
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}

dependencies {
compileOnly(gradleApi())
compileOnly(libs.kotlin.stdlibJDK8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package arrow.meta.plugin.gradle

import io.github.classgraph.ClassGraph
import java.io.File
import java.lang.module.ModuleDescriptor.Version
import java.util.Properties
import kotlin.math.max
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Project
import org.gradle.api.provider.Provider
Expand Down Expand Up @@ -124,4 +124,27 @@ public interface ArrowMetaGradlePlugin : KotlinCompilerPluginSupportPlugin {
private companion object {
private const val VERSION_KEY = "compilerPluginVersion"
}

private data class Version(val components: List<Int>) : Comparable<Version> {
override fun compareTo(other: Version): Int =
compareComponents(this.components, other.components)

private fun compareComponents(x: List<Int>, y: List<Int>): Int {
val maxComponent = max(x.size, y.size)
for (i in 0 until maxComponent) {
val xComponent = x.getOrElse(i) { 0 }
val yComponent = y.getOrElse(i) { 0 }
if (xComponent != yComponent) return (xComponent - yComponent)
}
// if we get there, that means they're equal
return 0
}

companion object {
fun parse(version: String): Version? {
val elements = version.split('.', '-', '+').map { it.toIntOrNull() }
return if (elements.any { it == null }) null else Version(elements.filterNotNull())
}
}
}
}
6 changes: 6 additions & 0 deletions libs/meta-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ plugins {

kotlin {
explicitApi = null

val jvmTargetVersion = properties["jvmTargetVersion"].toString()
val javaVersion = if (jvmTargetVersion == "1.8") "8" else jvmTargetVersion
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ private const val VARIABLE = "[^(]+"
* developed by [Thilo Schuchort](https://github.com/tschuchortdev).
*
* Main schema:
*
* ```
* assertThis(
* CompilerTest(
Expand All @@ -43,7 +42,6 @@ private const val VARIABLE = "[^(]+"
* (`code`). Then, the expected behavior (`assert`) will be checked.
*
* For instance:
*
* ```
* assertThis(
* CompilerTest(
Expand All @@ -58,7 +56,7 @@ private const val VARIABLE = "[^(]+"
* ```
*
* @param compilerTest necessary data to run the compilation, source code to be compiled and
* expected behavior
* expected behavior
* @see [CompilerTest]
*/
fun assertThis(compilerTest: CompilerTest): Unit = compilerTest.run(interpreter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ interface AssertSyntax {
* property.
*
* For instance:
*
* ```
* compilesWith { it.contains("Unsafe operation") }
* ```
Expand All @@ -197,7 +196,6 @@ interface AssertSyntax {
* checked by a provided function.
*
* For instance:
*
* ```
* failsWith { it.contains("Expecting a top level declaration") }
* ```
Expand Down
Loading

0 comments on commit d372ad2

Please sign in to comment.