no message

This commit is contained in:
Armamem0t 2025-07-05 12:56:15 +08:00
parent c454158df4
commit e326888c01
Signed by: minglipro
GPG Key ID: 5F355A77B22AA93B
6 changed files with 153 additions and 27 deletions

View File

@ -1,37 +1,40 @@
import java.security.MessageDigest
import java.text.SimpleDateFormat
import java.util.Date
plugins {
id("java")
id("java-library")
id("maven-publish")
id("com.github.johnrengelman.shadow") version ("8.1.1")
}
val GROUPSID = project.properties["GROUPSID"] as String
val VERSIONS = project.properties["VERSIONS"] as String
val ARTIFACTID = project.properties["ARTIFACTID"] as String
val MAINCLASS = project.properties["MAINCLASS"] as String
val buildTime = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())
val jarNameStr = "${ARTIFACTID}-${VERSIONS}"
val jarName = "${jarNameStr}.jar"
val srcJarName = "${jarNameStr}-sources.jar"
val fatJarName = "${jarNameStr}-all.jar"
group = GROUPSID
version = VERSIONS
val libDir = rootDir.resolve("build").resolve("libs")
val srcDir = rootDir.resolve("src").resolve("main").resolve("java")
java {
withSourcesJar()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.16")
implementation("com.mingliqiye.lib.progress.bar:progress-bar:1.2")
implementation("org.checkerframework:checker-qual:3.43.0")
}
tasks.test {
useJUnitPlatform()
}
@ -50,29 +53,30 @@ private fun getHash(file: File) {
val md5 = generateHash(file, "MD5")
val sha1 = generateHash(file, "SHA-1")
val sha256 = generateHash(file, "SHA-256")
val md5f = File(libDir, file.getName() + ".MD5.txt")
val sha1f = File(libDir, file.getName() + ".SHA1.txt")
val sha256f = File(libDir, file.getName() + ".SHA256.txt")
val sha512 = generateHash(file, "SHA-512")
val md5f = File(libDir, file.getName() + ".md5")
val sha1f = File(libDir, file.getName() + ".sha1")
val sha256f = File(libDir, file.getName() + ".sha256")
val sha512f = File(libDir, file.getName() + ".sha512")
md5f.writeText(md5)
sha1f.writeText(sha1)
sha256f.writeText(sha256)
sha512f.writeText(sha512)
}
tasks.register<Zip>("sources") {
archiveFileName.set(srcJarName)
destinationDirectory.set(libDir)
fileTree(srcDir).forEach { println(it) }
from(fileTree(srcDir.toString()))
into(".")
}
tasks.shadowJar {
archiveFileName.set(jarName)
doFirst {
delete(libDir)
mkdir(libDir)
archiveFileName.set(fatJarName)
archiveClassifier.set("all")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.get().output) // 编译输出
from(project.configurations.runtimeClasspath) // 运行时依赖
from("src/main/resources") { // 资源文件
into(".")
}
manifest {
attributes["Main-Class"] = MAINCLASS
attributes["Implementation-GroupId"] = GROUPSID
attributes["Implementation-ArtifactId"] = ARTIFACTID
attributes["Implementation-Version"] = VERSIONS
@ -85,14 +89,69 @@ tasks.shadowJar {
attributes["Created"] = "2025-06-26 09:13:51"
attributes["Updated"] = buildTime
}
mergeServiceFiles()
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA") // 排除签名文件
from("LICENSE")
into(".")
}
tasks.jar {
archiveFileName.set(jarName)
doFirst {
delete(libDir)
mkdir(libDir)
}
manifest {
attributes["Main-Class"] = MAINCLASS
attributes["Implementation-GroupId"] = GROUPSID
attributes["Implementation-ArtifactId"] = ARTIFACTID
attributes["Implementation-Version"] = VERSIONS
attributes["Email"] = "minglipro@163.com"
attributes["Implementation-Vendor"] = "minglipro|Armamem0t"
attributes["Copyright"] =
"Copyright 2026 minglipro All rights reserved."
attributes["Env"] = "prod"
attributes["LICENSE"] = "Apache License 2.0"
attributes["Created"] = "2025-06-26 09:13:51"
attributes["Updated"] = buildTime
}
from("LICENSE")
into(".")
}
tasks.register("build-jar") {
dependsOn(tasks["sources"])
dependsOn(tasks.jar)
dependsOn(tasks.shadowJar)
doLast {
dependsOn(tasks["sourcesJar"])
dependsOn(tasks["generatePomFileForMavenJavaPublication"])
dependsOn(tasks["generateMetadataFileForMavenJavaPublication"])
/*doLast {
getHash(File(libDir, jarName))
getHash(File(libDir, fatJarName))
getHash(File(libDir, srcJarName))
}*/
}
components {
withType<AdhocComponentWithVariants>().configureEach {
withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
}
}
publishing {
repositories {
maven {
url = uri("D:/git/maven-repository-raw")
}
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks.shadowJar.get())
groupId = GROUPSID
artifactId = ARTIFACTID
version = VERSIONS
}
}
}

27
build.yaml Normal file
View File

@ -0,0 +1,27 @@
name: Gitea Actions Build
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- master
jobs:
Build:
runs-on: ubuntu-dev
steps:
- name: Check out repository code
uses: https://git.mingliqiye.com/Actions/checkout@v4
- name: build-test
run: |
source gradle.properties
gradle
gradle build-jar
- name: Releases
run: |
source gradle.properties
SHA=${{gitea.sha}}
curl -o- https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases/raw/branch/master/install.sh | bash
FILENAME="${GROUPSID}-${VERSIONS}.jar"
java -jar com.mingliqiye.gitea.releases.jar -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}-${SHA:0:10}" -a "build/libs"

View File

@ -1,5 +1,5 @@
GROUPSID=
ARTIFACTID=
VERSIONS=
MAIMCLASSSTR=
JDKVERSIONS=
GROUPSID=com.mingliqiye
ARTIFACTID=socket-utilts
VERSIONS=0.1
MAINCLASS=com.mingliqiye.Main
JDKVERSIONS=1.8

View File

@ -1 +1 @@
rootProject.name = "download"
rootProject.name = "socket-utilts"

View File

@ -0,0 +1,13 @@
package com.mingliqiye;
public class Main {
/**
* @param args []
*/
public static void main(String[] args) {
System.out.print("Hello and welcome!");
for (int i = 1; i <= 5; i++) {
System.out.println("i = " + i);
}
}
}

27
workflows/build.yaml Normal file
View File

@ -0,0 +1,27 @@
name: Gitea Actions Build
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- master
jobs:
Build:
runs-on: ubuntu-dev
steps:
- name: Check out repository code
uses: https://git.mingliqiye.com/Actions/checkout@v4
- name: build-test
run: |
source gradle.properties
gradle
gradle build-jar
- name: Releases
run: |
source gradle.properties
SHA=${{gitea.sha}}
curl -o- https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases/raw/branch/master/install.sh | bash
FILENAME="${GROUPSID}-${VERSIONS}.jar"
java -jar com.mingliqiye.gitea.releases.jar -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}-${SHA:0:10}" -a "build/libs"