Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateEffectiveLombokConfig is not cached #549

Open
flocsy opened this issue Jun 14, 2022 · 12 comments
Open

generateEffectiveLombokConfig is not cached #549

flocsy opened this issue Jun 14, 2022 · 12 comments

Comments

@flocsy
Copy link

flocsy commented Jun 14, 2022

When I run gradle build and then without any changes in the code I run gradle build again then all the generateEffectiveLombokConfig tasks are run again even though the code hasn't change. IMHO generateEffectiveLombokConfig should be cached and it should only run again if there was a change in the code. (I'm using 6.4.3)

@larsgrefer
Copy link
Member

Please have a look at #525 (comment)

@mjaggard
Copy link

mjaggard commented Sep 16, 2022

@larsgrefer
6314b6d
This commit doesn't completely solve the problem for me. After this commit if I make zero changes to my source at all then I get

Task :api-v1:generateEffectiveLombokConfig UP-TO-DATE

but if I make any changes at all to any files - not to config then I get

Task :api-v1:generateEffectiveLombokConfig

and my entire source is recompiled.

This is better than the previous situation (always recompiling everything) but not ideal because if the config hasn't changed then the generateEffectiveLombokConfig should be UP-TO-DATE already and not invalidate the java compile.

@mjaggard
Copy link

Task ':api-v1:generateEffectiveLombokConfig' is not up-to-date because:
Input property 'paths' file /path/to/MyClassName.java has changed.

@larsgrefer
Copy link
Member

larsgrefer commented Sep 16, 2022

Thats a good point. For the up-to-date check here, I don't care about the contents of your java classes, just where they are.

I'll have a look at this.

@larsgrefer larsgrefer reopened this Sep 16, 2022
@mjaggard
Copy link

I'm not sure I fully understand, but doesn't the effective Lombok config only depend on files called lombok.config and those imported by it? I'd assumed that no java classes needed to be used at all?

@larsgrefer
Copy link
Member

I'm not sure I fully understand, but doesn't the effective Lombok config only depend on files called lombok.config and those imported by it? I'd assumed that no java classes needed to be used at all?

Thats correct. Given your example path of /path/to/MyClassName.java Lombok would look for these files at first:

  • /path/to/lombok.config
  • /path/lombok.config
  • /lombok.config

It traverses the file system upwards, starting at the java source file. That's why the location of the java sources is important. The content of the source files is not needed.

@mjaggard
Copy link

Oh, of course sorry. I forgot that Lombok configuration can be per directory. Thank you.

@jenni
Copy link

jenni commented Nov 15, 2022

+1 , using gradle-7.5.1

@mjaggard
Copy link

+1 , using gradle-7.5.1

This has been fixed but not released. Locally I'm currently running the main branch as my plugin by installing the plugin into maven local and then referencing that in my project build instead of a release.

It's annoying having to keep merging my local changes in git though and I can't commit it because the build machine doesn't have this plugin snapshot.

@kancsuki
Copy link

kancsuki commented Aug 8, 2023

Is it possible to include this change in the next version of the plugin?

@larsgrefer
Copy link
Member

@kancsuki This should already be released for some time now

@mmoayyed
Copy link

mmoayyed commented Jan 4, 2024

Hello, am I correct in stating that based on #525 (comment), the LombokConfig task cannot be cacheable?

Running with plugin version 8.4 and Gradle 8.5, I see that the generateTestEffectiveLombokConfig is run multiple times on each build run. Gradle's build scan reports the following:

The task was not up-to-date because of the following reasons: 
Output property 'outputFile' file webapp/cas-server-webapp-tomcat/build/lombok/effective-config/lombok-test.config has been removed.

In this scenario, there exists only one lombok.config file found at the root of the project:
https://github.com/apereo/cas/blob/master/lombok.config

While the task typically executes very quickly, in some cases it can take up to 31 seconds or so. Could this task be made cacheable as pointed out here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants