From 35c77f609362bc5b5f5c617735a7f48f8da48c00 Mon Sep 17 00:00:00 2001 From: LamGC Date: Wed, 15 Jun 2022 02:18:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20Artifact=20?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据相关文档[1], baseVersion 和 Version 不需要同时判断, 只需要单独判断 Version 即可确认版本是否符合. 另外, 如果 Version 不符, 那么 isSnapshot 就没有必要判断(不可能出现 Version 相同的情况下, 一个是快照版, 一个是发布版的情况), 故移除对 baseVersion 和 isSnapshot 的检查. 另外, Properties 属于 Aether 内部的非持久化信息交换方式, 不是必须纳入检查的项目, 故新增参数用于选择是否检查 Properties 是否相同. ------------------------------------ [1]: https://community.sonatype.com/t/what-is-the-differences-between-maven-baseversion-and-maven-version/2937 --- scalabot-app/src/main/kotlin/util/Utils.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scalabot-app/src/main/kotlin/util/Utils.kt b/scalabot-app/src/main/kotlin/util/Utils.kt index 252df59..568a7d6 100644 --- a/scalabot-app/src/main/kotlin/util/Utils.kt +++ b/scalabot-app/src/main/kotlin/util/Utils.kt @@ -10,16 +10,14 @@ import java.io.FilenameFilter internal fun ByteArray.toHexString(): String = joinToString("") { it.toString(16) } -internal fun Artifact.equalsArtifact(that: Artifact): Boolean = +internal fun Artifact.equalsArtifact(that: Artifact, checkProperties: Boolean = false): Boolean = this.groupId.equals(that.groupId) && this.artifactId.equals(that.artifactId) && this.version.equals(that.version) && - this.baseVersion.equals(that.baseVersion) && - this.isSnapshot == that.isSnapshot && this.classifier.equals(that.classifier) && this.extension.equals(that.extension) && (if (this.file == null) that.file == null else this.file.equals(that.file)) && - this.properties.equals(that.properties) + (!checkProperties || this.properties.equals(that.properties)) internal fun File.deepListFiles( addSelf: Boolean = false,