Replace "folder" with "directory"

Consistently use the term "directory" instead of "folder"

Closes gh-21218
This commit is contained in:
Phillip Webb
2020-04-28 18:27:41 -07:00
parent ec871d6752
commit ad1248e4ec
98 changed files with 853 additions and 835 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@@ -203,9 +203,9 @@ class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests {
@Test
void mergingOfAdditionalMetadata() throws Exception {
File metaInfFolder = new File(getCompiler().getOutputLocation(), "META-INF");
metaInfFolder.mkdirs();
File additionalMetadataFile = new File(metaInfFolder, "additional-spring-configuration-metadata.json");
File metaInfDirectory = new File(getCompiler().getOutputLocation(), "META-INF");
metaInfDirectory.mkdirs();
File additionalMetadataFile = new File(metaInfDirectory, "additional-spring-configuration-metadata.json");
additionalMetadataFile.createNewFile();
JSONObject property = new JSONObject();
property.put("name", "foo");
@@ -273,9 +273,9 @@ class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests {
}
private File createAdditionalMetadataFile() throws IOException {
File metaInfFolder = new File(getCompiler().getOutputLocation(), "META-INF");
metaInfFolder.mkdirs();
File additionalMetadataFile = new File(metaInfFolder, "additional-spring-configuration-metadata.json");
File metaInfDirectory = new File(getCompiler().getOutputLocation(), "META-INF");
metaInfDirectory.mkdirs();
File additionalMetadataFile = new File(metaInfDirectory, "additional-spring-configuration-metadata.json");
additionalMetadataFile.createNewFile();
return additionalMetadataFile;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@@ -56,19 +56,21 @@ public class TestProject {
* Contains copies of the original source so we can modify it safely to test
* incremental builds.
*/
private File sourceFolder;
private File sourceDirectory;
private TestCompiler compiler;
private Set<File> sourceFiles = new LinkedHashSet<>();
public TestProject(File tempFolder, Class<?>... classes) throws IOException {
this.sourceFolder = new File(tempFolder, "src");
this.compiler = new TestCompiler(new File(tempFolder, "build")) {
public TestProject(File tempDirectory, Class<?>... classes) throws IOException {
this.sourceDirectory = new File(tempDirectory, "src");
this.compiler = new TestCompiler(new File(tempDirectory, "build")) {
@Override
protected File getSourceFolder() {
return TestProject.this.sourceFolder;
protected File getSourceDirectory() {
return TestProject.this.sourceDirectory;
}
};
Set<Class<?>> contents = new HashSet<>(Arrays.asList(classes));
contents.addAll(Arrays.asList(ALWAYS_INCLUDE));
@@ -90,14 +92,14 @@ public class TestProject {
}
public File getSourceFile(Class<?> type) {
return new File(this.sourceFolder, TestCompiler.sourcePathFor(type));
return new File(this.sourceDirectory, TestCompiler.sourcePathFor(type));
}
public ConfigurationMetadata fullBuild() {
TestConfigurationMetadataAnnotationProcessor processor = new TestConfigurationMetadataAnnotationProcessor(
this.compiler.getOutputLocation());
TestCompilationTask task = this.compiler.getTask(this.sourceFiles);
deleteFolderContents(this.compiler.getOutputLocation());
deleteDirectoryContents(this.compiler.getOutputLocation());
task.call(processor);
return processor.getMetadata();
}
@@ -110,13 +112,13 @@ public class TestProject {
return processor.getMetadata();
}
private void deleteFolderContents(File outputFolder) {
FileSystemUtils.deleteRecursively(outputFolder);
outputFolder.mkdirs();
private void deleteDirectoryContents(File outputDirectory) {
FileSystemUtils.deleteRecursively(outputDirectory);
outputDirectory.mkdirs();
}
/**
* Retrieve File relative to project's output folder.
* Retrieve File relative to project's output directory.
* @param relativePath the relative path
* @return the output file
*/
@@ -183,7 +185,7 @@ public class TestProject {
* code.
*/
private File getOriginalSourceFile(Class<?> type) {
return new File(TestCompiler.SOURCE_FOLDER, TestCompiler.sourcePathFor(type));
return new File(TestCompiler.SOURCE_DIRECTORY, TestCompiler.sourcePathFor(type));
}
private static void putContents(File targetFile, String contents) throws IOException {