izhangzhihao / unmeta

remove all Kotlin Metadata and DebugMetadata annotations from .class files
https://plugins.gradle.org/plugin/io.github.izhangzhihao.unmeta
MIT License
39 stars 4 forks source link

Task with name 'compileKotlin' not found in project ':app'. #2

Closed droidxrx closed 1 year ago

droidxrx commented 1 year ago

An exception occurred applying plugin request [id: 'io.github.izhangzhihao.unmeta', version: '1.0.0']

Failed to apply plugin 'io.github.izhangzhihao.unmeta'. Task with name 'compileKotlin' not found in project ':app'.

izhangzhihao commented 1 year ago

make sure you have the gradle kotlin plugin applied. https://github.com/izhangzhihao/unmeta#by-using-the-kotlin-dsl-in-buildgradlekt

rushiiMachine commented 1 year ago

make sure you have the gradle kotlin plugin applied. izhangzhihao/unmeta#by-using-the-kotlin-dsl-in-buildgradlekt

AGP replaces compileKotlin with compileReleaseKotlin and compileDebugKotlin, I already have KGP applied

Edit: found a temporary workaround:

plugins {
    id("io.github.izhangzhihao.unmeta") version "1.0.0" apply false
}

afterEvaluate {
    task<UnmetaTask>("releaseUnmeta")
        .apply { enable.set(true) }
        .also { tasks["compileReleaseKotlin"].finalizedBy(it) }
}
izhangzhihao commented 1 year ago

AGP is not supported yet, you can submit a pr to support AGP.

axzae commented 1 year ago

I have created a AGP plugin at https://github.com/axzae/unmeta-gradle-plugin

The plugin will only remove @DebugMetadata on release build. Removing @Metadata is causing build failure as it's needed during hiltJavaCompile compilation task