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

Format build-tools and build-tools-internal #78910

Merged
merged 17 commits into from
Oct 14, 2021

Conversation

pugnascotia
Copy link
Contributor

@pugnascotia pugnascotia commented Oct 11, 2021

Our spotless configuration wasn't being applied to build-tools and build-tools-internal. Move the Spotless configuration to a Java plugin in build-conventions, and apply it everywhere.

This resulted in a lot more Java files being subject to formatting, so I added more exclusions to the list.

Also remove the paddedCell stuff, we've never needed it.

Our spotless configuration wasn't applied to these directories. This has
to happen from the root directory, otherwise any formatting errors makes
the project unbuildable.

Also remove the `paddedCell` stuff, we've never needed it.
@pugnascotia pugnascotia requested a review from breskeby October 11, 2021 09:32
@elasticmachine elasticmachine added the Team:Delivery Meta label for Delivery team label Oct 11, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

build.gradle Outdated Show resolved Hide resolved
// different copies of the formatted files, so that you can see how they
// differ and infer what is the problem.
// When applied to e.g. `:build-tools`, we need to modify the path to our config files
if (rootProject.file(importOrderPath).exists() == false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't feel ideal, any better ideas?

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 think it'd be better to move these config files to somewhere under build-conventions now.

Copy link
Contributor

Choose a reason for hiding this comment

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

good idea

Copy link
Contributor

Choose a reason for hiding this comment

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

build conventions is the right place imo for that stuff.

build.gradle Outdated Show resolved Hide resolved
@pugnascotia
Copy link
Contributor Author

@mark-vieira @breskeby this PR is now configuring formatter via a build-conventions plugin. PTAL.

Copy link
Contributor

@breskeby breskeby left a comment

Choose a reason for hiding this comment

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

just a minor request to handle precommit wiring better that I'd really would like to have instead of that hack. otherwise looks good to me. thanks for taking care of this

// different copies of the formatted files, so that you can see how they
// differ and infer what is the problem.
// When applied to e.g. `:build-tools`, we need to modify the path to our config files
if (rootProject.file(importOrderPath).exists() == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

good idea

build-conventions/build.gradle Outdated Show resolved Hide resolved
// different copies of the formatted files, so that you can see how they
// differ and infer what is the problem.
// When applied to e.g. `:build-tools`, we need to modify the path to our config files
if (rootProject.file(importOrderPath).exists() == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

build conventions is the right place imo for that stuff.

@pugnascotia
Copy link
Contributor Author

@breskeby I've converted the Groovy plugin to Java, and applied the precommit plugin. Everything looks good, apart from one thing - my reformat alias doesn't seem to be working. I didn't care enough to investigate so I took it out. Please take another look.

Copy link
Contributor

@breskeby breskeby left a comment

Choose a reason for hiding this comment

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

Nice!

@pugnascotia pugnascotia merged commit 62d2df4 into elastic:master Oct 14, 2021
@pugnascotia pugnascotia deleted the format-build-tools branch October 14, 2021 08:38
pugnascotia added a commit that referenced this pull request Oct 14, 2021
Our spotless configuration wasn't being applied to `build-tools`
and `build-tools-internal`. Move the Spotless configuration to a
Java plugin in `build-conventions`, and apply it everywhere.

This resulted in a lot more Java files being subject to formatting,
so I added more exclusions to the list.

Also remove the `paddedCell` stuff, we've never needed it.
@pugnascotia
Copy link
Contributor Author

Backported to 7.x in 562440a.

breskeby added a commit to breskeby/elasticsearch that referenced this pull request Oct 21, 2021
The spotless plugin applies the gradle base plugin which results in building
all artifacts in the bwc projects when just running build. This is not intended
and happened as part of work on elastic#78910

The correct fix is to not apply the base plugin in the spotless plugin IMO. We
will work on getting that fix upstream to the third party gradle plugin

Meanwhile we just ignore bwc projects for our formatting as they also have no
source available anyhow.
elasticsearchmachine pushed a commit that referenced this pull request Oct 21, 2021
The spotless plugin applies the gradle base plugin which results in
building all artifacts in the bwc projects when just running build. This
is not intended and happened as part of work on #78910 The correct fix
is to not apply the base plugin in the spotless plugin IMO. We will work
on getting that fix upstream to the third party gradle plugin Meanwhile
we just ignore bwc projects for our formatting as they also have no
source available anyhow. This fixes #79606 when backported to 7.x
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Oct 21, 2021
The spotless plugin applies the gradle base plugin which results in
building all artifacts in the bwc projects when just running build. This
is not intended and happened as part of work on elastic#78910 The correct fix
is to not apply the base plugin in the spotless plugin IMO. We will work
on getting that fix upstream to the third party gradle plugin Meanwhile
we just ignore bwc projects for our formatting as they also have no
source available anyhow. This fixes elastic#79606 when backported to 7.x
elasticsearchmachine pushed a commit that referenced this pull request Oct 21, 2021
The spotless plugin applies the gradle base plugin which results in
building all artifacts in the bwc projects when just running build. This
is not intended and happened as part of work on #78910 The correct fix
is to not apply the base plugin in the spotless plugin IMO. We will work
on getting that fix upstream to the third party gradle plugin Meanwhile
we just ignore bwc projects for our formatting as they also have no
source available anyhow. This fixes #79606 when backported to 7.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Tooling Developer tooliing and automation >enhancement Team:Delivery Meta label for Delivery team v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants