This commit is contained in:
16
.gitea/workflows/build.yaml
Normal file
16
.gitea/workflows/build.yaml
Normal 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
|
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@@ -6,15 +6,26 @@ pipeline {
|
||||
stages {
|
||||
stage("Build") {
|
||||
steps {
|
||||
sh "./gradlew clean assemble build"
|
||||
junit testResults: "build/test-results/test/*.xml"
|
||||
sh "./gradlew build"
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit '**/build/test-results/test/*.xml'
|
||||
}
|
||||
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,benchmark/build/libs/*.jar,wson-cli/build/libs/wson-cli-envelope-*.jar,wson-cli/build/libs/wson-cli',
|
||||
allowEmptyArchive: true,
|
||||
archiveArtifacts artifacts: '**/build/libs/*.jar,wson-cli/build/libs/wson-cli',
|
||||
allowEmptyArchive: false,
|
||||
fingerprint: true,
|
||||
onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Publish") {
|
||||
steps {
|
||||
sh "./gradlew publish"
|
||||
|
@@ -18,7 +18,6 @@ dependencies {
|
||||
|
||||
implementation catalog.jwo
|
||||
implementation catalog.xz
|
||||
implementation catalog.jcommander
|
||||
implementation catalog.jackson.databind
|
||||
|
||||
runtimeOnly project(':test-utils')
|
||||
|
49
build.gradle
49
build.gradle
@@ -1,5 +1,7 @@
|
||||
plugins {
|
||||
id 'jacoco'
|
||||
id 'maven-publish'
|
||||
alias catalog.plugins.multi.release.jar
|
||||
alias catalog.plugins.envelope apply false
|
||||
alias catalog.plugins.lombok apply false
|
||||
}
|
||||
@@ -15,7 +17,7 @@ allprojects {
|
||||
java {
|
||||
modularity.inferModulePath = true
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
vendor = JvmVendorSpec.GRAAL_VM
|
||||
}
|
||||
}
|
||||
@@ -26,9 +28,8 @@ allprojects {
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://woggioni.net/mvn/"
|
||||
url = getProperty('gitea.maven.url')
|
||||
content {
|
||||
includeGroup 'com.beust'
|
||||
includeGroup 'com.lys'
|
||||
includeGroup 'net.woggioni'
|
||||
}
|
||||
@@ -36,6 +37,15 @@ allprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
pluginManager.withPlugin('jacoco') {
|
||||
test {
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
jacocoTestReport {
|
||||
dependsOn test
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
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'
|
||||
}
|
||||
|
||||
ext {
|
||||
setProperty('jpms.module.name', 'net.woggioni.wson')
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://mvn.woggioni.net/"
|
||||
}
|
||||
}
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from(components["java"])
|
||||
|
@@ -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
|
||||
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
8
gradlew
vendored
8
gradlew
vendored
@@ -83,7 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
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.
|
||||
MAX_FD=maximum
|
||||
@@ -130,11 +131,14 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
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
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
|
@@ -1,7 +1,7 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
url = 'https://woggioni.net/mvn/'
|
||||
url = getProperty('gitea.maven.url')
|
||||
content {
|
||||
includeGroup 'net.woggioni.gradle'
|
||||
includeGroup 'net.woggioni.gradle.lombok'
|
||||
@@ -19,7 +19,7 @@ pluginManagement {
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
maven {
|
||||
url = 'https://woggioni.net/mvn/'
|
||||
url = getProperty('gitea.maven.url')
|
||||
content {
|
||||
includeGroup 'com.lys'
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
plugins {
|
||||
id 'antlr'
|
||||
id 'jacoco'
|
||||
alias catalog.plugins.multi.release.jar
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -20,3 +22,7 @@ generateGrammarSource {
|
||||
maxHeapSize = "64m"
|
||||
arguments += ['-package', 'net.woggioni.wson.wcfg']
|
||||
}
|
||||
|
||||
ext {
|
||||
setProperty('jpms.module.name', 'net.woggioni.wson.wcfg')
|
||||
}
|
@@ -25,7 +25,8 @@ public class CompositeObjectValue implements ObjectValue {
|
||||
ObjectValue result = ObjectValue.newInstance(cfg);
|
||||
List<ValueIdentity> identities = new ArrayList<>();
|
||||
for (Value element : elements) {
|
||||
if (element instanceof CompositeObjectValue compositeObjectValue) {
|
||||
if (element instanceof CompositeObjectValue) {
|
||||
CompositeObjectValue compositeObjectValue = (CompositeObjectValue) element;
|
||||
boolean differenceFound = false;
|
||||
for (int i = 0; i < compositeObjectValue.elements.size(); i++) {
|
||||
ObjectValue objectValue = (ObjectValue) compositeObjectValue.elements.get(i);
|
||||
|
@@ -89,9 +89,11 @@ class ListenerImpl implements WCFGListener {
|
||||
if (value == null) {
|
||||
List<ObjectValue> objects = elements.stream()
|
||||
.map(it -> {
|
||||
if (it instanceof ObjectValue ov)
|
||||
if (it instanceof ObjectValue) {
|
||||
ObjectValue ov = (ObjectValue) it;
|
||||
return ov;
|
||||
else if (it instanceof ValueHolder vh) {
|
||||
} else if (it instanceof ValueHolder) {
|
||||
ValueHolder vh = (ValueHolder) it;
|
||||
return (ObjectValue) vh.getDelegate();
|
||||
} else {
|
||||
throw newThrowable(RuntimeException.class, "");
|
||||
@@ -108,32 +110,39 @@ class ListenerImpl implements WCFGListener {
|
||||
|
||||
private void add2Last(Value value) {
|
||||
StackLevel last = tail(stack);
|
||||
if (last instanceof ArrayStackLevel asl) {
|
||||
if (last instanceof ArrayStackLevel) {
|
||||
ArrayStackLevel asl = (ArrayStackLevel) last;
|
||||
asl.value.add(value);
|
||||
if (value instanceof ValueHolder holder) {
|
||||
if (value instanceof ValueHolder) {
|
||||
ValueHolder holder = (ValueHolder) value;
|
||||
Value arrayValue = asl.getValue();
|
||||
int index = arrayValue.size() - 1;
|
||||
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;
|
||||
Value objectValue = osl.getValue();
|
||||
objectValue.put(key, value);
|
||||
if (value instanceof ValueHolder holder) {
|
||||
if (value instanceof ValueHolder) {
|
||||
ValueHolder holder = (ValueHolder) value;
|
||||
holder.addDeleter(() -> {
|
||||
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;
|
||||
int index = values.size();
|
||||
values.add(value);
|
||||
if (value instanceof ValueHolder holder) {
|
||||
if (value instanceof ValueHolder) {
|
||||
ValueHolder holder = (ValueHolder) value;
|
||||
holder.addDeleter(() -> {
|
||||
values.set(index, holder.getDelegate());
|
||||
});
|
||||
}
|
||||
} else if (last instanceof ExportStackLevel esl) {
|
||||
} else if (last instanceof ExportStackLevel) {
|
||||
ExportStackLevel esl = (ExportStackLevel) last;
|
||||
esl.setValue(value);
|
||||
}
|
||||
}
|
||||
@@ -320,7 +329,8 @@ class ListenerImpl implements WCFGListener {
|
||||
@Override
|
||||
public void exitExport(WCFGParser.ExportContext ctx) {
|
||||
result = pop().getValue();
|
||||
if (result instanceof ValueHolder holder) {
|
||||
if (result instanceof ValueHolder) {
|
||||
ValueHolder holder = (ValueHolder) result;
|
||||
holder.addDeleter(() -> {
|
||||
result = holder.getDelegate();
|
||||
});
|
||||
|
@@ -1,13 +1,15 @@
|
||||
plugins {
|
||||
id 'maven-publish'
|
||||
id 'jacoco'
|
||||
alias catalog.plugins.multi.release.jar
|
||||
alias catalog.plugins.envelope
|
||||
alias catalog.plugins.graalvm.native.image
|
||||
alias catalog.plugins.sambal
|
||||
}
|
||||
|
||||
import net.woggioni.gradle.graalvm.NativeImageTask
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation catalog.jwo
|
||||
implementation catalog.picocli
|
||||
@@ -59,16 +61,15 @@ Provider<NativeImageTask> nativeImageTaskProvider = tasks.named("nativeImage") {
|
||||
buildStaticImage = true
|
||||
}
|
||||
|
||||
tasks.named(BasePlugin.ASSEMBLE_TASK_NAME, Task) {
|
||||
inputs.files(nativeImageTaskProvider)
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives nativeImageTaskProvider.map(NativeImageTask.&getOutputFile)
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://mvn.woggioni.net/"
|
||||
}
|
||||
}
|
||||
publications {
|
||||
myDistribution(MavenPublication) {
|
||||
artifact envelopeJar
|
||||
|
@@ -21,7 +21,7 @@ enum SerializationFormat {
|
||||
.filter(sf -> Objects.equals(sf.name, value))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> {
|
||||
var availableValues = Stream.of(
|
||||
String availableValues = Stream.of(
|
||||
JSON,
|
||||
JBON
|
||||
).map(SerializationFormat::name).collect(Collectors.joining(", "));
|
||||
|
@@ -11,7 +11,7 @@ import picocli.CommandLine;
|
||||
subcommands = {WsonCommand.class, WcfgCommand.class})
|
||||
public class WsonCli implements Runnable {
|
||||
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) -> {
|
||||
log.error(ex.getMessage(), ex);
|
||||
return CommandLine.ExitCode.SOFTWARE;
|
||||
|
Reference in New Issue
Block a user