Code Monkey home page Code Monkey logo

auto-service-ksp's Introduction

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

GitHub Activity

2024-06-26 — commented on #8 in ZacSweers/FieldSpottr

2024-06-26 — closed issue #8 on ZacSweers/FieldSpottr: "Show current time with red line"

2024-06-25 — closed issue #10 on ZacSweers/FieldSpottr: "Red-out permit blocks"

2024-06-25 — deleted branch z/errorBlocks on ZacSweers/FieldSpottr

2024-06-25 — merged PR #11 to ZacSweers/FieldSpottr: "Mark permit blocks in red"

2024-06-25 — opened PR #11 to ZacSweers/FieldSpottr: "Mark permit blocks in red"

2024-06-25 — created branch z/errorBlocks on ZacSweers/FieldSpottr

2024-06-25 — deleted branch renovate/ktor-monorepo on ZacSweers/FieldSpottr

2024-06-25 — merged PR #7 to ZacSweers/FieldSpottr: "Update ktor monorepo to v2.3.12"

2024-06-25 — opened issue #10 on ZacSweers/FieldSpottr: "Red-out permit blocks"

On My Blog

2024-05-06Preparing for K2

2024-01-03Life in 2024

2023-07-09Catching Up on CatchUp: 2023

2023-01-10Keeping Android and Kotlin Healthy in a Post-Twitter World

2022-12-19Improving Your Gradle Workflow by Not Auto-reloading Build Files

2022-11-30Android Studio's "I'm Feeling Lucky" Button

2022-11-22Network Calls in Lint: Best Practices

2022-10-17Is ViewPump A Security Risk?

2022-05-23You Are Not Blocked

2021-07-23Optimizing Your Kotlin Build

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

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)

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?

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?

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.1.0
  • com.google.guava:guava 33.2.1-jre
  • org.jetbrains.kotlin:kotlin-compiler-embeddable 2.0.0
  • com.squareup:kotlinpoet 1.17.0
  • com.squareup:kotlinpoet-ksp 1.17.0
  • com.google.devtools.ksp:symbol-processing-api 2.0.0-1.0.22
  • com.facebook:ktfmt 0.50
  • junit:junit 4.13.2
  • com.google.truth:truth 1.4.2
  • dev.zacsweers.kctfork:core 0.5.0
  • dev.zacsweers.kctfork:ksp 0.5.0
  • org.jetbrains.kotlin.jvm 2.0.0
  • org.jetbrains.kotlinx.binary-compatibility-validator 0.15.0-Beta.2
  • org.jetbrains.dokka 1.9.20
  • com.google.devtools.ksp 2.0.0-1.0.22
  • com.vanniktech.maven.publish 0.28.0
  • com.diffplug.spotless 6.25.0
processor/gradle.properties
processor/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.8

  • 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.

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?

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.

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

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.