perf: 优化 Artifact 的判断条件.

根据相关文档[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
This commit is contained in:
LamGC 2022-06-15 02:18:01 +08:00
parent 7e48f4bf0b
commit 35c77f6093
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -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,