Skip to content

Commit

Permalink
Move FileExtensions into PluginSpecification
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Dec 3, 2024
1 parent 020a476 commit e87fd0c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,29 @@ abstract class PluginSpecification extends Specification {
}
return new File(gradleUserHome, "testkit")
}

/**
* TODO: this is used as extensions for Groovy, could be replaced after migrated to Kotlin.
* Registered in resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule.
*/
static final class FileExtensions {
static final File resolve(File file, String relativePath) {
try {
return new File(file, relativePath)
} catch (RuntimeException e) {
throw new RuntimeException(String.format("Could not locate file '%s' relative to '%s'.", Arrays.toString(relativePath), file), e)
}
}

static final File createDir(File file) {
if (file.mkdirs()) {
return file
}
if (file.isDirectory()) {
return file
}
throw new AssertionError("Problems creating dir: " + this
+ ". Diagnostics: exists=" + file.exists() + ", isFile=" + file.isFile() + ", isDirectory=" + file.isDirectory())
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
moduleName = groovy-extensions
moduleVersion = ${moduleVersion}
extensionClasses =com.github.jengelman.gradle.plugins.shadow.util.FileExtensions
extensionClasses =com.github.jengelman.gradle.plugins.shadow.util.PluginSpecification.FileExtensions

0 comments on commit e87fd0c

Please sign in to comment.