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

Support multiple formats in Maven plugin #242

Merged
merged 2 commits into from
May 3, 2018

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented May 1, 2018

Format is a configuration element that makes it possible to apply generic formatting steps (EndWithNewline, LicenseHeader, etc.) to a set of files defined by custom includes and excludes. Example of format configuration:

<configuration>
  <format>
    <includes>
      <include>src/**/txt/**/*.txt</include>
    </includes>
    <excludes>
      <exclude>src/**/txt/**/*Wrong.txt</exclude>
    </excludes>
    <endWithNewline/>
    <trimTrailingWhitespace/>
    <licenseHeader>
      <content>// License Text</content>
      <delimiter>start</delimiter>
    </licenseHeader>
  </format>
</configuration>

It is currently possible to only define a single <format> element in plugin configuration.

This PR makes it possible to define multiple formats. Format configuration structure remains the same but all formats should be enclosed in <formats>...</formats>. Example:

<configuration>
  <formats>
    <format>...format 1 includes, excludes and steps</format>
    <format>...format 2 includes, excludes and steps</format>
    <format>...format 3 includes, excludes and steps</format>
  </formats>
</configuration>

</replaceRegex>
</format>

<!-- Other formats can be defined here, they will be allied in the order specified -->
Copy link
Contributor

Choose a reason for hiding this comment

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

applied?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @thc202! Fixed now

@nedtwigg
Copy link
Member

nedtwigg commented May 2, 2018

LGTM

Format is a configuration element that makes it possible to apply
generic formatting steps (EndWithNewline, LicenseHeader, etc.) to
a set of files defined by custom includes and excludes. Example of
format configuration:

```
<configuration>
  <format>
    <includes>
      <include>src/**/txt/**/*.txt</include>
    </includes>
    <excludes>
      <exclude>src/**/txt/**/*Wrong.txt</exclude>
    </excludes>
    <endWithNewline/>
    <trimTrailingWhitespace/>
    <licenseHeader>
      <content>// License Text</content>
      <delimiter>start</delimiter>
    </licenseHeader>
  </format>
</configuration>
```

It is currently possible to only define a single `<format>` element in
plugin configuration.

This commit makes it possible to define multiple formats. Format
configuration structure remains the same but all formats should be
enclosed in `<formats>...</formats>`. Example:

```
<configuration>
  <formats>
    <format>...format 1 includes, excludes and steps</format>
    <format>...format 2 includes, excludes and steps</format>
    <format>...format 3 includes, excludes and steps</format>
  </formats>
</configuration>
```
@lutovich lutovich merged commit e61bc71 into diffplug:master May 3, 2018
@lutovich lutovich deleted the mvn-multiple-formats branch May 3, 2018 14:10
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.

None yet

3 participants