Skip to content

Commit

Permalink
Add javadoc and publication
Browse files Browse the repository at this point in the history
  • Loading branch information
daugeldauge committed Sep 19, 2021
1 parent 43918b9 commit 70c375f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
8 changes: 8 additions & 0 deletions buildSrc/src/main/kotlin/publish-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.jvm.tasks.Jar

plugins {
`maven-publish`
signing
Expand All @@ -12,6 +14,12 @@ if (!release) {

publishing {
publications.withType<MavenPublication> {

// Empty javadoc
artifact(tasks.findByName("javadocJar") ?: task<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
})

pom {
name.set("${project.group}:${project.name}")
description.set("Compile-time dependency injection for Kotlin Multiplatform")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
@file:Suppress("KDocUnresolvedReference")

package com.daugeldauge.kinzhal.annotations

import kotlin.reflect.KClass

/**
* Annotates an interface for which dependency-injected implementation
* is to be generated from a set of [modules]. The generated class will
* have the name of the type annotated with [Component] prepended with
* Kinzhal. For example, `@Component interface AppComponent` will
* produce an implementation named KinzhalAppComponent. All [dependencies]
* will be primary constructor parameters of generated class.
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS)
annotation class Component(val modules: Array<KClass<*>> = [], val dependencies: Array<KClass<*>> = [])

/**
* Equivalent of [javax.inject.Inject]. Only a constructor injection is supported for now
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CONSTRUCTOR)
annotation class Inject

/**
* Equivalent of [javax.inject.Scope]
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.ANNOTATION_CLASS)
annotation class Scope

/**
* Equivalent of [javax.inject.Qualifier]
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.ANNOTATION_CLASS)
annotation class Qualifier
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.lang.IllegalStateException
// TODO scope validation
// TODO fix possible conflicts in component provider names

class KinzhalSymbolProcessor(private val codeGenerator: CodeGenerator, private val logger: KSPLogger) : SymbolProcessor {
internal class KinzhalSymbolProcessor(private val codeGenerator: CodeGenerator, private val logger: KSPLogger) : SymbolProcessor {

override fun process(resolver: Resolver): List<KSAnnotated> {

Expand Down Expand Up @@ -177,6 +177,9 @@ class KinzhalSymbolProcessor(private val codeGenerator: CodeGenerator, private v
}
}

/**
* Main entry point to Kinzhal processor
*/
class KinzhalSymbolProcessorProvider : SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
return KinzhalSymbolProcessor(environment.codeGenerator, environment.logger)
Expand Down

0 comments on commit 70c375f

Please sign in to comment.