no message
This commit is contained in:
parent
c454158df4
commit
e326888c01
101
build.gradle.kts
101
build.gradle.kts
@ -1,37 +1,40 @@
|
|||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
|
id("java-library")
|
||||||
|
id("maven-publish")
|
||||||
id("com.github.johnrengelman.shadow") version ("8.1.1")
|
id("com.github.johnrengelman.shadow") version ("8.1.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
val GROUPSID = project.properties["GROUPSID"] as String
|
val GROUPSID = project.properties["GROUPSID"] as String
|
||||||
val VERSIONS = project.properties["VERSIONS"] as String
|
val VERSIONS = project.properties["VERSIONS"] as String
|
||||||
val ARTIFACTID = project.properties["ARTIFACTID"] 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 buildTime = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())
|
||||||
|
|
||||||
val jarNameStr = "${ARTIFACTID}-${VERSIONS}"
|
val jarNameStr = "${ARTIFACTID}-${VERSIONS}"
|
||||||
val jarName = "${jarNameStr}.jar"
|
val jarName = "${jarNameStr}.jar"
|
||||||
val srcJarName = "${jarNameStr}-sources.jar"
|
val srcJarName = "${jarNameStr}-sources.jar"
|
||||||
|
val fatJarName = "${jarNameStr}-all.jar"
|
||||||
group = GROUPSID
|
group = GROUPSID
|
||||||
version = VERSIONS
|
version = VERSIONS
|
||||||
|
|
||||||
val libDir = rootDir.resolve("build").resolve("libs")
|
val libDir = rootDir.resolve("build").resolve("libs")
|
||||||
val srcDir = rootDir.resolve("src").resolve("main").resolve("java")
|
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.16")
|
implementation("org.checkerframework:checker-qual:3.43.0")
|
||||||
implementation("com.mingliqiye.lib.progress.bar:progress-bar:1.2")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
@ -50,29 +53,30 @@ private fun getHash(file: File) {
|
|||||||
val md5 = generateHash(file, "MD5")
|
val md5 = generateHash(file, "MD5")
|
||||||
val sha1 = generateHash(file, "SHA-1")
|
val sha1 = generateHash(file, "SHA-1")
|
||||||
val sha256 = generateHash(file, "SHA-256")
|
val sha256 = generateHash(file, "SHA-256")
|
||||||
val md5f = File(libDir, file.getName() + ".MD5.txt")
|
val sha512 = generateHash(file, "SHA-512")
|
||||||
val sha1f = File(libDir, file.getName() + ".SHA1.txt")
|
val md5f = File(libDir, file.getName() + ".md5")
|
||||||
val sha256f = File(libDir, file.getName() + ".SHA256.txt")
|
val sha1f = File(libDir, file.getName() + ".sha1")
|
||||||
|
val sha256f = File(libDir, file.getName() + ".sha256")
|
||||||
|
val sha512f = File(libDir, file.getName() + ".sha512")
|
||||||
md5f.writeText(md5)
|
md5f.writeText(md5)
|
||||||
sha1f.writeText(sha1)
|
sha1f.writeText(sha1)
|
||||||
sha256f.writeText(sha256)
|
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 {
|
tasks.shadowJar {
|
||||||
archiveFileName.set(jarName)
|
archiveFileName.set(fatJarName)
|
||||||
doFirst {
|
archiveClassifier.set("all")
|
||||||
delete(libDir)
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
mkdir(libDir)
|
from(sourceSets.main.get().output) // 编译输出
|
||||||
|
from(project.configurations.runtimeClasspath) // 运行时依赖
|
||||||
|
from("src/main/resources") { // 资源文件
|
||||||
|
into(".")
|
||||||
}
|
}
|
||||||
manifest {
|
manifest {
|
||||||
|
attributes["Main-Class"] = MAINCLASS
|
||||||
attributes["Implementation-GroupId"] = GROUPSID
|
attributes["Implementation-GroupId"] = GROUPSID
|
||||||
attributes["Implementation-ArtifactId"] = ARTIFACTID
|
attributes["Implementation-ArtifactId"] = ARTIFACTID
|
||||||
attributes["Implementation-Version"] = VERSIONS
|
attributes["Implementation-Version"] = VERSIONS
|
||||||
@ -85,14 +89,69 @@ tasks.shadowJar {
|
|||||||
attributes["Created"] = "2025-06-26 09:13:51"
|
attributes["Created"] = "2025-06-26 09:13:51"
|
||||||
attributes["Updated"] = buildTime
|
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") {
|
tasks.register("build-jar") {
|
||||||
dependsOn(tasks["sources"])
|
dependsOn(tasks.jar)
|
||||||
dependsOn(tasks.shadowJar)
|
dependsOn(tasks.shadowJar)
|
||||||
doLast {
|
dependsOn(tasks["sourcesJar"])
|
||||||
|
dependsOn(tasks["generatePomFileForMavenJavaPublication"])
|
||||||
|
dependsOn(tasks["generateMetadataFileForMavenJavaPublication"])
|
||||||
|
/*doLast {
|
||||||
getHash(File(libDir, jarName))
|
getHash(File(libDir, jarName))
|
||||||
|
getHash(File(libDir, fatJarName))
|
||||||
getHash(File(libDir, srcJarName))
|
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
27
build.yaml
Normal 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"
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
GROUPSID=
|
GROUPSID=com.mingliqiye
|
||||||
ARTIFACTID=
|
ARTIFACTID=socket-utilts
|
||||||
VERSIONS=
|
VERSIONS=0.1
|
||||||
MAIMCLASSSTR=
|
MAINCLASS=com.mingliqiye.Main
|
||||||
JDKVERSIONS=
|
JDKVERSIONS=1.8
|
||||||
|
@ -1 +1 @@
|
|||||||
rootProject.name = "download"
|
rootProject.name = "socket-utilts"
|
||||||
|
13
src/main/java/com/mingliqiye/Main.java
Normal file
13
src/main/java/com/mingliqiye/Main.java
Normal 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
27
workflows/build.yaml
Normal 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"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user