Skip to content

Commit

Permalink
Improves documentation and usage (#2038)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Feb 13, 2024
2 parents d026161 + 7f04707 commit 224f8f9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
```
spotless {
java {
eclipse().withP2Mirrors(['https://download.eclipse.org/', 'https://some.internal.mirror/eclipse'])
eclipse().withP2Mirrors(['https://download.eclipse.org/': 'https://some.internal.mirror/eclipse'])
}
}
```
Expand Down
4 changes: 4 additions & 0 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ spotless {
eclipse()
// optional: you can specify a specific version and/or config file
eclipse('4.26').configFile('eclipse-prefs.xml')
// if the access to the p2 repositories is restricted, mirrors can be
// specified using a URI prefix map as follows:
echlise().withP2Mirrors(['https://download.eclipse.org/eclipse/updates/4.29/':'https://some.internal.mirror/4-29-updates-p2/'])
```


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 DiffPlug
* Copyright 2023-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,11 +64,12 @@ private GrEclipseConfig(String version, FormatExtension extension) {
extension.addStep(builder.build());
}

public void configFile(Object... configFiles) {
public GrEclipseConfig configFile(Object... configFiles) {
requireElementsNonNull(configFiles);
Project project = extension.getProject();
builder.setPreferences(project.files(configFiles).getFiles());
extension.replaceStep(builder.build());
return this;
}

public GrEclipseConfig withP2Mirrors(Map<String, String> mirrors) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,11 +52,12 @@ public class EclipseConfig {
addStep(builder.build());
}

public void configFile(Object... configFiles) {
public EclipseConfig configFile(Object... configFiles) {
requireElementsNonNull(configFiles);
Project project = getProject();
builder.setPreferences(project.files(configFiles).getFiles());
replaceStep(builder.build());
return this;
}

public EclipseConfig withP2Mirrors(Map<String, String> mirrors) {
Expand Down

0 comments on commit 224f8f9

Please sign in to comment.