summaryrefslogtreecommitdiff
path: root/plugin/src/main/kotlin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2023-12-10 16:54:57 +0100
committerLinnea Gräf <nea@nea.moe>2023-12-10 16:54:57 +0100
commit0936f6272c7d1e41b7e9550bb17fe84af5d976c3 (patch)
tree0c41488910659eefb31a6231dce0f72f29ca75e3 /plugin/src/main/kotlin
parent17f0faaccb0db837a64b6ce7cecff7f8ab048410 (diff)
downloadarchenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.tar.gz
archenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.tar.bz2
archenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.zip
Move utilities around
Diffstat (limited to 'plugin/src/main/kotlin')
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt1
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt3
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt14
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt2
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/util/DigestUtils.kt14
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/util/DownloadUtils.kt (renamed from plugin/src/main/kotlin/moe/nea/archenemy/DownloadUtils.kt)2
6 files changed, 21 insertions, 15 deletions
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt
index 9d23c60..bb7a5cb 100644
--- a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt
@@ -1,5 +1,6 @@
package moe.nea.archenemy.mojang
+import moe.nea.archenemy.util.update
import java.io.File
import java.security.MessageDigest
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt
index d176d45..ddfff0d 100644
--- a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt
@@ -1,7 +1,8 @@
package moe.nea.archenemy.mojang
-import moe.nea.archenemy.DownloadUtils
+import moe.nea.archenemy.util.DownloadUtils
import moe.nea.archenemy.util.getNullsafeIdentifier
+import moe.nea.archenemy.util.updateField
import net.minecraftforge.artifactural.api.artifact.Artifact
import net.minecraftforge.artifactural.api.artifact.ArtifactIdentifier
import net.minecraftforge.artifactural.api.artifact.ArtifactType
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt
index 64c1d04..605d485 100644
--- a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt
@@ -2,7 +2,7 @@ package moe.nea.archenemy.mojang
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromStream
-import moe.nea.archenemy.DownloadUtils
+import moe.nea.archenemy.util.DownloadUtils
import moe.nea.archenemy.MCSide
import moe.nea.archenemy.util.getNullsafeIdentifier
import net.minecraftforge.artifactural.api.artifact.Artifact
@@ -14,20 +14,8 @@ import net.minecraftforge.artifactural.base.artifact.StreamableArtifact
import java.io.File
import java.io.IOException
import java.net.URL
-import java.security.MessageDigest
import java.util.concurrent.ConcurrentHashMap
-fun MessageDigest.updateField(text: String, value: String) {
- this.update(text)
- this.update(":")
- this.update(value)
- this.update(";")
-}
-
-fun MessageDigest.update(text: String) {
- this.update(text.encodeToByteArray())
-}
-
class MinecraftProvider(val sharedExtension: ArchenemySharedExtension) : Repository {
data class MinecraftCoordinate(
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt
index 8617ede..4e44146 100644
--- a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt
@@ -1,6 +1,8 @@
package moe.nea.archenemy.mojang
import moe.nea.archenemy.MCSide
+import moe.nea.archenemy.util.update
+import moe.nea.archenemy.util.updateField
import org.gradle.api.artifacts.Dependency
import org.gradle.api.provider.Provider
import java.io.File
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/util/DigestUtils.kt b/plugin/src/main/kotlin/moe/nea/archenemy/util/DigestUtils.kt
new file mode 100644
index 0000000..4f50000
--- /dev/null
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/util/DigestUtils.kt
@@ -0,0 +1,14 @@
+package moe.nea.archenemy.util
+
+import java.security.MessageDigest
+
+fun MessageDigest.updateField(text: String, value: String) {
+ this.update(text)
+ this.update(":")
+ this.update(value)
+ this.update(";")
+}
+
+fun MessageDigest.update(text: String) {
+ this.update(text.encodeToByteArray())
+} \ No newline at end of file
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/DownloadUtils.kt b/plugin/src/main/kotlin/moe/nea/archenemy/util/DownloadUtils.kt
index c849349..cec2c55 100644
--- a/plugin/src/main/kotlin/moe/nea/archenemy/DownloadUtils.kt
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/util/DownloadUtils.kt
@@ -1,4 +1,4 @@
-package moe.nea.archenemy
+package moe.nea.archenemy.util
import java.io.File
import java.io.IOException