diff options
author | Linnea Gräf <nea@nea.moe> | 2023-12-10 16:54:57 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2023-12-10 16:54:57 +0100 |
commit | 0936f6272c7d1e41b7e9550bb17fe84af5d976c3 (patch) | |
tree | 0c41488910659eefb31a6231dce0f72f29ca75e3 | |
parent | 17f0faaccb0db837a64b6ce7cecff7f8ab048410 (diff) | |
download | archenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.tar.gz archenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.tar.bz2 archenemy-0936f6272c7d1e41b7e9550bb17fe84af5d976c3.zip |
Move utilities around
-rw-r--r-- | archenemyexample/settings.gradle.kts | 4 | ||||
-rw-r--r-- | plugin/build.gradle.kts | 2 | ||||
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/IdentityMinecraftTransformer.kt | 1 | ||||
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/MappedRepositoryProvider.kt | 3 | ||||
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/MinecraftProvider.kt | 14 | ||||
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt | 2 | ||||
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/util/DigestUtils.kt | 14 | ||||
-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 |
8 files changed, 26 insertions, 16 deletions
diff --git a/archenemyexample/settings.gradle.kts b/archenemyexample/settings.gradle.kts index d69f7a0..b538163 100644 --- a/archenemyexample/settings.gradle.kts +++ b/archenemyexample/settings.gradle.kts @@ -3,5 +3,7 @@ pluginManagement { repositories { mavenCentral() gradlePluginPortal() + maven("https://maven.fabricmc.net") maven("https://maven.neoforged.net/releases") - }}
\ No newline at end of file + } +}
\ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index d0a7eff..4ea04aa 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -7,6 +7,7 @@ plugins { repositories { mavenCentral() maven("https://maven.neoforged.net/releases") + maven("https://maven.fabricmc.net") } dependencies { @@ -14,6 +15,7 @@ dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2") + implementation("net.fabricmc:mapping-io:0.1.8") testImplementation("org.jetbrains.kotlin:kotlin-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit") 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 |