Skip to content

convert FilePermissionsTask.groovy to .java #34674

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

Merged
merged 12 commits into from
Oct 29, 2018
Merged

convert FilePermissionsTask.groovy to .java #34674

merged 12 commits into from
Oct 29, 2018

Conversation

vboulaye
Copy link
Contributor

related to #34459, convert the FilePermissionsTask.groovy to java

@jasontedor jasontedor requested review from alpar-t and rjernst October 21, 2018 20:02
@jasontedor jasontedor added the :Delivery/Build Build or test infrastructure label Oct 21, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jasontedor
Copy link
Member

@elasticmachine test this please

@alpar-t
Copy link
Contributor

alpar-t commented Oct 22, 2018

@vboulaye looks like CI uncovered checkstyle rules.

23:14:09 [ant:checkstyle] [ERROR] /var/lib/jenkins/workspace/elastic+elasticsearch+pull-request/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/FilePermissionsTask.java:35: Using the '.*' form of import should be avoided - org.gradle.api.tasks.*. [AvoidStarImport]

1 similar comment
@alpar-t
Copy link
Contributor

alpar-t commented Oct 22, 2018

@vboulaye looks like CI uncovered checkstyle rules.

23:14:09 [ant:checkstyle] [ERROR] /var/lib/jenkins/workspace/elastic+elasticsearch+pull-request/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/FilePermissionsTask.java:35: Using the '.*' form of import should be avoided - org.gradle.api.tasks.*. [AvoidStarImport]

@alpar-t
Copy link
Contributor

alpar-t commented Oct 22, 2018

@elasticmachine test this please

Copy link
Contributor

@alpar-t alpar-t left a comment

Choose a reason for hiding this comment

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

Thanks @vboulaye! Left a few comments.

@alpar-t
Copy link
Contributor

alpar-t commented Oct 23, 2018

@elasticmachine test this please

return outputMarker;
}

public void setOutputMarker(File outputMarker) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this to be configurable, it can be considered an implementation detail.
Sorry, I missed this in my earlier review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dropped it, and found out that I needed to create the missing parent folders (my previous test used an output file at the root of the TemporaryFolder). I added a .mkdirs() in the Task.

SourceSetContainer sourceSets = getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();
return getProject().files(sourceSets.stream()
.map(sourceSet -> sourceSet.getAllSource().matching(filesFilter))
.toArray());
Copy link
Contributor

Choose a reason for hiding this comment

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

FileTree extends FileCollection, so neither getProject().files( nor .toArray() are necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I do not know the API that well...
I tried to fix this but I am not sure how to handle the case when no source matches? (I do not like the .orElse(null))

Copy link
Contributor

Choose a reason for hiding this comment

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

The .orElse(null) worked in the unit tests but wouldn't have worked in an integration test as the method is annotated as input and thus can't return null. I took the liberty to push a fix for this.

@alpar-t
Copy link
Contributor

alpar-t commented Oct 24, 2018

@elasticmachine ok to test

@alpar-t alpar-t merged commit 3ef1fa5 into elastic:master Oct 29, 2018
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants