[1.x] Fix win terminal (#1040)

Fixing terminal on Windows.

changes:
* added missing jline-native to dist
* up GraalVM to 22
* introduce `--diag` on client
* up SVM version, cleanup of GraalVM params

Fixes #1032
This commit is contained in:
Tamas Cservenak
2024-06-20 13:18:09 +01:00
committed by GitHub
parent 0e27c24acf
commit 0d11bf8730
10 changed files with 44 additions and 59 deletions

View File

@@ -26,7 +26,7 @@ on:
pull_request:
env:
JAVA_VERSION: '17'
JAVA_VERSION: '22'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -34,7 +34,7 @@ concurrency:
jobs:
default-build:
name: 'Default build (without Graal)'
name: 'Default build (without GraalVM)'
if: startsWith(github.event.head_commit.message, '[release] Release ') != true
runs-on: ubuntu-latest
steps:
@@ -57,7 +57,7 @@ jobs:
path: integration-tests/target/mvnd-tests/**/daemon*.log
native-build:
name: 'Build with Graal on ${{ matrix.os }}'
name: 'Build with GraalVM on ${{ matrix.os }}'
if: startsWith(github.event.head_commit.message, '[release] Release ') != true
strategy:
fail-fast: false
@@ -92,18 +92,17 @@ jobs:
fi
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up Graal'
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Maven clean'
run: ./mvnw clean -Dmrm=false -V -B -ntp -e
- name: 'Patch Graal libs for only requiring glibc 2.12'
- name: 'Patch GraalVM libs for only requiring glibc 2.12'
if: ${{ env.OS == 'linux' }}
shell: bash
run: |

View File

@@ -26,11 +26,11 @@ on:
- '*'
env:
JAVA_VERSION: '17'
JAVA_VERSION: '22'
jobs:
build:
name: 'Build with Graal on ${{ matrix.os }}'
name: 'Build with GraalVM on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
@@ -64,18 +64,17 @@ jobs:
fi
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up Graal'
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Maven clean'
run: ./mvnw clean -Dmrm=false -B -ntp -e
- name: 'Patch Graal libs for only requiring glibc 2.12'
- name: 'Patch GraalVM libs for only requiring glibc 2.12'
if: ${{ env.OS == 'linux' }}
shell: bash
run: |
@@ -145,12 +144,11 @@ jobs:
fi
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up Graal'
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
version: ${{ env.GRAALVM_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build source distribution'

View File

@@ -58,6 +58,8 @@
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<!-- GraalVM SVM: provided, uses only to configure native image build -->
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
@@ -99,7 +101,6 @@
<maxJdkVersion>${maven.compiler.release}</maxJdkVersion>
<excludes>
<exclude>org.jline:jline-terminal-ffm</exclude>
<exclude>org.graalvm.nativeimage:svm</exclude>
</excludes>
</enforceBytecodeVersion>
</rules>
@@ -220,12 +221,14 @@
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<skip>false</skip>
<mainClass>org.mvndaemon.mvnd.client.DefaultClient</mainClass>
<imageName>mvnd</imageName>
<buildArgs>--no-server
--no-fallback
--allow-incomplete-classpath
<buildArgs>--no-fallback
-H:+UnlockExperimentalVMOptions
${graalvm-native-static-opt}
${graalvm-native-glibc-opt}
-H:IncludeResources=org/mvndaemon/mvnd/.*

View File

@@ -85,6 +85,12 @@ public class DefaultClient implements Client {
}
}
// Diag
if (Environment.DIAG.removeCommandLineOption(args) != null) {
org.jline.terminal.impl.Diag.diag(System.out);
return;
}
// Serial
if (Environment.SERIAL.removeCommandLineOption(args) != null) {
System.setProperty(Environment.SERIAL.getProperty(), Boolean.toString(true));

View File

@@ -1,33 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.mvndaemon.mvnd.client.svm;
import com.oracle.svm.core.annotate.AutomaticFeature;
import org.graalvm.nativeimage.hosted.Feature;
@AutomaticFeature
public class ReflectionRegistration implements Feature {
public void beforeAnalysis(BeforeAnalysisAccess access) {
// try {
// RuntimeReflection.register(AsiExtraField.class.getConstructors());
// } catch (SecurityException e) {
// throw new RuntimeException(e);
// }
}
}

View File

@@ -59,6 +59,8 @@ public enum Environment {
STATUS(null, null, null, OptionType.VOID, Flags.OPTIONAL, "mvnd:--status"),
/** Stop all daemon instances registered in the registry specified by <code>mvnd.registry</code> */
STOP(null, null, null, OptionType.VOID, Flags.OPTIONAL, "mvnd:--stop"),
/** Terminal diagnosis */
DIAG(null, null, null, OptionType.VOID, Flags.OPTIONAL, "mvnd:--diag"),
/** Use one thread, no log buffering and the default project builder to behave like a standard maven */
SERIAL("mvnd.serial", null, Boolean.FALSE, OptionType.VOID, Flags.OPTIONAL, "mvnd:-1", "mvnd:--serial"),

4
dist/pom.xml vendored
View File

@@ -52,6 +52,10 @@
<groupId>org.apache.maven.daemon</groupId>
<artifactId>mvnd-daemon</artifactId>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-native</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -217,7 +217,7 @@ _mvnd()
_get_comp_words_by_ref -n : cur prev
local mvnd_opts="-1"
local mvnd_long_opts="--color|--completion|--purge|--raw-streams|--serial|--status|--stop"
local mvnd_long_opts="--color|--completion|--diag|--purge|--raw-streams|--serial|--status|--stop"
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.coreExtensionsExclude|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.noModelCache|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.rawStreams|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketConnectTimeout|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home"
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}"
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}"

View File

@@ -67,6 +67,9 @@
<artifact id="org.jline:jline-terminal-jni">
<exclusion id="*:*"/>
</artifact>
<artifact id="org.jline:jline-native">
<exclusion id="*:*"/>
</artifact>
</artifactSet>
<fileSet to="/">

19
pom.xml
View File

@@ -78,11 +78,11 @@
<assertj.version>3.26.0</assertj.version>
<commons-compress.version>1.26.2</commons-compress.version>
<!-- cannot upgrade graalvm to 23.0.0 which requires JDK >= 20 -->
<graalvm.version>22.3.1</graalvm.version>
<graalvm.version>23.1.3</graalvm.version>
<graalvm.plugin.version>0.10.2</graalvm.plugin.version>
<groovy.version>4.0.21</groovy.version>
<jakarta.inject.version>1.0</jakarta.inject.version>
<jline.version>3.26.1</jline.version>
<jline.version>3.26.2</jline.version>
<maven.version>3.9.8</maven.version>
<!-- Keep in sync with Maven -->
<maven.resolver.version>1.9.20</maven.resolver.version>
@@ -126,12 +126,6 @@
<version>${commons-compress.version}</version>
</dependency>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>${graalvm.version}</version>
</dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
@@ -295,6 +289,11 @@
<artifactId>jline-terminal-ffm</artifactId>
<version>${jline.version}</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-native</artifactId>
<version>${jline.version}</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
@@ -538,6 +537,10 @@
<excludes>
<exclude>org.jline:jline-terminal-ffm</exclude>
</excludes>
<ignoredScopes>
<!-- GraalVM SVM and deps are 17+, but are provided and used only for Native -->
<ignoredScopes>provided</ignoredScopes>
</ignoredScopes>
</enforceBytecodeVersion>
</rules>
<fail>true</fail>