Change back to our deleteRecursive utility instead of Kotlin's new built in one
Also, all the experimental path api we were using is stable now, so remove the opt-in flag
This commit is contained in:
parent
87e8db20d0
commit
7669316eac
23 changed files with 39 additions and 42 deletions
|
@ -58,10 +58,7 @@ testing {
|
|||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
freeCompilerArgs = listOf(
|
||||
"-Xjvm-default=all",
|
||||
"-opt-in=kotlin.io.path.ExperimentalPathApi"
|
||||
)
|
||||
freeCompilerArgs = listOf("-Xjvm-default=all")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class ApplyCraftBukkitPatches : ControllableOutputTask() {
|
|||
fun run() {
|
||||
Git.checkForGit()
|
||||
|
||||
outputDir.path.deleteRecursively()
|
||||
outputDir.path.deleteRecursive()
|
||||
outputDir.path.parent.let {
|
||||
it.createDirectories()
|
||||
val git = Git(it)
|
||||
|
@ -92,7 +92,7 @@ abstract class ApplyCraftBukkitPatches : ControllableOutputTask() {
|
|||
val git = Git(outputDir.path)
|
||||
|
||||
val basePatchDirFile = outputDir.path.resolve("src/main/java")
|
||||
basePatchDirFile.resolve(cleanDirPath.get()).deleteRecursively()
|
||||
basePatchDirFile.resolve(cleanDirPath.get()).deleteRecursive()
|
||||
|
||||
val patchSource = patchDir.pathOrNull ?: patchZip.path // used for error messages
|
||||
val rootPatchDir = patchDir.pathOrNull ?: patchZip.path.let { unzip(it, findOutputDir(it)) }
|
||||
|
@ -138,7 +138,7 @@ abstract class ApplyCraftBukkitPatches : ControllableOutputTask() {
|
|||
git("commit", "-m", "CraftBukkit $ ${Date()}", "--author=CraftBukkit <auto@mated.null>").setupOut().execute()
|
||||
} finally {
|
||||
if (rootPatchDir != patchDir.pathOrNull) {
|
||||
rootPatchDir.deleteRecursively()
|
||||
rootPatchDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ abstract class ApplyGitPatches : ControllableOutputTask() {
|
|||
checkoutRepoFromUpstream(git, upstream.path, upstreamBranch.get())
|
||||
|
||||
if (unneededFiles.isPresent && unneededFiles.get().size > 0) {
|
||||
unneededFiles.get().forEach { path -> outputDir.path.resolve(path).deleteRecursively() }
|
||||
unneededFiles.get().forEach { path -> outputDir.path.resolve(path).deleteRecursive() }
|
||||
git(*Git.add(ignoreGitIgnore, ".")).setupOut().run()
|
||||
git("commit", "-m", "Initial", "--author=Initial Source <auto@mated.null>").setupOut().run()
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ abstract class ApplyGitPatches : ControllableOutputTask() {
|
|||
}
|
||||
} finally {
|
||||
if (rootPatchDir != patchDir.pathOrNull) {
|
||||
rootPatchDir.deleteRecursively()
|
||||
rootPatchDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ fun ControllableOutputTask.applyGitPatches(
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
tempDir.deleteRecursively()
|
||||
tempDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ fun recreateCloneDirectory(target: Path) {
|
|||
git("reset", "--hard", "HEAD").runSilently(silenceErr = true)
|
||||
} else {
|
||||
for (entry in target.listDirectoryEntries()) {
|
||||
entry.deleteRecursively()
|
||||
entry.deleteRecursive()
|
||||
}
|
||||
target.createDirectories()
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ abstract class ApplyPaperPatches : ControllableOutputTask() {
|
|||
git("mv", "-f", obfFile.toString(), deobfFile.toString()).runSilently(silenceErr = true)
|
||||
}
|
||||
|
||||
unneededFiles.orNull?.forEach { path -> outputFile.resolve(path).deleteRecursively() }
|
||||
unneededFiles.orNull?.forEach { path -> outputFile.resolve(path).deleteRecursive() }
|
||||
|
||||
git(*Git.add(ignoreGitIgnore, ".")).executeSilently()
|
||||
git("commit", "-m", "Initial", "--author=Initial Source <auto@mated.null>").executeSilently()
|
||||
|
@ -168,7 +168,7 @@ abstract class ApplyPaperPatches : ControllableOutputTask() {
|
|||
}
|
||||
|
||||
private fun createDir(dir: Path): Path {
|
||||
dir.deleteRecursively()
|
||||
dir.deleteRecursive()
|
||||
dir.createDirectories()
|
||||
return dir
|
||||
}
|
||||
|
|
|
@ -68,6 +68,6 @@ abstract class CopyResources : BaseTask() {
|
|||
}
|
||||
|
||||
zip(target, outputJar)
|
||||
target.deleteRecursively()
|
||||
target.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ abstract class CreateDiffOutput : BaseTask() {
|
|||
fun run() {
|
||||
val output = outputDir.path
|
||||
|
||||
output.deleteRecursively()
|
||||
output.deleteRecursive()
|
||||
inputDir.path.copyRecursivelyTo(output)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ object ServerBundler {
|
|||
}
|
||||
|
||||
private fun extractLibraryJars(bundlerZip: Path, serverLibraryJars: Path) {
|
||||
serverLibraryJars.deleteRecursively()
|
||||
serverLibraryJars.deleteRecursive()
|
||||
serverLibraryJars.parent.createDirectories()
|
||||
bundlerZip.resolve("/META-INF/libraries").copyRecursivelyTo(serverLibraryJars)
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ abstract class FilterProjectDir : BaseTask() {
|
|||
}
|
||||
|
||||
zip(target, output)
|
||||
target.deleteRecursively()
|
||||
target.deleteRecursive()
|
||||
}
|
||||
|
||||
private fun collectFiles(dir: Path): Set<String> {
|
||||
|
|
|
@ -170,13 +170,13 @@ abstract class GenerateDevBundle : DefaultTask() {
|
|||
tempPatchDir.copyRecursivelyTo(patchesZip)
|
||||
}
|
||||
} finally {
|
||||
tempPatchDir.deleteRecursively()
|
||||
tempPatchDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
||||
private fun generatePatches(output: Path) {
|
||||
val workingDir = layout.cache.resolve(paperTaskOutput("tmpdir"))
|
||||
workingDir.deleteRecursively()
|
||||
workingDir.deleteRecursive()
|
||||
workingDir.createDirectories()
|
||||
sourceDir.path.copyRecursivelyTo(workingDir)
|
||||
|
||||
|
@ -211,7 +211,7 @@ abstract class GenerateDevBundle : DefaultTask() {
|
|||
}
|
||||
}
|
||||
|
||||
workingDir.deleteRecursively()
|
||||
workingDir.deleteRecursive()
|
||||
}
|
||||
|
||||
private fun relocate(relocations: List<Relocation>, workingDir: Path) {
|
||||
|
@ -289,7 +289,7 @@ abstract class GenerateDevBundle : DefaultTask() {
|
|||
|
||||
return runDiff(dir, args)
|
||||
} finally {
|
||||
dir.deleteRecursively()
|
||||
dir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ abstract class RebuildGitPatches : ControllableOutputTask() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
patchFolder.deleteRecursively()
|
||||
patchFolder.deleteRecursive()
|
||||
patchFolder.createDirectories()
|
||||
}
|
||||
|
||||
|
|
|
@ -169,8 +169,8 @@ abstract class RemapSources : JavaLauncherTask() {
|
|||
|
||||
writeSpigotRecompiledFiles(srcOut)
|
||||
} finally {
|
||||
srcOut.deleteRecursively()
|
||||
testOut.deleteRecursively()
|
||||
srcOut.deleteRecursive()
|
||||
testOut.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ abstract class RemapSources : JavaLauncherTask() {
|
|||
tempOut.copyRecursivelyTo(parameters.outputDir.path)
|
||||
}
|
||||
} finally {
|
||||
tempOut.deleteRecursively()
|
||||
tempOut.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ abstract class SpigotDecompileJar : JavaLauncherTask() {
|
|||
ensureDeleted(outputJarFile)
|
||||
decomp.resolve(inputJarFile.name).moveTo(outputJarFile)
|
||||
} finally {
|
||||
decomp.deleteRecursively()
|
||||
decomp.deleteRecursive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ abstract class ZippedTask : BaseTask() {
|
|||
|
||||
zip(outputDir, outputZipFile)
|
||||
} finally {
|
||||
outputDir.deleteRecursively()
|
||||
outputDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ fun downloadMinecraftLibraries(
|
|||
sources: Boolean
|
||||
): WorkQueue {
|
||||
val excludes = listOf(targetDir.fileSystem.getPathMatcher("glob:*.etag"))
|
||||
targetDir.deleteRecursively(excludes)
|
||||
targetDir.deleteRecursive(excludes)
|
||||
|
||||
val queue = workerExecutor.noIsolation()
|
||||
|
||||
|
@ -175,11 +175,11 @@ abstract class DownloadSpigotDependencies : BaseTask() {
|
|||
|
||||
val out = outputDir.path
|
||||
val excludes = listOf(out.fileSystem.getPathMatcher("glob:*.etag"))
|
||||
out.deleteRecursively(excludes)
|
||||
out.deleteRecursive(excludes)
|
||||
|
||||
val outSources = outputSourcesDir.path
|
||||
val excludesSources = listOf(outSources.fileSystem.getPathMatcher("glob:*.etag"))
|
||||
outSources.deleteRecursively(excludesSources)
|
||||
outSources.deleteRecursive(excludesSources)
|
||||
|
||||
val spigotRepos = mutableSetOf<String>()
|
||||
spigotRepos += apiSetup.repos
|
||||
|
|
|
@ -99,7 +99,7 @@ class PatchApplier(
|
|||
}
|
||||
|
||||
fun generatePatches(target: Path) {
|
||||
target.deleteRecursively()
|
||||
target.deleteRecursive()
|
||||
target.createDirectories()
|
||||
git("checkout", remappedBranch).executeSilently()
|
||||
git(
|
||||
|
|
|
@ -66,13 +66,13 @@ class PatchSourceRemapWorker(
|
|||
}
|
||||
|
||||
private fun setup() {
|
||||
outputDir.deleteRecursively()
|
||||
outputDir.deleteRecursive()
|
||||
outputDir.createDirectories()
|
||||
}
|
||||
|
||||
private fun cleanup() {
|
||||
inputDir.deleteRecursively()
|
||||
inputDir.deleteRecursive()
|
||||
outputDir.moveTo(inputDir)
|
||||
outputDir.deleteRecursively()
|
||||
outputDir.deleteRecursive()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ abstract class RemapPatches : BaseTask() {
|
|||
private fun createWorkDir(name: String, source: Path? = null, recreate: Boolean = true): Path {
|
||||
return layout.cache.resolve("paperweight").resolve(name).apply {
|
||||
if (recreate) {
|
||||
deleteRecursively()
|
||||
deleteRecursive()
|
||||
createDirectories()
|
||||
source?.copyRecursivelyTo(this)
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ abstract class RemapPatches : BaseTask() {
|
|||
val workDir = layout.cache.resolve("paperweight")
|
||||
return workDir.resolve(name).apply {
|
||||
if (recreate) {
|
||||
deleteRecursively()
|
||||
deleteRecursive()
|
||||
createDirectories()
|
||||
Git(workDir)("clone", source.absolutePathString(), this.absolutePathString()).executeSilently()
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ fun Path.deleteForcefully() {
|
|||
deleteIfExists()
|
||||
}
|
||||
|
||||
fun Path.deleteRecursively(excludes: Iterable<PathMatcher> = emptyList()) {
|
||||
fun Path.deleteRecursive(excludes: Iterable<PathMatcher> = emptyList()) {
|
||||
if (!exists()) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ fun ensureDeleted(vararg files: Any) {
|
|||
for (file in files) {
|
||||
val f = file.convertToPath()
|
||||
try {
|
||||
f.deleteRecursively()
|
||||
f.deleteRecursive()
|
||||
} catch (e: Exception) {
|
||||
throw PaperweightException("Failed to delete file or directory $f", e)
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class CheckoutRepo : DefaultTask() {
|
|||
val urlText = url.get().trim()
|
||||
|
||||
if (dir.resolve(".git").notExists()) {
|
||||
dir.deleteRecursively()
|
||||
dir.deleteRecursive()
|
||||
dir.createDirectories()
|
||||
|
||||
Git(dir)("init", "--quiet").executeSilently()
|
||||
|
|
|
@ -117,7 +117,7 @@ abstract class PatcherApplyGitPatches : ControllableOutputTask() {
|
|||
|
||||
if (bareDirectory.get()) {
|
||||
val up = upstreamDir.path
|
||||
up.resolve(".git").deleteRecursively()
|
||||
up.resolve(".git").deleteRecursive()
|
||||
Git(up).let { upstreamGit ->
|
||||
upstreamGit("init", "--quiet").executeSilently(silenceErr = true)
|
||||
upstreamGit("checkout", "-b", upstreamBranch.get()).executeSilently(silenceErr = true)
|
||||
|
|
|
@ -57,7 +57,7 @@ fun extractDevBundle(
|
|||
if (currentDevBundleHash.isNotBlank() && newDevBundleHash == currentDevBundleHash) {
|
||||
return ExtractedBundle(false, readDevBundle(destinationDirectory), destinationDirectory)
|
||||
}
|
||||
destinationDirectory.deleteRecursively()
|
||||
destinationDirectory.deleteRecursive()
|
||||
}
|
||||
destinationDirectory.createDirectories()
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ fun cleanSharedCaches(target: Project, root: Path) {
|
|||
.toList()
|
||||
}
|
||||
for (path in toDelete) {
|
||||
path.deleteRecursively()
|
||||
path.deleteRecursive()
|
||||
|
||||
// clean up empty parent directories
|
||||
var parent: Path = path.parent
|
||||
|
|
Loading…
Reference in a new issue