Cleaned up OutputDir and OutputDirFunctions.
This commit is contained in:
parent
8b5bf93822
commit
accf9d6d05
@ -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)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user