Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Generated Plugin source is not removed if precompiled script plugin is deleted #1306

Closed
cfraenkel opened this issue Jan 2, 2019 · 1 comment

Comments

@cfraenkel
Copy link

The generated plugin class in buildSrc/build/generated-sources/kotlin-dsl-plugins is not deleted when the corresponding *.gradle.kts source file is removed by the user. This generated plugin is still compiled and packaged and as a result causes a different build cache key compared to a build from a clean checkout after the script plugin removal was commited.

Expected Behavior

If I delete a precompiled script plugin (the *.gradle.kts file in the buildSrc/src/kotlin folder) then the corresponding automatically generated plugin class should be removed on the next build.

Current Behavior

The generated plugin class remains in the generated-sources/kotlin-dsl-plugins folder and is part of the build cache key (as it is on the classpath)

Context

  • our project gets built on developer machines and CI servers that push to a central build cache.
  • A script plugin was deleted by a developer and this change was commited.
  • Builds on developer machines still contained the generated plugin class while the ci machines did not contain them. This resulted in build cache misses for developers untill they cleaned their buildSrc/build folder.

Steps to Reproduce (for bugs)

  • use https://github.com/gradle/kotlin-dsl/blob/master/samples/project-with-buildSrc as a base
  • delete build.gradle.kts
  • build the project: gradlew build
  • verify that buildSrc\build\generated-sources\kotlin-dsl-plugins\kotlin\MyPluginPlugin.kt exists (expected, as the script plugin still exists)
  • delete kotlin-dsl/samples/project-with-buildSrc/buildSrc/src/main/kotlin/my-plugin.gradle.kts
  • build the project gradlew build
  • verify that buildSrc\build\generated-sources\kotlin-dsl-plugins\kotlin\MyPluginPlugin.kt still exists -> should have been removed (but isn't) as the corresponding script plugin was deleted

Your Environment

------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------

Build time:   2018-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987

Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_171 (Oracle Corporation 25.171-b11)
OS:           Windows 10 10.0 amd64
@eskatos
Copy link
Member

eskatos commented Jan 18, 2019

Thank you @cfraenkel for the very good report!
Fix in #1316

@eskatos eskatos closed this as completed Jan 18, 2019
@eskatos eskatos modified the milestones: 1.2.0, 1.1.2 Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants