Skip to content

Commit

Permalink
Revert "Move FileExtensions into PluginSpecification"
Browse files Browse the repository at this point in the history
This reverts commit e87fd0c.
  • Loading branch information
Goooler committed Dec 3, 2024
1 parent b393ae3 commit 09afc7b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.jengelman.gradle.plugins.shadow.util

/**
* 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.
*/
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: " + file
+ ". Diagnostics: exists=" + file.exists() + ", isFile=" + file.isFile() + ", isDirectory=" + file.isDirectory())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,29 +185,4 @@ 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.PluginSpecification.FileExtensions
extensionClasses =com.github.jengelman.gradle.plugins.shadow.util.FileExtensions

0 comments on commit 09afc7b

Please sign in to comment.