Cleanup and format code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class BuildInfo extends DefaultTask {
|
||||
private String projectName = getProject().getName();
|
||||
|
||||
@Input
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
private Map<String, Object> additionalProperties = new HashMap<>();
|
||||
|
||||
@TaskAction
|
||||
public void generateBuildProperties() {
|
||||
@@ -127,7 +127,7 @@ public class BuildInfo extends DefaultTask {
|
||||
}
|
||||
|
||||
private Map<String, String> coerceToStringValues(Map<String, Object> input) {
|
||||
Map<String, String> output = new HashMap<String, String>();
|
||||
Map<String, String> output = new HashMap<>();
|
||||
for (Entry<String, Object> entry : input.entrySet()) {
|
||||
output.put(entry.getKey(), entry.getValue().toString());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class ProjectLibraries implements Libraries {
|
||||
if (configuration == null) {
|
||||
return null;
|
||||
}
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<>();
|
||||
for (ResolvedArtifact artifact : configuration.getResolvedConfiguration()
|
||||
.getResolvedArtifacts()) {
|
||||
libraries.add(new ResolvedArtifactLibrary(artifact, scope));
|
||||
@@ -130,7 +130,7 @@ class ProjectLibraries implements Libraries {
|
||||
|
||||
private Set<GradleLibrary> getLibrariesForFileDependencies(
|
||||
Configuration configuration, LibraryScope scope) {
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<>();
|
||||
for (Dependency dependency : configuration.getIncoming().getDependencies()) {
|
||||
if (dependency instanceof FileCollectionDependency) {
|
||||
FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
|
||||
@@ -156,11 +156,11 @@ class ProjectLibraries implements Libraries {
|
||||
if (source == null || toRemove == null) {
|
||||
return source;
|
||||
}
|
||||
Set<File> filesToRemove = new HashSet<File>();
|
||||
Set<File> filesToRemove = new HashSet<>();
|
||||
for (GradleLibrary library : toRemove) {
|
||||
filesToRemove.add(library.getFile());
|
||||
}
|
||||
Set<GradleLibrary> result = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> result = new LinkedHashSet<>();
|
||||
for (GradleLibrary library : source) {
|
||||
if (!filesToRemove.contains(library.getFile())) {
|
||||
result.add(library);
|
||||
@@ -195,8 +195,8 @@ class ProjectLibraries implements Libraries {
|
||||
}
|
||||
|
||||
private Set<String> getDuplicates(Set<GradleLibrary> libraries) {
|
||||
Set<String> duplicates = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> duplicates = new HashSet<>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
for (GradleLibrary library : libraries) {
|
||||
if (library.getFile() != null && !seen.add(library.getFile().getName())) {
|
||||
duplicates.add(library.getFile().getName());
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RepackageTask extends DefaultTask {
|
||||
private boolean isTaskMatch(Jar task, Object withJarTask) {
|
||||
if (withJarTask == null) {
|
||||
if ("".equals(task.getClassifier())) {
|
||||
Set<Object> tasksWithCustomRepackaging = new HashSet<Object>();
|
||||
Set<Object> tasksWithCustomRepackaging = new HashSet<>();
|
||||
for (RepackageTask repackageTask : RepackageTask.this.getProject()
|
||||
.getTasks().withType(RepackageTask.class)) {
|
||||
if (repackageTask.getWithJarTask() != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,11 +67,11 @@ public class BootRunTask extends JavaExec {
|
||||
SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject());
|
||||
final File outputDir = (mainSourceSet == null ? null
|
||||
: mainSourceSet.getOutput().getResourcesDir());
|
||||
final Set<File> resources = new LinkedHashSet<File>();
|
||||
final Set<File> resources = new LinkedHashSet<>();
|
||||
if (mainSourceSet != null) {
|
||||
resources.addAll(mainSourceSet.getResources().getSrcDirs());
|
||||
}
|
||||
List<File> classPath = new ArrayList<File>(getClasspath().getFiles());
|
||||
List<File> classPath = new ArrayList<>(getClasspath().getFiles());
|
||||
classPath.addAll(0, resources);
|
||||
getLogger().info("Adding classpath: " + resources);
|
||||
setClasspath(new SimpleFileCollection(classPath));
|
||||
|
||||
Reference in New Issue
Block a user