Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Nov 19, 2023
1 parent 0d6f61b commit 8d8d6a8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ gjf = "1.13.0"
incap = "1.0.0"
jdk = "20"
jvmTarget = "11"
kotlin = "1.9.20"
kotlin = "2.0.0-Beta1"
kotlinCompileTesting = "0.4.0"
kotlinpoet = "1.15.0"
ksp = "1.9.20-1.0.14"
ksp = "2.0.0-Beta1-1.0.14"
ktfmt = "0.46"
moshi = "1.15.0"
okhttp = "4.12.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:OptIn(UnsafeDuringIrConstructionAPI::class)

package dev.zacsweers.moshix.ir.compiler

import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
Expand All @@ -23,6 +25,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classFqName
import org.jetbrains.kotlin.ir.types.classifierOrNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.name.ClassId

internal class MoshiIrGenerationExtension(
Expand All @@ -29,6 +30,7 @@ internal class MoshiIrGenerationExtension(
private val debug: Boolean
) : IrGenerationExtension {

@OptIn(UnsafeDuringIrConstructionAPI::class)
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
val generatedAnnotation =
generatedAnnotationName?.let { name ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.declarations.IrProperty
import org.jetbrains.kotlin.ir.expressions.IrConst
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.ir.types.classOrNull
import org.jetbrains.kotlin.ir.util.file
import org.jetbrains.kotlin.ir.util.getAnnotation
Expand All @@ -38,6 +39,7 @@ import org.jetbrains.kotlin.name.FqName
internal val JSON_ANNOTATION = FqName("com.squareup.moshi.Json")
internal val JSON_QUALIFIER_ANNOTATION = FqName("com.squareup.moshi.JsonQualifier")

@OptIn(UnsafeDuringIrConstructionAPI::class)
internal fun IrAnnotationContainer?.jsonQualifiers(): Set<IrConstructorCall> {
if (this == null) return emptySet()
return annotations.filterTo(LinkedHashSet()) {
Expand Down Expand Up @@ -81,6 +83,7 @@ private val TargetProperty.isVisible: Boolean
* Returns a generator for this property, or null if either there is an error and this property
* cannot be used with code gen, or if no codegen is necessary for this property.
*/
@OptIn(UnsafeDuringIrConstructionAPI::class)
internal fun TargetProperty.generator(
originalType: IrClass,
errors: MutableList<(logger: MessageCollector) -> Unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(UnsafeDuringIrConstructionAPI::class)

package dev.zacsweers.moshix.ir.compiler

import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
Expand All @@ -28,6 +30,7 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.makeNotNull
import org.jetbrains.kotlin.ir.types.makeNullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(UnsafeDuringIrConstructionAPI::class)

package dev.zacsweers.moshix.ir.compiler.util

import java.util.Locale
Expand Down Expand Up @@ -87,6 +89,7 @@ import org.jetbrains.kotlin.ir.expressions.IrWhen
import org.jetbrains.kotlin.ir.expressions.IrWhileLoop
import org.jetbrains.kotlin.ir.expressions.impl.IrIfThenElseImpl
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.ir.types.IrDynamicType
import org.jetbrains.kotlin.ir.types.IrErrorType
import org.jetbrains.kotlin.ir.types.IrSimpleType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class MoshiSealedSymbolProcessorProviderTest {
sources = sourceFiles.toList()
inheritClassPath = true
symbolProcessorProviders = listOf(MoshiProguardGenSymbolProcessor.Provider())
languageVersion = "1.9"
block()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class MoshiSealedSymbolProcessorProviderTest {
sources = sourceFiles.toList()
inheritClassPath = true
symbolProcessorProviders = listOf(MoshiSealedSymbolProcessorProvider())
languageVersion = "1.9"
}

private fun compile(
Expand Down

0 comments on commit 8d8d6a8

Please sign in to comment.