From 09afc7b96ed5b0971eb1322ce7f99b151474e6a0 Mon Sep 17 00:00:00 2001 From: Goooler Date: Tue, 3 Dec 2024 16:15:05 +0800 Subject: [PATCH] Revert "Move FileExtensions into PluginSpecification" This reverts commit e87fd0c35d5e5d7b26ac37dff189a8e8fef844ec. --- .../plugins/shadow/util/FileExtensions.groovy | 26 +++++++++++++++++++ .../shadow/util/PluginSpecification.groovy | 25 ------------------ ...rg.codehaus.groovy.runtime.ExtensionModule | 2 +- 3 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/FileExtensions.groovy diff --git a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/FileExtensions.groovy b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/FileExtensions.groovy new file mode 100644 index 000000000..936c0bbf9 --- /dev/null +++ b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/FileExtensions.groovy @@ -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()) + } +} diff --git a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/PluginSpecification.groovy b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/PluginSpecification.groovy index 67481c0ec..23b88c502 100644 --- a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/PluginSpecification.groovy +++ b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/PluginSpecification.groovy @@ -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()) - } - } } diff --git a/src/funcTest/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule b/src/funcTest/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule index cb99b3712..bb7d5044f 100644 --- a/src/funcTest/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule +++ b/src/funcTest/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule @@ -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