Cleaned up OutputDir and OutputDirFunctions.

This commit is contained in:
JesseBrault0709 2023-04-25 20:46:02 +02:00
parent 8b5bf93822
commit accf9d6d05
3 changed files with 4 additions and 11 deletions

View File

@ -6,10 +6,6 @@ import org.jetbrains.annotations.Nullable
@EqualsAndHashCode @EqualsAndHashCode
final class OutputDir { final class OutputDir {
static OutputDir concat(OutputDir od0, OutputDir od1) {
new OutputDir(od1.path ? od1.path : od0.path)
}
@Nullable @Nullable
final String path final String path
@ -25,8 +21,4 @@ final class OutputDir {
this.path ? new File(this.path) : new File('') this.path ? new File(this.path) : new File('')
} }
OutputDir plus(OutputDir other) {
concat(this, other)
}
} }

View File

@ -2,6 +2,7 @@ package com.jessebrault.ssg.buildscript
import groovy.transform.stc.ClosureParams import groovy.transform.stc.ClosureParams
import groovy.transform.stc.SimpleType import groovy.transform.stc.SimpleType
import org.jetbrains.annotations.Nullable
import java.util.function.Function import java.util.function.Function
@ -27,7 +28,7 @@ final class OutputDirFunctions {
of { new OutputDir(dir) } of { new OutputDir(dir) }
} }
static Function<Build, OutputDir> of(String path) { static Function<Build, OutputDir> of(@Nullable String path) {
of { new OutputDir(path) } of { new OutputDir(path) }
} }

View File

@ -28,11 +28,11 @@ final class BuildDelegate extends AbstractBuildDelegate<Build> {
} }
void setOutputDir(File file) { void setOutputDir(File file) {
this.outputDirFunction = { new OutputDir(file) } this.outputDirFunction = OutputDirFunctions.of(file)
} }
void setOutputDir(@Nullable String path) { void setOutputDir(@Nullable String path) {
this.outputDirFunction = { new OutputDir(path) } this.outputDirFunction = OutputDirFunctions.of(path)
} }
} }