From 465078256f2958953ae9274a58829fb74e94873e Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 2 Apr 2020 19:31:38 +0100 Subject: [PATCH] Rename common module to util again As I'm splitting it up into smaller modules (e.g. compress and crypto) I think util is a more appropriate name for the remainder. Signed-off-by: Graham --- asm/build.gradle.kts | 2 +- asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt | 4 ++-- asm/src/main/java/dev/openrs2/asm/classpath/Library.kt | 4 ++-- compress/build.gradle.kts | 2 +- compress/src/main/java/dev/openrs2/compress/bzip2/Bzip2.kt | 2 +- compress/src/main/java/dev/openrs2/compress/gzip/Gzip.kt | 2 +- decompiler/build.gradle.kts | 2 +- deob-ast/build.gradle.kts | 2 +- deob/src/main/java/dev/openrs2/deob/ArgRef.kt | 2 +- .../main/java/dev/openrs2/deob/analysis/SourcedIntValue.kt | 2 +- deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt | 4 ++-- .../java/dev/openrs2/deob/transform/DummyArgTransformer.kt | 2 +- .../dev/openrs2/deob/transform/StaticScramblingTransformer.kt | 2 +- .../java/dev/openrs2/deob/transform/UnusedArgTransformer.kt | 2 +- .../dev/openrs2/deob/transform/UnusedMethodTransformer.kt | 4 ++-- .../java/dev/openrs2/deob/transform/VisibilityTransformer.kt | 2 +- settings.gradle.kts | 4 ++-- {common => util}/build.gradle.kts | 4 ++-- .../src/main/java/dev/openrs2/util}/StringUtils.kt | 2 +- .../src/main/java/dev/openrs2/util}/collect/DisjointSet.kt | 2 +- .../main/java/dev/openrs2/util}/collect/ForestDisjointSet.kt | 2 +- .../src/main/java/dev/openrs2/util}/collect/IterableUtils.kt | 2 +- .../java/dev/openrs2/util}/io/DeterministicJarOutputStream.kt | 2 +- .../src/main/java/dev/openrs2/util}/io/SkipOutputStream.kt | 2 +- .../src/test/java/dev/openrs2/util}/StringUtilsTest.kt | 2 +- 25 files changed, 31 insertions(+), 31 deletions(-) rename {common => util}/build.gradle.kts (75%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/StringUtils.kt (87%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/collect/DisjointSet.kt (88%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/collect/ForestDisjointSet.kt (98%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/collect/IterableUtils.kt (88%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/io/DeterministicJarOutputStream.kt (98%) rename {common/src/main/java/dev/openrs2/common => util/src/main/java/dev/openrs2/util}/io/SkipOutputStream.kt (95%) rename {common/src/test/java/dev/openrs2/common => util/src/test/java/dev/openrs2/util}/StringUtilsTest.kt (93%) diff --git a/asm/build.gradle.kts b/asm/build.gradle.kts index 0ec767a3..03b920cb 100644 --- a/asm/build.gradle.kts +++ b/asm/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - api(project(":common")) + api(project(":util")) api("org.ow2.asm:asm:${Versions.asm}") api("org.ow2.asm:asm-commons:${Versions.asm}") api("org.ow2.asm:asm-tree:${Versions.asm}") diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt b/asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt index 897f86d8..abd0bebe 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt @@ -3,8 +3,8 @@ package dev.openrs2.asm.classpath import dev.openrs2.asm.MemberDesc import dev.openrs2.asm.MemberRef import dev.openrs2.asm.toBinaryClassName -import dev.openrs2.common.collect.DisjointSet -import dev.openrs2.common.collect.ForestDisjointSet +import dev.openrs2.util.collect.DisjointSet +import dev.openrs2.util.collect.ForestDisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.commons.Remapper import org.objectweb.asm.tree.AbstractInsnNode diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt index 9653f3bd..1804fa8f 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt @@ -3,9 +3,9 @@ package dev.openrs2.asm.classpath import com.github.michaelbull.logging.InlineLogger import dev.openrs2.asm.NopClassVisitor import dev.openrs2.asm.remap -import dev.openrs2.crypto.Pkcs12KeyStore -import dev.openrs2.common.io.DeterministicJarOutputStream import dev.openrs2.compress.gzip.Gzip +import dev.openrs2.crypto.Pkcs12KeyStore +import dev.openrs2.util.io.DeterministicJarOutputStream import org.objectweb.asm.ClassReader import org.objectweb.asm.commons.Remapper import org.objectweb.asm.tree.ClassNode diff --git a/compress/build.gradle.kts b/compress/build.gradle.kts index cc3068f8..827324a3 100644 --- a/compress/build.gradle.kts +++ b/compress/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation(project(":common")) + implementation(project(":util")) implementation("org.apache.commons:commons-compress:${Versions.commonsCompress}") } diff --git a/compress/src/main/java/dev/openrs2/compress/bzip2/Bzip2.kt b/compress/src/main/java/dev/openrs2/compress/bzip2/Bzip2.kt index a8a6fc8c..777683cb 100644 --- a/compress/src/main/java/dev/openrs2/compress/bzip2/Bzip2.kt +++ b/compress/src/main/java/dev/openrs2/compress/bzip2/Bzip2.kt @@ -1,6 +1,6 @@ package dev.openrs2.compress.bzip2 -import dev.openrs2.common.io.SkipOutputStream +import dev.openrs2.util.io.SkipOutputStream import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream import java.io.ByteArrayInputStream diff --git a/compress/src/main/java/dev/openrs2/compress/gzip/Gzip.kt b/compress/src/main/java/dev/openrs2/compress/gzip/Gzip.kt index 47a56f70..8bc8a89e 100644 --- a/compress/src/main/java/dev/openrs2/compress/gzip/Gzip.kt +++ b/compress/src/main/java/dev/openrs2/compress/gzip/Gzip.kt @@ -1,6 +1,6 @@ package dev.openrs2.compress.gzip -import dev.openrs2.common.io.SkipOutputStream +import dev.openrs2.util.io.SkipOutputStream import java.io.ByteArrayInputStream import java.io.InputStream import java.io.OutputStream diff --git a/decompiler/build.gradle.kts b/decompiler/build.gradle.kts index bf7a20b2..87907372 100644 --- a/decompiler/build.gradle.kts +++ b/decompiler/build.gradle.kts @@ -12,7 +12,7 @@ application { dependencies { api("com.github.ajalt:clikt:${Versions.clikt}") - implementation(project(":common")) + implementation(project(":util")) implementation("dev.openrs2:fernflower:${Versions.fernflower}") } diff --git a/deob-ast/build.gradle.kts b/deob-ast/build.gradle.kts index 457b8f20..941374ac 100644 --- a/deob-ast/build.gradle.kts +++ b/deob-ast/build.gradle.kts @@ -11,7 +11,7 @@ application { dependencies { api("com.github.ajalt:clikt:${Versions.clikt}") - implementation(project(":common")) + implementation(project(":util")) implementation("com.github.javaparser:javaparser-symbol-solver-core:${Versions.javaParser}") implementation("org.jdom:jdom2:${Versions.jdom}") } diff --git a/deob/src/main/java/dev/openrs2/deob/ArgRef.kt b/deob/src/main/java/dev/openrs2/deob/ArgRef.kt index ad77dd1c..5fb39aa2 100644 --- a/deob/src/main/java/dev/openrs2/deob/ArgRef.kt +++ b/deob/src/main/java/dev/openrs2/deob/ArgRef.kt @@ -1,6 +1,6 @@ package dev.openrs2.deob import dev.openrs2.asm.MemberRef -import dev.openrs2.common.collect.DisjointSet +import dev.openrs2.util.collect.DisjointSet data class ArgRef(val method: DisjointSet.Partition, val arg: Int) diff --git a/deob/src/main/java/dev/openrs2/deob/analysis/SourcedIntValue.kt b/deob/src/main/java/dev/openrs2/deob/analysis/SourcedIntValue.kt index e1feddac..43cd8acd 100644 --- a/deob/src/main/java/dev/openrs2/deob/analysis/SourcedIntValue.kt +++ b/deob/src/main/java/dev/openrs2/deob/analysis/SourcedIntValue.kt @@ -1,6 +1,6 @@ package dev.openrs2.deob.analysis import dev.openrs2.asm.MemberRef -import dev.openrs2.common.collect.DisjointSet +import dev.openrs2.util.collect.DisjointSet data class SourcedIntValue(val source: DisjointSet.Partition, val intValue: IntValue) diff --git a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt index ff376668..c8649c68 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt @@ -5,8 +5,8 @@ import dev.openrs2.asm.MemberDesc import dev.openrs2.asm.MemberRef import dev.openrs2.asm.classpath.ClassMetadata import dev.openrs2.asm.classpath.ClassPath -import dev.openrs2.common.collect.DisjointSet -import dev.openrs2.common.indefiniteArticle +import dev.openrs2.util.collect.DisjointSet +import dev.openrs2.util.indefiniteArticle import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.commons.Remapper diff --git a/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt index 063bd770..695a9c1a 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt @@ -15,11 +15,11 @@ import dev.openrs2.asm.pure import dev.openrs2.asm.replaceExpression import dev.openrs2.asm.stackMetadata import dev.openrs2.asm.transform.Transformer -import dev.openrs2.common.collect.DisjointSet import dev.openrs2.deob.ArgRef import dev.openrs2.deob.analysis.IntInterpreter import dev.openrs2.deob.analysis.IntValue import dev.openrs2.deob.analysis.SourcedIntValue +import dev.openrs2.util.collect.DisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.tree.AbstractInsnNode diff --git a/deob/src/main/java/dev/openrs2/deob/transform/StaticScramblingTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/StaticScramblingTransformer.kt index 1a440cc3..714b51a4 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/StaticScramblingTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/StaticScramblingTransformer.kt @@ -6,8 +6,8 @@ import dev.openrs2.asm.MemberRef import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.transform.Transformer -import dev.openrs2.common.collect.DisjointSet import dev.openrs2.deob.remap.TypedRemapper +import dev.openrs2.util.collect.DisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.FieldInsnNode diff --git a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt index cb32a1d8..752a3c31 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt @@ -7,11 +7,11 @@ import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.hasCode import dev.openrs2.asm.removeArgument import dev.openrs2.asm.transform.Transformer -import dev.openrs2.common.collect.DisjointSet import dev.openrs2.deob.ArgRef import dev.openrs2.deob.analysis.ConstSourceInterpreter import dev.openrs2.deob.analysis.ConstSourceValue import dev.openrs2.deob.remap.TypedRemapper +import dev.openrs2.util.collect.DisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.tree.AbstractInsnNode diff --git a/deob/src/main/java/dev/openrs2/deob/transform/UnusedMethodTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/UnusedMethodTransformer.kt index aa32056e..098d9d83 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/UnusedMethodTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/UnusedMethodTransformer.kt @@ -7,9 +7,9 @@ import dev.openrs2.asm.MemberRef import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.transform.Transformer -import dev.openrs2.common.collect.DisjointSet -import dev.openrs2.common.collect.removeFirst import dev.openrs2.deob.remap.TypedRemapper +import dev.openrs2.util.collect.DisjointSet +import dev.openrs2.util.collect.removeFirst import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.MethodInsnNode diff --git a/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt index 5e55153a..78debb93 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt @@ -9,7 +9,7 @@ import dev.openrs2.asm.MemberRef import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.transform.Transformer -import dev.openrs2.common.collect.DisjointSet +import dev.openrs2.util.collect.DisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.tree.ClassNode diff --git a/settings.gradle.kts b/settings.gradle.kts index 0773cabe..4a80ea63 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,6 @@ include( "asm", "bundler", "cli", - "common", "compress", "compress-cli", "crc32", @@ -16,7 +15,8 @@ include( "deob", "deob-annotations", "deob-ast", - "game" + "game", + "util" ) if (Files.exists(rootProject.projectDir.toPath().resolve("nonfree/build.gradle.kts"))) { diff --git a/common/build.gradle.kts b/util/build.gradle.kts similarity index 75% rename from common/build.gradle.kts rename to util/build.gradle.kts index c9bbb3fa..d0a49c4b 100644 --- a/common/build.gradle.kts +++ b/util/build.gradle.kts @@ -9,10 +9,10 @@ publishing { pom { packaging = "jar" - name.set("OpenRS2 Common") + name.set("OpenRS2 Utilities") description.set( """ - Common code used by all modules. + Common utility code used by all modules. """.trimIndent() ) } diff --git a/common/src/main/java/dev/openrs2/common/StringUtils.kt b/util/src/main/java/dev/openrs2/util/StringUtils.kt similarity index 87% rename from common/src/main/java/dev/openrs2/common/StringUtils.kt rename to util/src/main/java/dev/openrs2/util/StringUtils.kt index 66eb1458..e48c10d5 100644 --- a/common/src/main/java/dev/openrs2/common/StringUtils.kt +++ b/util/src/main/java/dev/openrs2/util/StringUtils.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common +package dev.openrs2.util fun CharSequence.indefiniteArticle(): String { require(isNotEmpty()) diff --git a/common/src/main/java/dev/openrs2/common/collect/DisjointSet.kt b/util/src/main/java/dev/openrs2/util/collect/DisjointSet.kt similarity index 88% rename from common/src/main/java/dev/openrs2/common/collect/DisjointSet.kt rename to util/src/main/java/dev/openrs2/util/collect/DisjointSet.kt index d57dd0a4..1b90cdb1 100644 --- a/common/src/main/java/dev/openrs2/common/collect/DisjointSet.kt +++ b/util/src/main/java/dev/openrs2/util/collect/DisjointSet.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common.collect +package dev.openrs2.util.collect interface DisjointSet : Iterable> { interface Partition : Iterable diff --git a/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt b/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt similarity index 98% rename from common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt rename to util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt index 66ff3b7d..cb2a0245 100644 --- a/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt +++ b/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common.collect +package dev.openrs2.util.collect import java.util.ArrayDeque diff --git a/common/src/main/java/dev/openrs2/common/collect/IterableUtils.kt b/util/src/main/java/dev/openrs2/util/collect/IterableUtils.kt similarity index 88% rename from common/src/main/java/dev/openrs2/common/collect/IterableUtils.kt rename to util/src/main/java/dev/openrs2/util/collect/IterableUtils.kt index 687a8d89..e59dc406 100644 --- a/common/src/main/java/dev/openrs2/common/collect/IterableUtils.kt +++ b/util/src/main/java/dev/openrs2/util/collect/IterableUtils.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common.collect +package dev.openrs2.util.collect inline fun MutableIterable.removeFirst(predicate: (T) -> Boolean): Boolean { val iterator = iterator() diff --git a/common/src/main/java/dev/openrs2/common/io/DeterministicJarOutputStream.kt b/util/src/main/java/dev/openrs2/util/io/DeterministicJarOutputStream.kt similarity index 98% rename from common/src/main/java/dev/openrs2/common/io/DeterministicJarOutputStream.kt rename to util/src/main/java/dev/openrs2/util/io/DeterministicJarOutputStream.kt index e7bfe362..29b658f2 100644 --- a/common/src/main/java/dev/openrs2/common/io/DeterministicJarOutputStream.kt +++ b/util/src/main/java/dev/openrs2/util/io/DeterministicJarOutputStream.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common.io +package dev.openrs2.util.io import java.io.OutputStream import java.nio.file.Files diff --git a/common/src/main/java/dev/openrs2/common/io/SkipOutputStream.kt b/util/src/main/java/dev/openrs2/util/io/SkipOutputStream.kt similarity index 95% rename from common/src/main/java/dev/openrs2/common/io/SkipOutputStream.kt rename to util/src/main/java/dev/openrs2/util/io/SkipOutputStream.kt index 55f99f79..1b3bca59 100644 --- a/common/src/main/java/dev/openrs2/common/io/SkipOutputStream.kt +++ b/util/src/main/java/dev/openrs2/util/io/SkipOutputStream.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common.io +package dev.openrs2.util.io import java.io.OutputStream diff --git a/common/src/test/java/dev/openrs2/common/StringUtilsTest.kt b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt similarity index 93% rename from common/src/test/java/dev/openrs2/common/StringUtilsTest.kt rename to util/src/test/java/dev/openrs2/util/StringUtilsTest.kt index 6ce7f862..c780e20d 100644 --- a/common/src/test/java/dev/openrs2/common/StringUtilsTest.kt +++ b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt @@ -1,4 +1,4 @@ -package dev.openrs2.common +package dev.openrs2.util import kotlin.test.Test import kotlin.test.assertEquals