Git Product home page Git Product logo

auto-service-ksp's Introduction

Currently working on Slack. Read my blog or follow me on places @ZacSweers.

GitHub Activity

2024-08-21 — opened PR #1590 to slackhq/circuit: "Make presenter tests use distinctUntilChanged by default"

2024-08-21 — created branch z/distinctUntilChanged on slackhq/circuit

2024-08-20 — merged PR #162 to slackhq/kotlin-cli-util: "Bump com.google.truth:truth from 1.4.2 to 1.4.4"

2024-08-20 — merged PR #154 to slackhq/kotlin-cli-util: "Bump com.vanniktech.maven.publish from 0.28.0 to 0.29.0"

2024-08-20 — merged PR #168 to slackhq/kotlin-cli-util: "Bump org.jetbrains.kotlinx.binary-compatibility-validator from 0.14.0 to 0.16.3"

2024-08-20 — merged PR #150 to slackhq/kotlin-cli-util: "Bump dev.zacsweers.autoservice:auto-service-ksp from 1.1.0 to 1.2.0"

2024-08-20 — opened issue #172 on slackhq/kotlin-cli-util: "IOBE in shell-sentry"

2024-08-20 — created branch z/develocityminer on slackhq/slack-gradle-plugin

2024-08-20 — opened PR #55 to ZacSweers/anvil: "Add verbose option + start some timing logging"

2024-08-20 — created branch z/verbose on ZacSweers/anvil

On My Blog

2024-08-21 — Could not load blog content. Please check back later.

More on zacsweers.dev

Inspired by Simon Willison's auto-updating profile README.

auto-service-ksp's People

Contributors

daisyliu618 avatar lexa-diky avatar renovate[bot] avatar zacsweers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

auto-service-ksp's Issues

AutoService's generated resources don't end up in sourceSets.main.resources or allSource

This might be more of a KSP issue, or a misunderstanding, but if I print out sourceSets.main.allSource.sourceDirectories, I get something like this:

project/src/main/resources, 
project/src/main/java, 
project/src/main/kotlin, 
project/build/generated/ksp/main/kotlin, 
project/build/generated/ksp/main/java

Notably missing is project/build/generated/ksp/main/resources. This messes with some other tools that use the sourceSet and expect to find the generated service files.

This apparently doesn't affect the actual Jar packaging, so I might just be using the wrong API here, but which one should I use?

auto-service-ksp raise error while processing java source

How to reproduce

  • fetch source
$ git clone https://github.com/ganadist/VersionCodeDemo -b autoservice_ksp_test test
$ cd test
  • compile failed while using auto-service-ksp
$ ./gradlew :app:assembleDebug

> Task :app:kspBetaDebugKotlin FAILED
e: [ksp] test/app/src/main/java/com/example/myapplication/TestServiceImpl.java:5: No 'value' member value found!

  • compile passed while using kapt
$ git checkout HEAD~1
$ ./gradlew :app:assembleDebug

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • gradle/actions v3
  • actions/setup-java v4
  • gradle/actions v3
  • actions/checkout v4
  • actions/setup-java v4
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml
  • com.google.auto.service:auto-service-annotations 1.1.1
  • com.google.auto.service:auto-service 1.1.1
  • dev.zacsweers.autoservice:auto-service-ksp 1.2.0
  • com.google.guava:guava 33.2.1-jre
  • org.jetbrains.kotlin:kotlin-compiler-embeddable 2.0.0
  • com.squareup:kotlinpoet 1.18.1
  • com.squareup:kotlinpoet-ksp 1.18.1
  • com.google.devtools.ksp:symbol-processing-api 2.0.0-1.0.23
  • com.facebook:ktfmt 0.50
  • junit:junit 4.13.2
  • com.google.truth:truth 1.4.4
  • dev.zacsweers.kctfork:core 0.5.1
  • dev.zacsweers.kctfork:ksp 0.5.1
  • org.jetbrains.kotlin.jvm 2.0.0
  • org.jetbrains.kotlinx.binary-compatibility-validator 0.16.3
  • org.jetbrains.dokka 1.9.20
  • com.google.devtools.ksp 2.0.0-1.0.23
  • com.vanniktech.maven.publish 0.29.0
  • com.diffplug.spotless 6.25.0
processor/gradle.properties
processor/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.9

  • Check this box to trigger a request for Renovate to run again on this repository

Support multiple rounds

Hi we have been actively using auto-service-ksp in our repo and found below issue:

The AutoService code generator doesn't support KSP very well (for example
The AutoService code generator doesn't process @autoservice in code-generated UiRegistry).

We believe below changes need to be made
https://kotlinlang.org/docs/ksp-multi-round.html#changes-to-your-processor

instead of returning an empty list here https://github.com/ZacSweers/auto-service-ksp/blob/main/processor/src/main/kotlin/dev/zacsweers/autoservice/ksp/AutoServiceSymbolProcessor.kt#L132

so it can support KSP correctly which is multi-round.

Didn't find classes in another souceSet ( android)

I'm not sure this bug is occured by auto-service-ksp or auto-service or kotlin.

I have multiple @AutoService annotated classes in multiple sourceset in same module. But services file contains lists of only one sourceset classes.

for example, I have files like this and all files have @AutoService(mypkg.MyTarget) annotions.

my_module/ src/ sandbox / mypkg / TargetA.kt
my_module/ src/ main / mypkg / MyTarget.kt
my_module/ src/ main / mypkg / TargetB.kt
my_module/ src/ main / mypkg / TargetC.kt

then, generated mypkg.MyTarget contains only TargetB , TargetC.

Is there any solution for this problem?

Plugin not working with latest kotlin version

kotlin  = "1.6.10"
ksp = "1.6.10-1.0.2"
ksp-auto-service = "1.0.0"

Error,

> Cannot query the value of task ':kspKotlin' property 'classpathSnapshotProperties.classpathSnapshotDir' because it has no value available.

It seems like an issue with the old version of KSP this plugin depends on. Would it be possible to upgrade to the latest kotlin version?

Confusing error message

Improvement description

The following code, rightfully, produces an error:

Code:

interface MyService

@AutoService() // note, no interfaces specified
class MyServiceImpl : MyService

Error

No service interfaces provided for element!

This error is quite confusing from the developer's perspective line of thought is as follows:

  • Which element? Error points to line with class instead of annotation
  • But my class inherits the desired interface!
  • Sad wondering around the office

My company is actively migrating to Kotlin, had this thing in learning chats a couple of times already :)

Proposed solution

Add more clear message:

No service interfaces specified by @AutoService annotation!
You can provide them in annotation parameters: @AutoService(YourService::class)

Do not fail the build if `@AutoService` annotation is absent from compilation unit

This prevents usage in the following form:

compileOnly(libs.autoService.annotations)
ksp(libs.autoService.ksp)

as the testKsp configuration extends from the ksp configuration and thus the processor will run over the test sources where the annotation is not present.

Now an easy workaround is to testCompileOnly the annotation, but I don't have anything annotated in that source set so it's a bit weird.

I don't think this is a problem for the main source set either. If you omit the annotation dependency accidentally you would be unable to annotate any types.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.