Skip to content

Commit ad8196a

Browse files
committed
Format code
1 parent 49167c5 commit ad8196a

12 files changed

+187
-351
lines changed
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development;
183

194
import java.io.File;
@@ -32,6 +17,5 @@ static Optional<String> getExtension(File file) {
3217
return Optional.of(fileNameSegments[fileNameSegments.length - 1]);
3318
}
3419

35-
private FileUtils() {
36-
}
20+
private FileUtils() {}
3721
}

src/main/java/org/gradlex/maven/plugin/development/MavenPluginDevelopmentExtension.java

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development;
183

194
import org.gradle.api.artifacts.Configuration;
@@ -23,19 +8,19 @@ public interface MavenPluginDevelopmentExtension {
238

249
String NAME = "mavenPlugin";
2510

26-
Property<String> getGroupId();
11+
Property<String> getGroupId();
2712

28-
Property<String> getArtifactId();
13+
Property<String> getArtifactId();
2914

30-
Property<String> getVersion();
15+
Property<String> getVersion();
3116

32-
Property<String> getName();
17+
Property<String> getName();
3318

34-
Property<String> getDescription();
19+
Property<String> getDescription();
3520

36-
Property<String> getGoalPrefix();
21+
Property<String> getGoalPrefix();
3722

38-
Property<String> getHelpMojoPackage();
23+
Property<String> getHelpMojoPackage();
3924

4025
/**
4126
* The set of dependencies to add to the plugin descriptor.

src/main/java/org/gradlex/maven/plugin/development/MavenPluginDevelopmentPlugin.java

Lines changed: 111 additions & 96 deletions
Large diffs are not rendered by default.

src/main/java/org/gradlex/maven/plugin/development/internal/MavenLoggerAdapter.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.internal;
183

194
import org.gradle.api.logging.Logger;
205

21-
public final class MavenLoggerAdapter implements org.codehaus.plexus.logging.Logger, org.apache.maven.plugin.logging.Log {
6+
public final class MavenLoggerAdapter
7+
implements org.codehaus.plexus.logging.Logger, org.apache.maven.plugin.logging.Log {
228

239
private final Logger delegate;
2410

src/main/java/org/gradlex/maven/plugin/development/internal/MavenServiceFactory.java

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.internal;
183

4+
import java.lang.reflect.Field;
5+
import java.util.Collections;
6+
import java.util.HashMap;
7+
import java.util.Map;
198
import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
209
import org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor;
2110
import org.apache.maven.tools.plugin.extractor.annotations.converter.JavadocBlockTagsToXhtmlConverter;
@@ -25,11 +14,6 @@
2514
import org.apache.maven.tools.plugin.scanner.DefaultMojoScanner;
2615
import org.apache.maven.tools.plugin.scanner.MojoScanner;
2716

28-
import java.lang.reflect.Field;
29-
import java.util.Collections;
30-
import java.util.HashMap;
31-
import java.util.Map;
32-
3317
public final class MavenServiceFactory {
3418

3519
public static MojoScanner createMojoScanner(MavenLoggerAdapter loggerAdapter) {
@@ -51,12 +35,15 @@ private static MojoDescriptorExtractor annotationExtractor(MavenLoggerAdapter lo
5135

5236
setField(extractor, "mojoAnnotationsScanner", annotationsScanner);
5337

54-
// TODO this needs a map of tag converts, see the org.apache.maven.tools.plugin.extractor.annotations.converter.tag
38+
// TODO this needs a map of tag converts, see the
39+
// org.apache.maven.tools.plugin.extractor.annotations.converter.tag
5540
// in org.apache.maven.plugin-tools:maven-plugin-tools-annotations
56-
JavadocInlineTagsToXhtmlConverter javadocInlineTagsToHtmlConverter = new JavadocInlineTagsToXhtmlConverter(Collections.emptyMap());
41+
JavadocInlineTagsToXhtmlConverter javadocInlineTagsToHtmlConverter =
42+
new JavadocInlineTagsToXhtmlConverter(Collections.emptyMap());
5743
setField(extractor, "javadocInlineTagsToHtmlConverter", javadocInlineTagsToHtmlConverter);
5844

59-
JavadocBlockTagsToXhtmlConverter javadocBlockTagsToHtmlConverter = new JavadocBlockTagsToXhtmlConverter(javadocInlineTagsToHtmlConverter, Collections.emptyMap());
45+
JavadocBlockTagsToXhtmlConverter javadocBlockTagsToHtmlConverter =
46+
new JavadocBlockTagsToXhtmlConverter(javadocInlineTagsToHtmlConverter, Collections.emptyMap());
6047
setField(extractor, "javadocBlockTagsToHtmlConverter", javadocBlockTagsToHtmlConverter);
6148

6249
return extractor;

src/main/java/org/gradlex/maven/plugin/development/task/AbstractMavenPluginDevelopmentTask.java

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.task;
183

4+
import java.util.stream.Collectors;
5+
import javax.inject.Inject;
196
import org.apache.maven.plugin.descriptor.PluginDescriptor;
207
import org.apache.maven.project.MavenProject;
218
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
@@ -26,9 +13,6 @@
2613
import org.gradle.api.provider.Property;
2714
import org.gradle.api.tasks.Nested;
2815

29-
import javax.inject.Inject;
30-
import java.util.stream.Collectors;
31-
3216
public abstract class AbstractMavenPluginDevelopmentTask extends DefaultTask {
3317

3418
@Nested
@@ -50,18 +34,18 @@ protected PluginDescriptor createPluginDescriptor() {
5034
result.setGoalPrefix(
5135
pluginDescriptor.getGoalPrefix() != null
5236
? pluginDescriptor.getGoalPrefix()
53-
: PluginDescriptor.getGoalPrefixFromArtifactId(pluginDescriptor.getGav().getArtifactId())
54-
);
37+
: PluginDescriptor.getGoalPrefixFromArtifactId(
38+
pluginDescriptor.getGav().getArtifactId()));
5539
result.setName(pluginDescriptor.getName());
5640
result.setDescription(pluginDescriptor.getDescription());
5741
result.setDependencies(getRuntimeDependencies().get().stream()
58-
.map( DependencyDescriptor::toComponentDependency)
59-
.collect(Collectors.toList())
60-
);
42+
.map(DependencyDescriptor::toComponentDependency)
43+
.collect(Collectors.toList()));
6144
return result;
6245
}
6346

64-
protected PluginToolsRequest createPluginToolsRequest(MavenProject mavenProject, PluginDescriptor pluginDescriptor) {
47+
protected PluginToolsRequest createPluginToolsRequest(
48+
MavenProject mavenProject, PluginDescriptor pluginDescriptor) {
6549
DefaultPluginToolsRequest request = new DefaultPluginToolsRequest(mavenProject, pluginDescriptor);
6650
request.setSkipErrorNoDescriptorsFound(true);
6751
return request;

src/main/java/org/gradlex/maven/plugin/development/task/DependencyDescriptor.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.task;
183

194
import org.codehaus.plexus.component.repository.ComponentDependency;
@@ -50,4 +35,4 @@ public ComponentDependency toComponentDependency() {
5035
dep.setType(type);
5136
return dep;
5237
}
53-
}
38+
}

src/main/java/org/gradlex/maven/plugin/development/task/GAV.java

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.task;
183

19-
import org.gradle.api.tasks.Input;
20-
214
import java.util.Objects;
5+
import org.gradle.api.tasks.Input;
226

237
public final class GAV {
248

@@ -55,7 +39,9 @@ public String getVersion() {
5539
public boolean equals(Object o) {
5640
if (o == null || getClass() != o.getClass()) return false;
5741
GAV gav = (GAV) o;
58-
return Objects.equals(group, gav.group) && Objects.equals(artifactId, gav.artifactId) && Objects.equals(version, gav.version);
42+
return Objects.equals(group, gav.group)
43+
&& Objects.equals(artifactId, gav.artifactId)
44+
&& Objects.equals(version, gav.version);
5945
}
6046

6147
@Override
@@ -65,10 +51,9 @@ public int hashCode() {
6551

6652
@Override
6753
public String toString() {
68-
return "GAV{" +
69-
"group='" + group + '\'' +
70-
", name='" + artifactId + '\'' +
71-
", version='" + version + '\'' +
72-
'}';
54+
return "GAV{" + "group='"
55+
+ group + '\'' + ", name='"
56+
+ artifactId + '\'' + ", version='"
57+
+ version + '\'' + '}';
7358
}
7459
}

src/main/java/org/gradlex/maven/plugin/development/task/GenerateHelpMojoSourcesTask.java

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
1+
// SPDX-License-Identifier: Apache-2.0
172
package org.gradlex.maven.plugin.development.task;
183

4+
import java.io.File;
195
import org.apache.maven.model.Build;
206
import org.apache.maven.project.MavenProject;
217
import org.apache.maven.project.artifact.ProjectArtifact;
@@ -33,8 +19,6 @@
3319
import org.gradle.api.tasks.TaskAction;
3420
import org.gradlex.maven.plugin.development.internal.MavenLoggerAdapter;
3521

36-
import java.io.File;
37-
3822
@CacheableTask
3923
public abstract class GenerateHelpMojoSourcesTask extends AbstractMavenPluginDevelopmentTask {
4024

@@ -48,8 +32,6 @@ public abstract class GenerateHelpMojoSourcesTask extends AbstractMavenPluginDev
4832
@Input
4933
public abstract Property<String> getHelpMojoPackage();
5034

51-
52-
5335
private final MavenLoggerAdapter loggerAdapter = new MavenLoggerAdapter(getLogger());
5436

5537
@TaskAction
@@ -81,7 +63,8 @@ private MavenProject mavenProject() {
8163
}
8264

8365
private VelocityComponent createVelocityComponent() {
84-
// fix for broken debugging due to reflection happening inside Velocity (RuntimeInstance#initializeResourceManager())
66+
// fix for broken debugging due to reflection happening inside Velocity
67+
// (RuntimeInstance#initializeResourceManager())
8568
ClassLoader currentContextClassLoader = Thread.currentThread().getContextClassLoader();
8669
try {
8770
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
@@ -90,4 +73,4 @@ private VelocityComponent createVelocityComponent() {
9073
Thread.currentThread().setContextClassLoader(currentContextClassLoader);
9174
}
9275
}
93-
}
76+
}

0 commit comments

Comments
 (0)