This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Improve exclude rules #8
Merged
takecare
merged 6 commits into
master
from
feature/PT-311/PT-313_exclude_file_collections
Nov 14, 2016
Merged
Improve exclude rules #8
takecare
merged 6 commits into
master
from
feature/PT-311/PT-313_exclude_file_collections
Nov 14, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frapontillo
approved these changes
Nov 12, 2016
} else if (exclude instanceof FileCollection) { | ||
apply(task, exclude) | ||
} else if (exclude instanceof Iterable<File>) { | ||
apply(task, exclude.inject(null, accumulateIntoTree()) as FileTree) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is inject
some kind of fold
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep. why inject
instead of fold
or the more popular reduce
is beyond me :/
} | ||
|
||
private def accumulateIntoTree() { | ||
return { tree, file -> tree?.plus(project.fileTree(file)) ?: project.fileTree(file) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAX so much
takecare
approved these changes
Nov 14, 2016
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😲
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope of the PR
While integrating v0.1 of the plugin in one of our projects we realised that the
exclude
directive in the plugin extension is only supporting file patterns, but there is no way to specify an entire source set for instance.Considerations/Implementation Details
Introduced
SourceFilter
as thin delegate holding all the exclude rules to be applied to a specificSourceTask
. File patterns are supported as well asFile
s or collections of them, eg:Testing
SourceFilter
is fully tested to cover all the scenarios above. A bunch of integration tests have been added for each configurator to validate theexclude
functionality in both Java and Android projects.