Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port mvnsh changes #1228

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.maven.api.cli.Options;
import org.apache.maven.cling.invoker.ContainerCapsuleFactory;
import org.apache.maven.cling.invoker.ProtoLookup;
import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenContext;
import org.apache.maven.cling.invoker.mvn.MavenContext;
import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenInvoker;
import org.apache.maven.cling.utils.CLIReportingUtils;
import org.apache.maven.execution.MavenExecutionRequest;
Expand All @@ -44,7 +44,7 @@ public DaemonMavenInvoker(ProtoLookup protoLookup) {
}

@Override
protected void createTerminal(ResidentMavenContext context) {
protected void createTerminal(MavenContext context) {
MessageUtils.systemInstall(
builder -> {
builder.streams(
Expand All @@ -66,7 +66,7 @@ protected void createTerminal(ResidentMavenContext context) {
}

@Override
protected void doConfigureWithTerminal(ResidentMavenContext context, Terminal terminal) {
protected void doConfigureWithTerminal(MavenContext context, Terminal terminal) {
super.doConfigureWithTerminal(context, terminal);
Optional<Boolean> rawStreams = context.invokerRequest.options().rawStreams();
if (rawStreams.orElse(false)) {
Expand All @@ -86,12 +86,12 @@ private PrintStream printStream(OutputStream outputStream) {
}

@Override
protected org.apache.maven.logging.BuildEventListener doDetermineBuildEventListener(ResidentMavenContext context) {
protected org.apache.maven.logging.BuildEventListener doDetermineBuildEventListener(MavenContext context) {
return context.invokerRequest.lookup().lookup(BuildEventListener.class);
}

@Override
protected void helpOrVersionAndMayExit(ResidentMavenContext context) throws Exception {
protected void helpOrVersionAndMayExit(MavenContext context) throws Exception {
InvokerRequest invokerRequest = context.invokerRequest;
BuildEventListener buildEventListener =
context.invokerRequest.parserRequest().lookup().lookup(BuildEventListener.class);
Expand All @@ -110,7 +110,7 @@ protected void helpOrVersionAndMayExit(ResidentMavenContext context) throws Exce
}

@Override
protected void preCommands(ResidentMavenContext context) throws Exception {
protected void preCommands(MavenContext context) throws Exception {
Options mavenOptions = context.invokerRequest.options();
if (mavenOptions.verbose().orElse(false) || mavenOptions.showVersion().orElse(false)) {
context.invokerRequest
Expand All @@ -122,12 +122,12 @@ protected void preCommands(ResidentMavenContext context) throws Exception {
}

@Override
protected ContainerCapsuleFactory<ResidentMavenContext> createContainerCapsuleFactory() {
protected ContainerCapsuleFactory<MavenContext> createContainerCapsuleFactory() {
return new DaemonPlexusContainerCapsuleFactory();
}

@Override
protected int doExecute(ResidentMavenContext context, MavenExecutionRequest request) throws Exception {
protected int doExecute(MavenContext context, MavenExecutionRequest request) throws Exception {
context.logger.info(MessageUtils.builder()
.a("Processing build on daemon ")
.strong(Environment.MVND_ID.asString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import java.util.stream.Stream;

import org.apache.maven.cling.invoker.PlexusContainerCapsuleFactory;
import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenContext;
import org.apache.maven.cling.invoker.mvn.MavenContext;
import org.apache.maven.extension.internal.CoreExtensionEntry;
import org.mvndaemon.mvnd.common.Environment;

public class DaemonPlexusContainerCapsuleFactory extends PlexusContainerCapsuleFactory<ResidentMavenContext> {
public class DaemonPlexusContainerCapsuleFactory extends PlexusContainerCapsuleFactory<MavenContext> {

@Override
protected Set<String> collectExportedArtifacts(
Expand All @@ -50,7 +50,7 @@ protected Set<String> collectExportedPackages(
}

@Override
protected List<Path> parseExtClasspath(ResidentMavenContext context) throws Exception {
protected List<Path> parseExtClasspath(MavenContext context) throws Exception {
return Stream.of(Environment.MVND_EXT_CLASSPATH.asString().split(","))
.filter(s -> s != null && !s.isEmpty())
.map(Paths::get)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<groovy.version>4.0.24</groovy.version>
<jansi.version>2.4.1</jansi.version>
<jline.version>3.27.1</jline.version>
<maven.version>4.0.0-rc-1</maven.version>
<maven.version>4.0.0-rc-2-SNAPSHOT</maven.version>
<required-maven.version>3.9.9</required-maven.version>

<!-- Keep in sync with Maven -->
Expand Down
Loading