mingli-utils/build.gradle.kts
minglipro 683aeb2c7f
```
feat(stream): 优化 SuperStream 的 toArray 方法实现- 调整 toArray 方法,支持传入 Class 参数以正确创建泛型数组
- 原无参 toArray 方法改为返回 Object[],避免类型转换异常
- 移除对 ForEach 工具类的依赖
- 提升流处理中数组转换的灵活性与安全性

```

```
feat(collection): 改进 toArray 工具方法支持泛型数组创建

- 新增基于 reified 泛型的 toArray 扩展方法,自动推断数组类型
- 添加带 Class 参数的 toArray 重载方法,用于明确指定元素类型
- 处理空列表时直接返回空数组,避免后续操作异常

```

```
build(gradle): 升级 dokka 插件版本并更新项目依赖- 将 org.jetbrains.dokka 插件升级至 2.1.0-Beta 版本
- 添加 jna5.17.0 依赖用于本地库调用支持
- 引入 mybatis-plus-core 3.0.1 编译依赖
- 更新项目版本号从 4.1.7 至 4.1.8

```
2025-09-21 14:37:22 +08:00

218 lines
6.5 KiB
Plaintext

/*
* Copyright 2025 mingliqiye
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ProjectName mingli-utils
* ModuleName mingli-utils
* CurrentFile build.gradle.kts
* LastUpdate 2025-09-20 22:30:57
* UpdateUser MingLiPro
*/
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
idea
java
signing
`java-library`
`maven-publish`
kotlin("jvm") version "2.2.20"
id("org.jetbrains.dokka") version "2.1.0-Beta"
}
val GROUPSID = project.properties["GROUPSID"] as String
val VERSIONS = project.properties["VERSIONS"] as String
val ARTIFACTID = project.properties["ARTIFACTID"] as String
group = GROUPSID
version = VERSIONS
base {
archivesName.set(ARTIFACTID)
}
val buildDir: java.nio.file.Path = File("build").toPath()
sourceSets {
main {
java {
srcDirs("src/main/java")
}
kotlin {
srcDirs("src/main/kotlin")
}
resources {
srcDirs("src/main/resources")
}
}
}
java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
dependencies {
implementation("org.slf4j:slf4j-api:2.0.17")
implementation("com.mingliqiye.utils.jna:WinKernel32Api:1.0.1")
// https://github.com/jeremyh/jBCrypt
implementation("org.mindrot:jbcrypt:0.4")
compileOnly("org.springframework.boot:spring-boot-starter:2.7.14")
compileOnly("com.fasterxml.jackson.core:jackson-databind:2.19.2")
compileOnly("com.google.code.gson:gson:2.13.1")
compileOnly("org.mybatis:mybatis:3.5.19")
compileOnly("com.alibaba.fastjson2:fastjson2:2.0.58")
compileOnly("com.baomidou:mybatis-plus-core:3.0.1")
compileOnly("net.java.dev.jna:jna:5.17.0")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<JavaExec>().configureEach {
jvmArgs = listOf(
"-Dfile.encoding=UTF-8", "-Dsun.stdout.encoding=UTF-8", "-Dsun.stderr.encoding=UTF-8"
)
}
tasks.withType<org.gradle.jvm.tasks.Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from("LICENSE") { into("META-INF") }
from("NOTICE") { into("META-INF") }
manifest {
attributes(
mapOf(
"Main-Class" to "com.mingliqiye.utils.main.Main",
"Specification-Title" to ARTIFACTID,
"Specification-Version" to VERSIONS,
"Specification-Vendor" to "minglipro",
"Specification-Build-Time" to LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSS")),
"Specification-Package" to GROUPSID,
"Specification-Build-Number" to "1",
"Specification-Build-OS" to System.getProperty("os.name"),
"Specification-Build-Java" to System.getProperty("java.version"),
"Specification-Build-Java-Vendor" to System.getProperty("java.vendor"),
"Specification-Build-Java-Vendor-URL" to System.getProperty("java.vendor.url"),
"Implementation-Title" to ARTIFACTID,
"Implementation-Version" to VERSIONS,
"Implementation-Package" to GROUPSID,
"Implementation-Vendor" to "minglipro",
"Implementation-Build-Time" to LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSS"))
)
)
}
}
val isJdk8Build = project.findProperty("buildForJdk8") == "true"
repositories {
maven {
url = uri("https://maven.aliyun.com/repository/public/")
}
mavenCentral()
}
tasks.register<Jar>("javaDocJar") {
group = "build"
archiveClassifier.set("javadoc")
dependsOn(tasks.dokkaJavadoc)
from(buildDir.resolve("dokka/javadoc"))
}
tasks.register<Jar>("kotlinDocJar") {
group = "build"
archiveClassifier.set("kotlindoc")
dependsOn(tasks.dokkaHtml)
from(buildDir.resolve("dokka/html"))
}
publishing {
repositories {
maven {
name = "MavenRepositoryRaw"
url = uri("C:/data/git/maven-repository-raw")
}
maven {
name = "OSSRepository"
url = uri("C:/data/git/maven-repository-raw-utils")
}
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks.named("javaDocJar"))
artifact(tasks.named("kotlinDocJar"))
artifactId = ARTIFACTID
java.toolchain.languageVersion.set(JavaLanguageVersion.of(8))
pom {
name = "mingli-utils"
url = "https://mingli-utils.mingliqiye.com"
description = "A Java/kotlin Utils"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "minglipro"
name = "mingli"
email = "minglipro@163.com"
}
}
scm {
connection = "scm:git:https://git.mingliqiye.com/minglipro/mingli-utils.git"
developerConnection = "scm:git:https://git.mingliqiye.com:minglipro/mingli-utils.git"
url = "https://git.mingliqiye.com/minglipro/mingli-utils"
}
}
}
}
signing {
sign(publishing.publications)
}
}
tasks.build {
dependsOn("javaDocJar", "kotlinDocJar")
}
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
outputs.upToDateWhen { false }
filesMatching("META-INF/meta-data") {
expand(
project.properties + mapOf(
"buildTime" to LocalDateTime.now().format(
DateTimeFormatter.ofPattern(
"yyyy-MM-dd HH:mm:ss.SSSSSSS"
)
)
)
)
}
}