代码拉取完成,页面将自动刷新
import java.io.FileOutputStream
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.9.22"
id("org.jetbrains.compose") version "1.5.12"
}
group = "top.myrest"
version = "1.0.0"
val entry = "$name.jar"
repositories {
mavenCentral()
mavenLocal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}
val myflowVersion = "1.3.1"
var myflowDependency: Dependency? = null
var jetbrainsComposeDependency: Dependency? = null
dependencies {
jetbrainsComposeDependency = implementation(compose.desktop.currentOs)
myflowDependency = implementation("top.myrest:myflow-kit:$myflowVersion")
testImplementation("top.myrest:myflow-baseimpl:$myflowVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
tasks.jar {
archiveFileName.set(entry)
val exists = mutableSetOf<String>()
val files = mutableListOf<Any>()
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.get().allDependencies.forEach { dependency ->
if (dependency == myflowDependency || dependency == jetbrainsComposeDependency) {
return@forEach
}
println(dependency)
configurations.runtimeClasspath.get().files(dependency).forEach { file ->
if (exists.add(file.name)) {
println(file.name)
files.add(if (file.isDirectory) file else zipTree(file))
}
}
}
from(files)
}
tasks.build {
doLast {
copy {
from("./build/libs/$entry")
into(".")
}
val specFile = file("./plugin-spec.yml")
val specContent = specFile.readLines(Charsets.UTF_8).joinToString(separator = System.lineSeparator()) {
if (it.startsWith("version:")) {
"version: $version"
} else if (it.startsWith("entry:")) {
"entry: ./$entry"
} else it
}
specFile.writeText(specContent, Charsets.UTF_8)
specFile.appendText(System.lineSeparator())
}
}
tasks.register("packagePlugin") {
group = "build"
description = "Package as runflow plugin zip file."
dependsOn(tasks.build)
doLast {
val zipFile = file("./runflow-plugin.zip")
val zip = ZipOutputStream(FileOutputStream(zipFile))
val files = mutableListOf(
file(entry) to entry,
file("plugin-spec.yml") to "plugin-spec.yml",
file("description_en_us.md") to "description_en_us.md",
file("description_zh_cn.md") to "description_zh_cn.md",
)
file("language").listFiles()?.forEach {
files.add(it to "language/${it.name}")
}
file("logos").listFiles()?.forEach {
files.add(it to "logos/${it.name}")
}
files.filter {
it.first.exists()
}.forEach {
zip.putNextEntry(ZipEntry(it.second))
zip.write(it.first.readBytes())
}
zip.closeEntry()
zip.close()
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。