migrated to gitea
All checks were successful
CI / build (push) Successful in 48s

This commit is contained in:
2024-04-04 08:39:31 +08:00
parent c4ccec0fc3
commit 19162b5b97
18 changed files with 125 additions and 42 deletions

View File

@@ -0,0 +1,16 @@
name: CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: woryzen
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
env:
PUBLISHER_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
run: ./gradlew build publishMavenPublicationToGiteaRepository

25
Jenkinsfile vendored
View File

@@ -6,13 +6,24 @@ pipeline {
stages { stages {
stage("Build") { stage("Build") {
steps { steps {
sh "./gradlew clean assemble build" sh "./gradlew build"
junit testResults: "build/test-results/test/*.xml" }
javadoc javadocDir: "build/docs/javadoc", keepAll: true post {
archiveArtifacts artifacts: 'build/libs/*.jar,benchmark/build/libs/*.jar,wson-cli/build/libs/wson-cli-envelope-*.jar,wson-cli/build/libs/wson-cli', always {
allowEmptyArchive: true, junit '**/build/test-results/test/*.xml'
fingerprint: true, }
onlyIfSuccessful: true success {
jacoco(
execPattern: '**/build/jacoco/*.exec',
classPattern: '**/build/classes/java/main',
sourcePattern: '**/src/main'
)
javadoc javadocDir: "build/docs/javadoc", keepAll: true
archiveArtifacts artifacts: '**/build/libs/*.jar,wson-cli/build/libs/wson-cli',
allowEmptyArchive: false,
fingerprint: true,
onlyIfSuccessful: true
}
} }
} }
stage("Publish") { stage("Publish") {

View File

@@ -18,7 +18,6 @@ dependencies {
implementation catalog.jwo implementation catalog.jwo
implementation catalog.xz implementation catalog.xz
implementation catalog.jcommander
implementation catalog.jackson.databind implementation catalog.jackson.databind
runtimeOnly project(':test-utils') runtimeOnly project(':test-utils')

View File

@@ -1,5 +1,7 @@
plugins { plugins {
id 'jacoco'
id 'maven-publish' id 'maven-publish'
alias catalog.plugins.multi.release.jar
alias catalog.plugins.envelope apply false alias catalog.plugins.envelope apply false
alias catalog.plugins.lombok apply false alias catalog.plugins.lombok apply false
} }
@@ -15,7 +17,7 @@ allprojects {
java { java {
modularity.inferModulePath = true modularity.inferModulePath = true
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(17) languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.GRAAL_VM vendor = JvmVendorSpec.GRAAL_VM
} }
} }
@@ -26,9 +28,8 @@ allprojects {
repositories { repositories {
maven { maven {
url = "https://woggioni.net/mvn/" url = getProperty('gitea.maven.url')
content { content {
includeGroup 'com.beust'
includeGroup 'com.lys' includeGroup 'com.lys'
includeGroup 'net.woggioni' includeGroup 'net.woggioni'
} }
@@ -36,6 +37,15 @@ allprojects {
mavenCentral() mavenCentral()
} }
pluginManager.withPlugin('jacoco') {
test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
}
}
dependencies { dependencies {
implementation catalog.xz implementation catalog.xz
@@ -59,6 +69,30 @@ allprojects {
} }
} }
} }
pluginManager.withPlugin('maven-publish') {
publishing {
repositories {
maven {
url = 'https://mvn.woggioni.net/'
}
maven {
name = "Gitea"
url = uri(getProperty('gitea.maven.url'))
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token ${System.getenv()["PUBLISHER_TOKEN"]}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
}
} }
@@ -79,12 +113,11 @@ compileJava {
options.compilerArgs << '-parameters' options.compilerArgs << '-parameters'
} }
ext {
setProperty('jpms.module.name', 'net.woggioni.wson')
}
publishing { publishing {
repositories {
maven {
url = "https://mvn.woggioni.net/"
}
}
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
from(components["java"]) from(components["java"])

View File

@@ -1,4 +1,5 @@
wson.version = 2023.11.01 wson.version = 2024.04.04
lys.version = 2024.04.04
gitea.maven.url = https://gitea.woggioni.net/api/packages/woggioni/maven
lys.version = 2023.10.31

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

8
gradlew vendored
View File

@@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -130,10 +131,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.

View File

@@ -1,7 +1,7 @@
pluginManagement { pluginManagement {
repositories { repositories {
maven { maven {
url = 'https://woggioni.net/mvn/' url = getProperty('gitea.maven.url')
content { content {
includeGroup 'net.woggioni.gradle' includeGroup 'net.woggioni.gradle'
includeGroup 'net.woggioni.gradle.lombok' includeGroup 'net.woggioni.gradle.lombok'
@@ -19,7 +19,7 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
repositories { repositories {
maven { maven {
url = 'https://woggioni.net/mvn/' url = getProperty('gitea.maven.url')
content { content {
includeGroup 'com.lys' includeGroup 'com.lys'
} }

View File

@@ -1,5 +1,7 @@
plugins { plugins {
id 'antlr' id 'antlr'
id 'jacoco'
alias catalog.plugins.multi.release.jar
} }
configurations { configurations {
@@ -20,3 +22,7 @@ generateGrammarSource {
maxHeapSize = "64m" maxHeapSize = "64m"
arguments += ['-package', 'net.woggioni.wson.wcfg'] arguments += ['-package', 'net.woggioni.wson.wcfg']
} }
ext {
setProperty('jpms.module.name', 'net.woggioni.wson.wcfg')
}

View File

@@ -25,7 +25,8 @@ public class CompositeObjectValue implements ObjectValue {
ObjectValue result = ObjectValue.newInstance(cfg); ObjectValue result = ObjectValue.newInstance(cfg);
List<ValueIdentity> identities = new ArrayList<>(); List<ValueIdentity> identities = new ArrayList<>();
for (Value element : elements) { for (Value element : elements) {
if (element instanceof CompositeObjectValue compositeObjectValue) { if (element instanceof CompositeObjectValue) {
CompositeObjectValue compositeObjectValue = (CompositeObjectValue) element;
boolean differenceFound = false; boolean differenceFound = false;
for (int i = 0; i < compositeObjectValue.elements.size(); i++) { for (int i = 0; i < compositeObjectValue.elements.size(); i++) {
ObjectValue objectValue = (ObjectValue) compositeObjectValue.elements.get(i); ObjectValue objectValue = (ObjectValue) compositeObjectValue.elements.get(i);

View File

@@ -89,9 +89,11 @@ class ListenerImpl implements WCFGListener {
if (value == null) { if (value == null) {
List<ObjectValue> objects = elements.stream() List<ObjectValue> objects = elements.stream()
.map(it -> { .map(it -> {
if (it instanceof ObjectValue ov) if (it instanceof ObjectValue) {
ObjectValue ov = (ObjectValue) it;
return ov; return ov;
else if (it instanceof ValueHolder vh) { } else if (it instanceof ValueHolder) {
ValueHolder vh = (ValueHolder) it;
return (ObjectValue) vh.getDelegate(); return (ObjectValue) vh.getDelegate();
} else { } else {
throw newThrowable(RuntimeException.class, ""); throw newThrowable(RuntimeException.class, "");
@@ -108,32 +110,39 @@ class ListenerImpl implements WCFGListener {
private void add2Last(Value value) { private void add2Last(Value value) {
StackLevel last = tail(stack); StackLevel last = tail(stack);
if (last instanceof ArrayStackLevel asl) { if (last instanceof ArrayStackLevel) {
ArrayStackLevel asl = (ArrayStackLevel) last;
asl.value.add(value); asl.value.add(value);
if (value instanceof ValueHolder holder) { if (value instanceof ValueHolder) {
ValueHolder holder = (ValueHolder) value;
Value arrayValue = asl.getValue(); Value arrayValue = asl.getValue();
int index = arrayValue.size() - 1; int index = arrayValue.size() - 1;
holder.addDeleter(() -> arrayValue.set(index, holder.getDelegate())); holder.addDeleter(() -> arrayValue.set(index, holder.getDelegate()));
} }
} else if (last instanceof ObjectStackLevel osl) { } else if (last instanceof ObjectStackLevel) {
ObjectStackLevel osl = (ObjectStackLevel) last;
String key = osl.currentKey; String key = osl.currentKey;
Value objectValue = osl.getValue(); Value objectValue = osl.getValue();
objectValue.put(key, value); objectValue.put(key, value);
if (value instanceof ValueHolder holder) { if (value instanceof ValueHolder) {
ValueHolder holder = (ValueHolder) value;
holder.addDeleter(() -> { holder.addDeleter(() -> {
objectValue.put(key, holder.getDelegate()); objectValue.put(key, holder.getDelegate());
}); });
} }
} else if (last instanceof ExpressionStackLevel esl) { } else if (last instanceof ExpressionStackLevel) {
ExpressionStackLevel esl = (ExpressionStackLevel) last;
List<Value> values = esl.elements; List<Value> values = esl.elements;
int index = values.size(); int index = values.size();
values.add(value); values.add(value);
if (value instanceof ValueHolder holder) { if (value instanceof ValueHolder) {
ValueHolder holder = (ValueHolder) value;
holder.addDeleter(() -> { holder.addDeleter(() -> {
values.set(index, holder.getDelegate()); values.set(index, holder.getDelegate());
}); });
} }
} else if (last instanceof ExportStackLevel esl) { } else if (last instanceof ExportStackLevel) {
ExportStackLevel esl = (ExportStackLevel) last;
esl.setValue(value); esl.setValue(value);
} }
} }
@@ -320,7 +329,8 @@ class ListenerImpl implements WCFGListener {
@Override @Override
public void exitExport(WCFGParser.ExportContext ctx) { public void exitExport(WCFGParser.ExportContext ctx) {
result = pop().getValue(); result = pop().getValue();
if (result instanceof ValueHolder holder) { if (result instanceof ValueHolder) {
ValueHolder holder = (ValueHolder) result;
holder.addDeleter(() -> { holder.addDeleter(() -> {
result = holder.getDelegate(); result = holder.getDelegate();
}); });

View File

@@ -1,13 +1,15 @@
plugins { plugins {
id 'maven-publish' id 'maven-publish'
id 'jacoco'
alias catalog.plugins.multi.release.jar
alias catalog.plugins.envelope alias catalog.plugins.envelope
alias catalog.plugins.graalvm.native.image alias catalog.plugins.graalvm.native.image
alias catalog.plugins.sambal alias catalog.plugins.sambal
} }
import net.woggioni.gradle.graalvm.NativeImageTask import net.woggioni.gradle.graalvm.NativeImageTask
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
dependencies { dependencies {
implementation catalog.jwo implementation catalog.jwo
implementation catalog.picocli implementation catalog.picocli
@@ -59,16 +61,15 @@ Provider<NativeImageTask> nativeImageTaskProvider = tasks.named("nativeImage") {
buildStaticImage = true buildStaticImage = true
} }
tasks.named(BasePlugin.ASSEMBLE_TASK_NAME, Task) {
inputs.files(nativeImageTaskProvider)
}
artifacts { artifacts {
archives nativeImageTaskProvider.map(NativeImageTask.&getOutputFile) archives nativeImageTaskProvider.map(NativeImageTask.&getOutputFile)
} }
publishing { publishing {
repositories {
maven {
url = "https://mvn.woggioni.net/"
}
}
publications { publications {
myDistribution(MavenPublication) { myDistribution(MavenPublication) {
artifact envelopeJar artifact envelopeJar

View File

@@ -21,7 +21,7 @@ enum SerializationFormat {
.filter(sf -> Objects.equals(sf.name, value)) .filter(sf -> Objects.equals(sf.name, value))
.findFirst() .findFirst()
.orElseThrow(() -> { .orElseThrow(() -> {
var availableValues = Stream.of( String availableValues = Stream.of(
JSON, JSON,
JBON JBON
).map(SerializationFormat::name).collect(Collectors.joining(", ")); ).map(SerializationFormat::name).collect(Collectors.joining(", "));

View File

@@ -11,7 +11,7 @@ import picocli.CommandLine;
subcommands = {WsonCommand.class, WcfgCommand.class}) subcommands = {WsonCommand.class, WcfgCommand.class})
public class WsonCli implements Runnable { public class WsonCli implements Runnable {
public static void main(String[] args) { public static void main(String[] args) {
final var commandLine = new CommandLine(new WsonCli()); final CommandLine commandLine = new CommandLine(new WsonCli());
commandLine.setExecutionExceptionHandler((ex, cl, parseResult) -> { commandLine.setExecutionExceptionHandler((ex, cl, parseResult) -> {
log.error(ex.getMessage(), ex); log.error(ex.getMessage(), ex);
return CommandLine.ExitCode.SOFTWARE; return CommandLine.ExitCode.SOFTWARE;