Skip to content

Commit

Permalink
Fix @tempdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Oct 6, 2024
1 parent edb91a1 commit e25146d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.github.jengelman.gradle.plugins.shadow.util.PluginSpecification
import org.apache.commons.io.FileUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.TaskOutcome
import org.junit.jupiter.api.io.TempDir
import spock.lang.TempDir

import java.nio.file.Path

Expand Down Expand Up @@ -42,7 +42,7 @@ abstract class AbstractCachingSpec extends PluginSpecification {
List<String> cacheArguments = [ '--build-cache' ]
cacheArguments.addAll(arguments)
// TODO: Use PluginSpecification.run here to reuse flags, but cache tests failed for now, need to investigate.
return runner.withProjectDir(alternateDir.root.toFile()).withArguments(cacheArguments).build()
return runner.withProjectDir(alternateDir.toFile()).withArguments(cacheArguments).build()
}

private String escapedPath(File file) {
Expand All @@ -60,9 +60,9 @@ abstract class AbstractCachingSpec extends PluginSpecification {
}

void copyToAlternateDir() {
FileUtils.deleteDirectory(alternateDir.root.toFile())
FileUtils.forceMkdir(alternateDir.root.toFile())
FileUtils.copyDirectory(dir.root.toFile(), alternateDir.root.toFile())
FileUtils.deleteDirectory(alternateDir.toFile())
FileUtils.forceMkdir(alternateDir.toFile())
FileUtils.copyDirectory(dir.toFile(), alternateDir.toFile())
}

void assertShadowJarIsCachedAndRelocatable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.github.jengelman.gradle.plugins.shadow.util.file.TestFile
import org.codehaus.plexus.util.IOUtil
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.junit.jupiter.api.io.TempDir
import spock.lang.Specification
import spock.lang.TempDir

import java.nio.file.Path
import java.util.function.Function
Expand Down Expand Up @@ -55,7 +55,7 @@ abstract class PluginSpecification extends Specification {

GradleRunner getRunner() {
GradleRunner.create()
.withProjectDir(dir.root.toFile())
.withProjectDir(dir.toFile())
.forwardOutput()
.withPluginClasspath()
}
Expand Down Expand Up @@ -115,11 +115,11 @@ abstract class PluginSpecification extends Specification {
}

File getFile(String path) {
new File(dir.root.toFile(), path)
new File(dir.toFile(), path)
}

AppendableMavenFileRepository repo(String path = 'maven-repo') {
new AppendableMavenFileRepository(new TestFile(dir.root.toFile(), path))
new AppendableMavenFileRepository(new TestFile(dir.toFile(), path))
}

void assertJarFileContentsEqual(File f, String path, String contents) {
Expand Down

0 comments on commit e25146d

Please sign in to comment.