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

Configuration Cache does not persist int #16657

Closed
aaschmid opened this issue Mar 27, 2021 · 6 comments · Fixed by #16680
Closed

Configuration Cache does not persist int #16657

aaschmid opened this issue Mar 27, 2021 · 6 comments · Fixed by #16680
Assignees

Comments

@aaschmid
Copy link
Contributor

aaschmid commented Mar 27, 2021

On my gradle-cpd-plugin I have a task property named minimumTokenCount which was of type int. Besides an other issue with new configuration-cache I get > Task 'cpdCheck' requires 'minimumTokenCount' to be greater than zero. on the second run if I use intfor the minimumTokenCount @Input property. Changing this to Integer makes the reproducer test case green again.

Expected Behavior

I would except that int property could be configuration cached as booleans does as well. Haven't found any documentation that it should not work.

Current Behavior

int properties cannot be used with configuration-cache.

Context

I try to enable my plugin to be usable with --configuration-cache, as requested in aaschmid/gradle-cpd-plugin#54.

Steps to Reproduce

  1. git clone git@github.com:aaschmid/gradle-cpd-plugin.git
  2. Checkout reproducer branch: git checkout reproduce.config.cache.problem.on.int
  3. Execute ./gradlew integTest --tests "de.aaschmid.gradle.plugins.cpd.test.CpdAcceptanceTest.Cpd task can be loaded from the configuration cache"
  4. Check for failure > Task 'cpdCheck' requires 'minimumTokenCount' to be greater than zero. on standard output of test results
  5. Change to Integer by git revert 0851999
  6. Execute the test again and see that it is working

Your Environment

@aaschmid
Copy link
Contributor Author

Meanwhile - thank to @C-Otto - I saw https://github.com/gradle/gradle/pull/14628/files#diff-239c622f1af32f1bee008aa813579ded9fffeb072f25557cf8eb27801268c770 where you changed int to Property<Integer>. Property was not necessary for me but if this would be the desired way forward, maybe documentation about this would be enough.

On the other side would supporting int increase backward compatibility. If you have a hint where a change would be necessary, maybe I can give it a shot.

@jjohannes jjohannes added the in:configuration-cache Configuration Caching label Mar 30, 2021
@bamboo bamboo self-assigned this Mar 30, 2021
@bamboo
Copy link
Member

bamboo commented Mar 30, 2021

Hi @aaschmid, could you confirm the latest Gradle version you have been able to reproduce this issue with?

@aaschmid
Copy link
Contributor Author

On the using side of the plugin I had the problem with 6.6, 6.7, and 7.0-RC1. On the building side - does that matter? - I used 6.6 only.

Should I test something in addition?

@bamboo
Copy link
Member

bamboo commented Mar 31, 2021

Thanks, @aaschmid. The building side shouldn't matter.

At first I cannot reproduce the problem with a simple test case so I wonder what else might be different in your plugin's case. Possibly the interaction with convention mapping setup by CpdPlugin. Let's see.

@aaschmid
Copy link
Contributor Author

Thanks for the update and your reproducer seems fine. But can you reproduce it with my reproducer?

@bamboo
Copy link
Member

bamboo commented Mar 31, 2021

Yes, I can reproduce the test failure you described.

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

Successfully merging a pull request may close this issue.

4 participants