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

Gradle plugin: use PatternSet instead of FileCollection for inputs #1118

Merged
merged 11 commits into from
Nov 17, 2021

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Nov 11, 2021

What's done:

  • Changed logic
  • Changed examples
  • Changed tests
  • Added proper annotations for some properties inside gradle plugin (resulting in 'automatic' NO_SOURCE statuses wen provided patterns don't match anything)
  • Fix deprecation warnings in diktat-gradle-plugin/build.gradle.kts

This PR proposes a more convenient API for configuring inputs for gradle task. See #1026 , #1094

### What's done:
* Changed logic
* Changed examples
* Changed tests
### What's done:
* Refactor build_and_test.yml
@petertrr petertrr force-pushed the feature/gradle-pluin-inputs branch 2 times, most recently from 32a1d5c to 67fec1b Compare November 11, 2021 13:48
@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #1118 (6266f96) into master (0451db5) will decrease coverage by 0.00%.
The diff coverage is 94.11%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1118      +/-   ##
============================================
- Coverage     83.43%   83.42%   -0.01%     
+ Complexity     2483     2479       -4     
============================================
  Files           102      102              
  Lines          6241     6250       +9     
  Branches       1867     1868       +1     
============================================
+ Hits           5207     5214       +7     
- Misses          275      276       +1     
- Partials        759      760       +1     
Flag Coverage Δ
unittests 83.42% <94.11%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...qfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt 86.90% <90.47%> (-1.56%) ⬇️
...n/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt 100.00% <100.00%> (ø)
...rg/cqfn/diktat/plugin/gradle/DiktatGradlePlugin.kt 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0451db5...6266f96. Read the comment docs.

### What's done:
* Remove `useIR`, because for kotlin 1.5.x it does nothing and IR is used anyway
@petertrr petertrr marked this pull request as ready for review November 11, 2021 15:22
with(diktatExtension) {
// validate configuration
require(inputs == null && excludes == null) {
"`inputs` and `excludes` for diktat should be changed for inputs(Action)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"inputs and excludes arguments for diktat task are deprecated and now should be changed for inputs(Action). Please check the Readme.md for more info"

### What's done:
* Fix description
* Fix codecov link in README.md
@@ -110,7 +117,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a duplicated execution on ubuntu: main job (build and test and upload codecov) is basically the same, but also with codecov. So there is no need for a separate build_and_test on ubuntu

@orchestr7
Copy link
Member

Have you found out why tests did not catch this?

@petertrr
Copy link
Member Author

petertrr commented Nov 16, 2021

Have you found out why tests did not catch this?

The logic itself was actually correct - we were running ktlint with expected patterns. However, they must've broken something with pattern matching on windows. In our tests we were comparing command line (where patterns were correct), and in functional tests we are excluding files by specific names instead of wildcards only.

Edit: we had a test with wildcard based excludes. I think, include didn't work properly on Windows, so no files were checked. @akuleshov7 , I've added a new source file into examples, so that now in tests for excludes there is one included and one excluded file.

@petertrr petertrr merged commit 91708c9 into master Nov 17, 2021
@petertrr petertrr deleted the feature/gradle-pluin-inputs branch November 17, 2021 09:06
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

Successfully merging this pull request may close these issues.

3 participants