Compare commits

...

4 Commits

Author SHA1 Message Date
bd1bc9c997 enabled Gradle build cache
Some checks failed
CI / build (push) Failing after 3m1s
2025-01-21 12:50:34 +08:00
29b5454459 bump Gradle and lys-catalog versions
All checks were successful
CI / build (push) Successful in 3m30s
2025-01-20 23:00:02 +08:00
069e55aeb0 added publications
All checks were successful
CI / build (push) Successful in 42s
2024-04-04 09:28:42 +08:00
19162b5b97 migrated to gitea
All checks were successful
CI / build (push) Successful in 48s
2024-04-04 08:39:31 +08:00
19 changed files with 148 additions and 62 deletions

View File

@@ -0,0 +1,16 @@
name: CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: hostinger
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 publish

25
Jenkinsfile vendored
View File

@@ -6,13 +6,24 @@ pipeline {
stages {
stage("Build") {
steps {
sh "./gradlew clean assemble build"
junit testResults: "build/test-results/test/*.xml"
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,
fingerprint: true,
onlyIfSuccessful: true
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,wson-cli/build/libs/wson-cli',
allowEmptyArchive: false,
fingerprint: true,
onlyIfSuccessful: true
}
}
}
stage("Publish") {

View File

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

View File

@@ -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,8 +17,8 @@ allprojects {
java {
modularity.inferModulePath = true
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.GRAAL_VM
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.ORACLE
}
}
@@ -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,27 @@ allprojects {
}
}
}
pluginManager.withPlugin('maven-publish') {
publishing {
repositories {
maven {
name = "Gitea"
url = uri(getProperty('gitea.maven.url'))
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token ${System.getenv()["PUBLISHER_TOKEN"]}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
}
}
@@ -79,12 +110,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"])

View File

@@ -1,4 +1,7 @@
wson.version = 2023.11.01
org.gradle.caching=true
wson.version = 2025.01.21
lys.version = 2025.01.17
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
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

22
gradlew vendored
View File

@@ -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,10 +131,13 @@ 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.
@@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

20
gradlew.bat vendored
View File

@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@@ -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'
}

View File

@@ -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')
}

View File

@@ -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);

View File

@@ -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();
});

View File

@@ -1,12 +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
import net.woggioni.gradle.graalvm.NativeImageTask
import net.woggioni.gradle.envelope.EnvelopeJarTask
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
dependencies {
implementation catalog.jwo
@@ -54,23 +57,25 @@ configureNativeImage {
mergeConfiguration = true
}
Provider<EnvelopeJarTask> envelopeJarTaskProvider = tasks.named('envelopeJar')
Provider<NativeImageTask> nativeImageTaskProvider = tasks.named("nativeImage") {
useMusl = true
buildStaticImage = true
}
tasks.named(BasePlugin.ASSEMBLE_TASK_NAME, Task) {
inputs.files(nativeImageTaskProvider)
}
artifacts {
archives nativeImageTaskProvider.map(NativeImageTask.&getOutputFile)
archives envelopeJarTaskProvider.map(EnvelopeJarTask.&getArchiveFile)
}
publishing {
repositories {
maven {
url = "https://mvn.woggioni.net/"
}
}
publications {
myDistribution(MavenPublication) {
maven(MavenPublication) {
artifact envelopeJar
def host = DefaultNativePlatform.host()
artifact(

View File

@@ -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(", "));

View File

@@ -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;