1
1
package com.github.jengelman.gradle.plugins.shadow.internal
2
2
3
+ import com.github.jengelman.gradle.plugins.shadow.relocation.RelocateClassContext
4
+ import com.github.jengelman.gradle.plugins.shadow.relocation.RelocatePathContext
5
+ import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator
3
6
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction
4
7
import java.io.ByteArrayInputStream
5
8
import java.io.ByteArrayOutputStream
6
- import java.io.File
7
9
import java.io.InputStream
8
10
import java.nio.charset.Charset
9
11
import java.nio.file.NoSuchFileException
@@ -12,11 +14,6 @@ import java.util.Properties
12
14
import java.util.jar.Attributes.Name as JarAttributeName
13
15
import kotlin.io.path.toPath
14
16
import org.apache.tools.zip.ZipEntry
15
- import org.gradle.api.file.RelativePath
16
- import org.gradle.api.internal.file.DefaultFileTreeElement
17
- import org.gradle.internal.file.Chmod
18
- import org.gradle.internal.file.FileMetadata
19
- import org.gradle.internal.file.Stat
20
17
21
18
/* *
22
19
* Known as `Main-Class` in the manifest file.
@@ -49,17 +46,12 @@ internal inline fun zipEntry(
49
46
block()
50
47
}
51
48
52
- /* *
53
- * This is used for creating a [DefaultFileTreeElement] with default values.
54
- * [file], [chmod], and [stat] should be non-null, so they are set to dummy values here.
55
- */
56
- internal fun createDefaultFileTreeElement (
57
- file : File = DummyFile ,
58
- relativePath : RelativePath ,
59
- chmod : Chmod = DummyChmod ,
60
- stat : Stat = DummyStat ,
61
- ): DefaultFileTreeElement {
62
- return DefaultFileTreeElement (file, relativePath, chmod, stat)
49
+ internal fun Relocator.relocatePath (path : String ): String {
50
+ return relocatePath(RelocatePathContext (path))
51
+ }
52
+
53
+ internal fun Relocator.relocateClass (className : String ): String {
54
+ return relocateClass(RelocateClassContext (className))
63
55
}
64
56
65
57
internal fun Properties.inputStream (
@@ -88,11 +80,4 @@ internal fun requireResourceAsPath(name: String): Path {
88
80
return resource.toURI().toPath()
89
81
}
90
82
91
- private val DummyFile = File (" dummy" )
92
- private val DummyChmod = Chmod { _, _ -> error(" This is a dummy implementation." ) }
93
- private val DummyStat = object : Stat {
94
- override fun getUnixMode (f : File ): Int = error(" This is a dummy implementation." )
95
- override fun stat (f : File ): FileMetadata = error(" This is a dummy implementation." )
96
- }
97
-
98
83
private object Utils
0 commit comments