mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-28 08:47:29 +00:00
Reformat the code using mvn clean process-sources
This commit is contained in:
@@ -18,12 +18,11 @@ package org.apache.maven.cli;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
|
||||
public class CliRequestBuilder {
|
||||
|
||||
CliRequest request = new CliRequest( null, null );
|
||||
CliRequest request = new CliRequest(null, null);
|
||||
|
||||
public CliRequestBuilder arguments(List<String> arguments) {
|
||||
request.args = arguments.toArray(new String[0]);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -22,12 +22,12 @@ import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/DependencyGraph.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/DependencyGraph.java
|
||||
*/
|
||||
interface DependencyGraph<K> {
|
||||
|
||||
@@ -47,17 +47,16 @@ interface DependencyGraph<K> {
|
||||
if (parts.length != 2) {
|
||||
throw new IllegalArgumentException("Invalid rule: " + rule);
|
||||
}
|
||||
List<Set<MavenProject>> deps = Stream.of(parts).map(s ->
|
||||
Pattern.compile(
|
||||
Arrays.stream(s.split("\\s*,\\s*|\\s+and\\s+"))
|
||||
.map(String::trim)
|
||||
.map(r -> r.contains(":") ? r : "*:" + r)
|
||||
.map(r -> r.replaceAll("\\.", "\\.")
|
||||
.replaceAll("\\*", ".*"))
|
||||
.collect(Collectors.joining("|"))))
|
||||
List<Set<MavenProject>> deps = Stream.of(parts).map(s -> Pattern.compile(
|
||||
Arrays.stream(s.split("\\s*,\\s*|\\s+and\\s+"))
|
||||
.map(String::trim)
|
||||
.map(r -> r.contains(":") ? r : "*:" + r)
|
||||
.map(r -> r.replaceAll("\\.", "\\.")
|
||||
.replaceAll("\\*", ".*"))
|
||||
.collect(Collectors.joining("|"))))
|
||||
.map(t -> projects.stream()
|
||||
.filter(p -> t.matcher(p.getGroupId() + ":" + p.getArtifactId()).matches())
|
||||
.collect(Collectors.toSet()))
|
||||
.filter(p -> t.matcher(p.getGroupId() + ":" + p.getArtifactId()).matches())
|
||||
.collect(Collectors.toSet()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Set<MavenProject> common = deps.get(0).stream().filter(deps.get(1)::contains).collect(Collectors.toSet());
|
||||
@@ -65,13 +64,15 @@ interface DependencyGraph<K> {
|
||||
boolean leftWildcard = parts[0].contains("*");
|
||||
boolean rightWildcard = parts[1].contains("*");
|
||||
if (leftWildcard && rightWildcard) {
|
||||
throw new IllegalArgumentException("Invalid rule: " + rule + ". Both left and right parts have wildcards and match the same project.");
|
||||
throw new IllegalArgumentException("Invalid rule: " + rule
|
||||
+ ". Both left and right parts have wildcards and match the same project.");
|
||||
} else if (leftWildcard) {
|
||||
deps.get(0).removeAll(common);
|
||||
} else if (rightWildcard) {
|
||||
deps.get(1).removeAll(common);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid rule: " + rule + ". Both left and right parts match the same project.");
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid rule: " + rule + ". Both left and right parts match the same project.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.ToLongFunction;
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,8 @@ import org.apache.maven.project.MavenProject;
|
||||
* <code>${session.request/baseDirectory}/.mvn/timing.properties</code> file. The timings file is
|
||||
* written only if <code>${session.request/baseDirectory}/.mvn</code> directory is already present.
|
||||
*
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ProjectComparator.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ProjectComparator.java
|
||||
*/
|
||||
class ProjectComparator {
|
||||
|
||||
@@ -56,8 +56,8 @@ class ProjectComparator {
|
||||
}
|
||||
|
||||
static <K> Comparator<K> create0(DependencyGraph<K> dependencyGraph,
|
||||
Map<String, AtomicLong> historicalServiceTimes,
|
||||
Function<K, String> toKey) {
|
||||
Map<String, AtomicLong> historicalServiceTimes,
|
||||
Function<K, String> toKey) {
|
||||
final long defaultServiceTime = average(historicalServiceTimes.values());
|
||||
|
||||
final Map<K, Long> serviceTimes = new HashMap<>();
|
||||
@@ -71,8 +71,7 @@ class ProjectComparator {
|
||||
}
|
||||
});
|
||||
|
||||
final Map<K, Long> projectWeights =
|
||||
calculateWeights(dependencyGraph, serviceTimes, rootProjects);
|
||||
final Map<K, Long> projectWeights = calculateWeights(dependencyGraph, serviceTimes, rootProjects);
|
||||
|
||||
return Comparator.comparingLong((ToLongFunction<K>) projectWeights::get)
|
||||
.thenComparing(toKey, String::compareTo)
|
||||
@@ -85,13 +84,13 @@ class ProjectComparator {
|
||||
}
|
||||
|
||||
private static <K> long getServiceTime(Map<String, AtomicLong> serviceTimes, K project,
|
||||
long defaultServiceTime, Function<K, String> toKey) {
|
||||
long defaultServiceTime, Function<K, String> toKey) {
|
||||
AtomicLong serviceTime = serviceTimes.get(toKey.apply(project));
|
||||
return serviceTime != null ? serviceTime.longValue() : defaultServiceTime;
|
||||
}
|
||||
|
||||
private static <K> Map<K, Long> calculateWeights(DependencyGraph<K> dependencyGraph,
|
||||
Map<K, Long> serviceTimes, Collection<K> rootProjects) {
|
||||
Map<K, Long> serviceTimes, Collection<K> rootProjects) {
|
||||
Map<K, Long> weights = new HashMap<>();
|
||||
for (K rootProject : rootProjects) {
|
||||
calculateWeights(dependencyGraph, serviceTimes, rootProject, weights);
|
||||
@@ -104,19 +103,19 @@ class ProjectComparator {
|
||||
* "exit project" is a project without downstream dependencies.
|
||||
*/
|
||||
private static <K> long calculateWeights(DependencyGraph<K> dependencyGraph,
|
||||
Map<K, Long> serviceTimes, K project, Map<K, Long> weights) {
|
||||
Map<K, Long> serviceTimes, K project, Map<K, Long> weights) {
|
||||
long weight = serviceTimes.get(project)
|
||||
+ dependencyGraph.getDownstreamProjects(project)
|
||||
.mapToLong(successor -> {
|
||||
long successorWeight;
|
||||
if (weights.containsKey(successor)) {
|
||||
successorWeight = weights.get(successor);
|
||||
} else {
|
||||
successorWeight = calculateWeights(dependencyGraph, serviceTimes, successor, weights);
|
||||
}
|
||||
return successorWeight;
|
||||
})
|
||||
.max().orElse(0);
|
||||
.mapToLong(successor -> {
|
||||
long successorWeight;
|
||||
if (weights.containsKey(successor)) {
|
||||
successorWeight = weights.get(successor);
|
||||
} else {
|
||||
successorWeight = calculateWeights(dependencyGraph, serviceTimes, successor, weights);
|
||||
}
|
||||
return successorWeight;
|
||||
})
|
||||
.max().orElse(0);
|
||||
weights.put(project, weight);
|
||||
return weight;
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.PriorityBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.maven.lifecycle.internal.BuildThreadFactory;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
@@ -36,7 +35,8 @@ import org.apache.maven.project.MavenProject;
|
||||
* Uses {@link PriorityBlockingQueue} and provided {@link Comparator} to order queue
|
||||
* {@link ProjectRunnable} tasks.
|
||||
*
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ProjectExecutorService.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ProjectExecutorService.java
|
||||
*/
|
||||
class ProjectExecutorService {
|
||||
|
||||
@@ -45,13 +45,12 @@ class ProjectExecutorService {
|
||||
private final Comparator<Runnable> taskComparator;
|
||||
|
||||
public ProjectExecutorService(final int degreeOfConcurrency,
|
||||
final Comparator<MavenProject> projectComparator) {
|
||||
final Comparator<MavenProject> projectComparator) {
|
||||
|
||||
this.taskComparator = Comparator.comparing(
|
||||
r -> ((ProjectRunnable) r).getProject(), projectComparator);
|
||||
|
||||
final BlockingQueue<Runnable> executorWorkQueue =
|
||||
new PriorityBlockingQueue<>(degreeOfConcurrency, taskComparator);
|
||||
final BlockingQueue<Runnable> executorWorkQueue = new PriorityBlockingQueue<>(degreeOfConcurrency, taskComparator);
|
||||
|
||||
executor = new ThreadPoolExecutor(degreeOfConcurrency, // corePoolSize
|
||||
degreeOfConcurrency, // maximumPoolSize
|
||||
@@ -96,7 +95,8 @@ class ProjectExecutorService {
|
||||
// for testing purposes only
|
||||
public void awaitShutdown() throws InterruptedException {
|
||||
executor.shutdown();
|
||||
while (!executor.awaitTermination(5, TimeUnit.SECONDS)) ;
|
||||
while (!executor.awaitTermination(5, TimeUnit.SECONDS))
|
||||
;
|
||||
}
|
||||
|
||||
static interface ProjectRunnable extends Runnable {
|
||||
|
@@ -19,14 +19,14 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* Reactor build queue manages reactor modules that are waiting for their upstream dependencies
|
||||
* build to finish.
|
||||
*
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ReactorBuildQueue.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ReactorBuildQueue.java
|
||||
*/
|
||||
class ReactorBuildQueue {
|
||||
|
||||
@@ -44,7 +44,7 @@ class ReactorBuildQueue {
|
||||
private final Set<MavenProject> finishedProjects;
|
||||
|
||||
public ReactorBuildQueue(Collection<MavenProject> projects,
|
||||
DependencyGraph<MavenProject> graph) {
|
||||
DependencyGraph<MavenProject> graph) {
|
||||
this.graph = graph;
|
||||
this.projects = new HashSet<>();
|
||||
this.rootProjects = new HashSet<>();
|
||||
|
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.builder;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
@@ -26,12 +27,11 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ReactorBuildStats.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/ReactorBuildStats.java
|
||||
*/
|
||||
class ReactorBuildStats {
|
||||
|
||||
@@ -51,7 +51,7 @@ class ReactorBuildStats {
|
||||
private long stopTime;
|
||||
|
||||
private ReactorBuildStats(Map<String, AtomicLong> serviceTimes,
|
||||
Map<String, AtomicLong> bottleneckTimes) {
|
||||
Map<String, AtomicLong> bottleneckTimes) {
|
||||
this.serviceTimes = ImmutableMap.copyOf(serviceTimes);
|
||||
this.bottleneckTimes = ImmutableMap.copyOf(bottleneckTimes);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class ReactorBuildStats {
|
||||
}
|
||||
|
||||
public void recordBottlenecks(Set<MavenProject> projects, int degreeOfConcurrency,
|
||||
long durationNanos) {
|
||||
long durationNanos) {
|
||||
// only projects that result in single-threaded builds
|
||||
if (projects.size() == 1) {
|
||||
projects.forEach(p -> bottleneckTimes.get(projectGA(p)).addAndGet(durationNanos));
|
||||
|
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.builder;
|
||||
|
||||
import groovy.lang.Binding;
|
||||
import groovy.lang.GroovyShell;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -29,14 +31,10 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.enterprise.inject.Default;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import groovy.lang.Binding;
|
||||
import groovy.lang.GroovyShell;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
|
||||
import org.apache.maven.lifecycle.internal.ProjectBuildList;
|
||||
@@ -52,7 +50,8 @@ import org.slf4j.LoggerFactory;
|
||||
* Trivial Maven {@link Builder} implementation. All interesting stuff happens in
|
||||
* {@link SmartBuilderImpl} .
|
||||
*
|
||||
* File origin: https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/SmartBuilder.java
|
||||
* File origin:
|
||||
* https://github.com/takari/takari-smart-builder/blob/takari-smart-builder-0.6.1/src/main/java/io/takari/maven/builder/smart/SmartBuilder.java
|
||||
*/
|
||||
@Singleton
|
||||
@Named("smart")
|
||||
@@ -69,7 +68,6 @@ public class SmartBuilder implements Builder {
|
||||
|
||||
private final LifecycleModuleBuilder moduleBuilder;
|
||||
|
||||
|
||||
@Inject
|
||||
public SmartBuilder(LifecycleModuleBuilder moduleBuilder) {
|
||||
this.moduleBuilder = moduleBuilder;
|
||||
@@ -77,8 +75,8 @@ public class SmartBuilder implements Builder {
|
||||
|
||||
@Override
|
||||
public void build(final MavenSession session, final ReactorContext reactorContext,
|
||||
ProjectBuildList projectBuilds, final List<TaskSegment> taskSegments,
|
||||
ReactorBuildStatus reactorBuildStatus) throws ExecutionException, InterruptedException {
|
||||
ProjectBuildList projectBuilds, final List<TaskSegment> taskSegments,
|
||||
ReactorBuildStatus reactorBuildStatus) throws ExecutionException, InterruptedException {
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
@@ -132,7 +130,6 @@ public class SmartBuilder implements Builder {
|
||||
list.add(result.toString());
|
||||
}
|
||||
|
||||
|
||||
String topRule = session.getTopLevelProject().getProperties()
|
||||
.getProperty(MVND_BUILDER_RULES);
|
||||
if (topRule != null) {
|
||||
@@ -162,9 +159,8 @@ public class SmartBuilder implements Builder {
|
||||
List<Map.Entry<TaskSegment, ReactorBuildStats>> allstats = new ArrayList<>();
|
||||
for (TaskSegment taskSegment : taskSegments) {
|
||||
Set<MavenProject> projects = projectBuilds.getByTaskSegment(taskSegment).getProjects();
|
||||
ReactorBuildStats stats =
|
||||
new SmartBuilderImpl(moduleBuilder, session, reactorContext, taskSegment, projects, graph)
|
||||
.build();
|
||||
ReactorBuildStats stats = new SmartBuilderImpl(moduleBuilder, session, reactorContext, taskSegment, projects, graph)
|
||||
.build();
|
||||
allstats.add(new AbstractMap.SimpleEntry<>(taskSegment, stats));
|
||||
}
|
||||
|
||||
@@ -183,8 +179,7 @@ public class SmartBuilder implements Builder {
|
||||
|
||||
final long walltimeReactor = stats.walltimeTime(TimeUnit.NANOSECONDS);
|
||||
final long walltimeService = stats.totalServiceTime(TimeUnit.NANOSECONDS);
|
||||
final String effectiveConcurrency =
|
||||
String.format("%2.2f", ((double) walltimeService) / walltimeReactor);
|
||||
final String effectiveConcurrency = String.format("%2.2f", ((double) walltimeService) / walltimeReactor);
|
||||
logger.info(
|
||||
"Segment walltime {} s, segment projects service time {} s, effective/maximum degree of concurrency {}/{}",
|
||||
TimeUnit.NANOSECONDS.toSeconds(walltimeReactor),
|
||||
|
@@ -30,13 +30,26 @@ package org.jboss.fuse.mvnd.builder;
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.execution.BuildFailure;
|
||||
import org.apache.maven.execution.BuildSuccess;
|
||||
import org.apache.maven.execution.BuildSummary;
|
||||
@@ -79,8 +92,8 @@ class SmartBuilderImpl {
|
||||
private final ReactorBuildStats stats;
|
||||
|
||||
SmartBuilderImpl(LifecycleModuleBuilder lifecycleModuleBuilder, MavenSession session,
|
||||
ReactorContext reactorContext, TaskSegment taskSegment,
|
||||
Set<MavenProject> projects, DependencyGraph<MavenProject> graph) {
|
||||
ReactorContext reactorContext, TaskSegment taskSegment,
|
||||
Set<MavenProject> projects, DependencyGraph<MavenProject> graph) {
|
||||
this.lifecycleModuleBuilder = lifecycleModuleBuilder;
|
||||
this.rootSession = session;
|
||||
this.reactorContext = reactorContext;
|
||||
|
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.ToLongFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jboss.fuse.mvnd.client.DaemonCompatibilitySpec;
|
||||
import org.jboss.fuse.mvnd.client.DaemonCompatibilitySpec.Result;
|
||||
import org.jboss.fuse.mvnd.client.DaemonExpirationStatus;
|
||||
@@ -36,7 +35,8 @@ import static org.jboss.fuse.mvnd.client.DaemonExpirationStatus.QUIET_EXPIRE;
|
||||
import static org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationResult.NOT_TRIGGERED;
|
||||
|
||||
/**
|
||||
* File origin: https://github.com/gradle/gradle/blob/v5.6.2/subprojects/launcher/src/main/java/org/gradle/launcher/daemon/server/MasterExpirationStrategy.java
|
||||
* File origin:
|
||||
* https://github.com/gradle/gradle/blob/v5.6.2/subprojects/launcher/src/main/java/org/gradle/launcher/daemon/server/MasterExpirationStrategy.java
|
||||
*/
|
||||
public class DaemonExpiration {
|
||||
|
||||
@@ -49,13 +49,12 @@ public class DaemonExpiration {
|
||||
}
|
||||
|
||||
public static DaemonExpirationStrategy master() {
|
||||
return any (
|
||||
any( gcTrashing(), lowHeapSpace(), lowNonHeap() ),
|
||||
all( compatible(), duplicateGracePeriod(), notMostRecentlyUsed() ),
|
||||
idleTimeout( Server::getIdleTimeout ),
|
||||
all( duplicateGracePeriod(), notMostRecentlyUsed(), lowMemory(0.05) ),
|
||||
registryUnavailable()
|
||||
);
|
||||
return any(
|
||||
any(gcTrashing(), lowHeapSpace(), lowNonHeap()),
|
||||
all(compatible(), duplicateGracePeriod(), notMostRecentlyUsed()),
|
||||
idleTimeout(Server::getIdleTimeout),
|
||||
all(duplicateGracePeriod(), notMostRecentlyUsed(), lowMemory(0.05)),
|
||||
registryUnavailable());
|
||||
}
|
||||
|
||||
static DaemonExpirationStrategy gcTrashing() {
|
||||
@@ -79,7 +78,7 @@ public class DaemonExpiration {
|
||||
}
|
||||
|
||||
static DaemonExpirationStrategy duplicateGracePeriod() {
|
||||
return idleTimeout( daemon -> DUPLICATE_DAEMON_GRACE_PERIOD_MS );
|
||||
return idleTimeout(daemon -> DUPLICATE_DAEMON_GRACE_PERIOD_MS);
|
||||
}
|
||||
|
||||
private static final long HOUR = 60 * 60 * 1000;
|
||||
@@ -108,11 +107,11 @@ public class DaemonExpiration {
|
||||
|
||||
static DaemonExpirationStrategy notMostRecentlyUsed() {
|
||||
return daemon -> daemon.getRegistry().getIdle().stream()
|
||||
.max(Comparator.comparingLong(DaemonInfo::getLastBusy))
|
||||
.map(d -> Objects.equals(d.getUid(), daemon.getUid()))
|
||||
.orElse(false)
|
||||
? new DaemonExpirationResult(GRACEFUL_EXPIRE, "not recently used")
|
||||
: NOT_TRIGGERED;
|
||||
.max(Comparator.comparingLong(DaemonInfo::getLastBusy))
|
||||
.map(d -> Objects.equals(d.getUid(), daemon.getUid()))
|
||||
.orElse(false)
|
||||
? new DaemonExpirationResult(GRACEFUL_EXPIRE, "not recently used")
|
||||
: NOT_TRIGGERED;
|
||||
}
|
||||
|
||||
static DaemonExpirationStrategy registryUnavailable() {
|
||||
@@ -121,7 +120,8 @@ public class DaemonExpiration {
|
||||
if (!Files.isReadable(daemon.getRegistry().getRegistryFile())) {
|
||||
return new DaemonExpirationResult(GRACEFUL_EXPIRE, "after the daemon registry became unreadable");
|
||||
} else if (daemon.getRegistry().get(daemon.getUid()) == null) {
|
||||
return new DaemonExpirationResult(GRACEFUL_EXPIRE, "after the daemon was no longer found in the daemon registry");
|
||||
return new DaemonExpirationResult(GRACEFUL_EXPIRE,
|
||||
"after the daemon was no longer found in the daemon registry");
|
||||
} else {
|
||||
return NOT_TRIGGERED;
|
||||
}
|
||||
|
@@ -15,10 +15,6 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.daemon;
|
||||
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.Busy;
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.StopRequested;
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.Stopped;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -38,12 +34,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.apache.maven.cli.CliRequest;
|
||||
import org.apache.maven.cli.CliRequestBuilder;
|
||||
import org.apache.maven.cli.DaemonMavenCli;
|
||||
import org.jboss.fuse.mvnd.client.DefaultClient;
|
||||
import org.jboss.fuse.mvnd.client.Environment;
|
||||
import org.jboss.fuse.mvnd.client.DaemonConnection;
|
||||
import org.jboss.fuse.mvnd.client.DaemonException;
|
||||
import org.jboss.fuse.mvnd.client.DaemonExpirationStatus;
|
||||
@@ -51,22 +44,27 @@ import org.jboss.fuse.mvnd.client.DaemonInfo;
|
||||
import org.jboss.fuse.mvnd.client.DaemonRegistry;
|
||||
import org.jboss.fuse.mvnd.client.DaemonState;
|
||||
import org.jboss.fuse.mvnd.client.DaemonStopEvent;
|
||||
import org.jboss.fuse.mvnd.client.DefaultClient;
|
||||
import org.jboss.fuse.mvnd.client.Environment;
|
||||
import org.jboss.fuse.mvnd.client.Layout;
|
||||
import org.jboss.fuse.mvnd.client.Message;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildEvent;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildEvent.Type;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildException;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildMessage;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildRequest;
|
||||
import org.jboss.fuse.mvnd.client.Message.MessageSerializer;
|
||||
import org.jboss.fuse.mvnd.client.Message.BuildEvent.Type;
|
||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationResult;
|
||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStrategy;
|
||||
import org.jboss.fuse.mvnd.logging.smart.AbstractLoggingSpy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Server implements AutoCloseable, Runnable {
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.Busy;
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.StopRequested;
|
||||
import static org.jboss.fuse.mvnd.client.DaemonState.Stopped;
|
||||
|
||||
public class Server implements AutoCloseable, Runnable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
|
||||
|
||||
@@ -207,19 +205,19 @@ public class Server implements AutoCloseable, Runnable {
|
||||
LOGGER.debug("Expiration check running");
|
||||
final DaemonExpirationResult result = strategy.checkExpiration(this);
|
||||
switch (result.getStatus()) {
|
||||
case DO_NOT_EXPIRE:
|
||||
break;
|
||||
case QUIET_EXPIRE:
|
||||
requestStop(result.getReason());
|
||||
break;
|
||||
case GRACEFUL_EXPIRE:
|
||||
onExpire(result.getReason(), result.getStatus());
|
||||
requestStop(result.getReason());
|
||||
break;
|
||||
case IMMEDIATE_EXPIRE:
|
||||
onExpire(result.getReason(), result.getStatus());
|
||||
requestForcefulStop(result.getReason());
|
||||
break;
|
||||
case DO_NOT_EXPIRE:
|
||||
break;
|
||||
case QUIET_EXPIRE:
|
||||
requestStop(result.getReason());
|
||||
break;
|
||||
case GRACEFUL_EXPIRE:
|
||||
onExpire(result.getReason(), result.getStatus());
|
||||
requestStop(result.getReason());
|
||||
break;
|
||||
case IMMEDIATE_EXPIRE:
|
||||
onExpire(result.getReason(), result.getStatus());
|
||||
requestForcefulStop(result.getReason());
|
||||
break;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("Problem in daemon expiration check", t);
|
||||
@@ -246,24 +244,24 @@ public class Server implements AutoCloseable, Runnable {
|
||||
while (true) {
|
||||
try {
|
||||
switch (getState()) {
|
||||
case Idle:
|
||||
case Busy:
|
||||
LOGGER.debug("daemon is running. Sleeping until state changes.");
|
||||
condition.await();
|
||||
break;
|
||||
case Canceled:
|
||||
LOGGER.debug("cancel requested.");
|
||||
cancelNow();
|
||||
break;
|
||||
case Broken:
|
||||
throw new IllegalStateException("This daemon is in a broken state.");
|
||||
case StopRequested:
|
||||
LOGGER.debug("daemon stop has been requested. Sleeping until state changes.");
|
||||
condition.await();
|
||||
break;
|
||||
case Stopped:
|
||||
LOGGER.debug("daemon has stopped.");
|
||||
return true;
|
||||
case Idle:
|
||||
case Busy:
|
||||
LOGGER.debug("daemon is running. Sleeping until state changes.");
|
||||
condition.await();
|
||||
break;
|
||||
case Canceled:
|
||||
LOGGER.debug("cancel requested.");
|
||||
cancelNow();
|
||||
break;
|
||||
case Broken:
|
||||
throw new IllegalStateException("This daemon is in a broken state.");
|
||||
case StopRequested:
|
||||
LOGGER.debug("daemon stop has been requested. Sleeping until state changes.");
|
||||
condition.await();
|
||||
break;
|
||||
case Stopped:
|
||||
LOGGER.debug("daemon has stopped.");
|
||||
return true;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new DaemonException.InterruptedException(e);
|
||||
@@ -300,17 +298,17 @@ public class Server implements AutoCloseable, Runnable {
|
||||
private void beginStopping() {
|
||||
DaemonState state = getState();
|
||||
switch (state) {
|
||||
case Idle:
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case Broken:
|
||||
updateState(StopRequested);
|
||||
break;
|
||||
case StopRequested:
|
||||
case Stopped:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Daemon is in unexpected state: " + state);
|
||||
case Idle:
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case Broken:
|
||||
updateState(StopRequested);
|
||||
break;
|
||||
case StopRequested:
|
||||
case Stopped:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Daemon is in unexpected state: " + state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,18 +317,18 @@ public class Server implements AutoCloseable, Runnable {
|
||||
try {
|
||||
DaemonState state = getState();
|
||||
switch (state) {
|
||||
case Idle:
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case Broken:
|
||||
case StopRequested:
|
||||
LOGGER.debug("Marking daemon stopped due to {}. The daemon is running a build: {}", reason, state == Busy);
|
||||
updateState(Stopped);
|
||||
break;
|
||||
case Stopped:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Daemon is in unexpected state: " + state);
|
||||
case Idle:
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case Broken:
|
||||
case StopRequested:
|
||||
LOGGER.debug("Marking daemon stopped due to {}. The daemon is running a build: {}", reason, state == Busy);
|
||||
updateState(Stopped);
|
||||
break;
|
||||
case Stopped:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Daemon is in unexpected state: " + state);
|
||||
}
|
||||
} finally {
|
||||
stateLock.unlock();
|
||||
@@ -340,12 +338,12 @@ public class Server implements AutoCloseable, Runnable {
|
||||
private void cancelNow() {
|
||||
long time = System.currentTimeMillis() + DefaultClient.CANCEL_TIMEOUT;
|
||||
|
||||
// LOGGER.debug("Cancel requested: will wait for daemon to become idle.");
|
||||
// try {
|
||||
// cancellationToken.cancel();
|
||||
// } catch (Exception ex) {
|
||||
// LOGGER.error("Cancel processing failed. Will continue.", ex);
|
||||
// }
|
||||
// LOGGER.debug("Cancel requested: will wait for daemon to become idle.");
|
||||
// try {
|
||||
// cancellationToken.cancel();
|
||||
// } catch (Exception ex) {
|
||||
// LOGGER.error("Cancel processing failed. Will continue.", ex);
|
||||
// }
|
||||
|
||||
stateLock.lock();
|
||||
try {
|
||||
@@ -353,20 +351,20 @@ public class Server implements AutoCloseable, Runnable {
|
||||
while ((rem = System.currentTimeMillis() - time) > 0) {
|
||||
try {
|
||||
switch (getState()) {
|
||||
case Idle:
|
||||
LOGGER.debug("Cancel: daemon is idle now.");
|
||||
return;
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case StopRequested:
|
||||
LOGGER.debug("Cancel: daemon is busy, sleeping until state changes.");
|
||||
condition.await(rem, TimeUnit.MILLISECONDS);
|
||||
break;
|
||||
case Broken:
|
||||
throw new IllegalStateException("This daemon is in a broken state.");
|
||||
case Stopped:
|
||||
LOGGER.debug("Cancel: daemon has stopped.");
|
||||
return;
|
||||
case Idle:
|
||||
LOGGER.debug("Cancel: daemon is idle now.");
|
||||
return;
|
||||
case Busy:
|
||||
case Canceled:
|
||||
case StopRequested:
|
||||
LOGGER.debug("Cancel: daemon is busy, sleeping until state changes.");
|
||||
condition.await(rem, TimeUnit.MILLISECONDS);
|
||||
break;
|
||||
case Broken:
|
||||
throw new IllegalStateException("This daemon is in a broken state.");
|
||||
case Stopped:
|
||||
LOGGER.debug("Cancel: daemon has stopped.");
|
||||
return;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new DaemonException.InterruptedException(e);
|
||||
@@ -379,7 +377,8 @@ public class Server implements AutoCloseable, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
static final Message STOP = new Message() { };
|
||||
static final Message STOP = new Message() {
|
||||
};
|
||||
|
||||
private void handle(DaemonConnection<Message> connection, BuildRequest buildRequest) {
|
||||
updateState(Busy);
|
||||
|
@@ -19,7 +19,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||
import org.apache.maven.execution.ExecutionEvent;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
@@ -61,30 +60,30 @@ public abstract class AbstractLoggingSpy extends AbstractEventSpy {
|
||||
if (event instanceof ExecutionEvent) {
|
||||
ExecutionEvent executionEvent = (ExecutionEvent) event;
|
||||
switch (executionEvent.getType()) {
|
||||
case SessionStarted:
|
||||
notifySessionStart(executionEvent);
|
||||
break;
|
||||
case SessionEnded:
|
||||
notifySessionFinish(executionEvent);
|
||||
break;
|
||||
case ProjectStarted:
|
||||
notifyProjectBuildStart(executionEvent);
|
||||
break;
|
||||
case ProjectSucceeded:
|
||||
case ProjectFailed:
|
||||
case ProjectSkipped:
|
||||
notifyProjectBuildFinish(executionEvent);
|
||||
break;
|
||||
case MojoStarted:
|
||||
notifyMojoExecutionStart(executionEvent);
|
||||
break;
|
||||
case MojoSucceeded:
|
||||
case MojoSkipped:
|
||||
case MojoFailed:
|
||||
notifyMojoExecutionFinish(executionEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case SessionStarted:
|
||||
notifySessionStart(executionEvent);
|
||||
break;
|
||||
case SessionEnded:
|
||||
notifySessionFinish(executionEvent);
|
||||
break;
|
||||
case ProjectStarted:
|
||||
notifyProjectBuildStart(executionEvent);
|
||||
break;
|
||||
case ProjectSucceeded:
|
||||
case ProjectFailed:
|
||||
case ProjectSkipped:
|
||||
notifyProjectBuildFinish(executionEvent);
|
||||
break;
|
||||
case MojoStarted:
|
||||
notifyMojoExecutionStart(executionEvent);
|
||||
break;
|
||||
case MojoSucceeded:
|
||||
case MojoSkipped:
|
||||
case MojoFailed:
|
||||
notifyMojoExecutionFinish(executionEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ package org.jboss.fuse.mvnd.logging.smart;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.eventspy.EventSpy;
|
||||
|
||||
@Singleton
|
||||
|
@@ -18,7 +18,6 @@ package org.jboss.fuse.mvnd.logging.smart;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jline.terminal.Size;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
|
@@ -15,14 +15,12 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.logging.smart;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.PatternLayout;
|
||||
import ch.qos.logback.classic.pattern.ClassicConverter;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import java.util.Map;
|
||||
import org.apache.maven.shared.utils.logging.LoggerLevelRenderer;
|
||||
import org.apache.maven.shared.utils.logging.MessageUtils;
|
||||
|
||||
@@ -69,14 +67,14 @@ public class ProjectBuildLogAppender extends AppenderBase<ILoggingEvent> {
|
||||
LoggerLevelRenderer llr = MessageUtils.level();
|
||||
Level level = event.getLevel();
|
||||
switch (level.toInt()) {
|
||||
case Level.ERROR_INT:
|
||||
return llr.error(level.toString());
|
||||
case Level.WARN_INT:
|
||||
return llr.warning(level.toString());
|
||||
case Level.INFO_INT:
|
||||
return llr.info(level.toString());
|
||||
default:
|
||||
return llr.debug(level.toString());
|
||||
case Level.ERROR_INT:
|
||||
return llr.error(level.toString());
|
||||
case Level.WARN_INT:
|
||||
return llr.warning(level.toString());
|
||||
case Level.INFO_INT:
|
||||
return llr.info(level.toString());
|
||||
default:
|
||||
return llr.debug(level.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,82 +21,74 @@ package org.jboss.fuse.mvnd.plugin;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
import org.apache.maven.model.Plugin;
|
||||
|
||||
/**
|
||||
* File origin: https://github.com/apache/maven/blob/maven-3.6.1/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
|
||||
* File origin:
|
||||
* https://github.com/apache/maven/blob/maven-3.6.1/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
class CliCacheUtils
|
||||
{
|
||||
class CliCacheUtils {
|
||||
|
||||
public static int pluginHashCode( Plugin plugin )
|
||||
{
|
||||
public static int pluginHashCode(Plugin plugin) {
|
||||
int hash = 17;
|
||||
|
||||
hash = hash * 31 + Objects.hashCode( plugin.getGroupId() );
|
||||
hash = hash * 31 + Objects.hashCode( plugin.getArtifactId() );
|
||||
hash = hash * 31 + Objects.hashCode( plugin.getVersion() );
|
||||
hash = hash * 31 + Objects.hashCode(plugin.getGroupId());
|
||||
hash = hash * 31 + Objects.hashCode(plugin.getArtifactId());
|
||||
hash = hash * 31 + Objects.hashCode(plugin.getVersion());
|
||||
|
||||
hash = hash * 31 + ( plugin.isExtensions() ? 1 : 0 );
|
||||
hash = hash * 31 + (plugin.isExtensions() ? 1 : 0);
|
||||
|
||||
for ( Dependency dependency : plugin.getDependencies() )
|
||||
{
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getGroupId() );
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getArtifactId() );
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getVersion() );
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getType() );
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getClassifier() );
|
||||
hash = hash * 31 + Objects.hashCode( dependency.getScope() );
|
||||
for (Dependency dependency : plugin.getDependencies()) {
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getGroupId());
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getArtifactId());
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getVersion());
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getType());
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getClassifier());
|
||||
hash = hash * 31 + Objects.hashCode(dependency.getScope());
|
||||
|
||||
for ( Exclusion exclusion : dependency.getExclusions() )
|
||||
{
|
||||
hash = hash * 31 + Objects.hashCode( exclusion.getGroupId() );
|
||||
hash = hash * 31 + Objects.hashCode( exclusion.getArtifactId() );
|
||||
for (Exclusion exclusion : dependency.getExclusions()) {
|
||||
hash = hash * 31 + Objects.hashCode(exclusion.getGroupId());
|
||||
hash = hash * 31 + Objects.hashCode(exclusion.getArtifactId());
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static boolean pluginEquals( Plugin a, Plugin b )
|
||||
{
|
||||
return Objects.equals( a.getArtifactId(), b.getArtifactId() ) //
|
||||
&& Objects.equals( a.getGroupId(), b.getGroupId() ) //
|
||||
&& Objects.equals( a.getVersion(), b.getVersion() ) //
|
||||
&& a.isExtensions() == b.isExtensions() //
|
||||
&& dependenciesEquals( a.getDependencies(), b.getDependencies() );
|
||||
public static boolean pluginEquals(Plugin a, Plugin b) {
|
||||
return Objects.equals(a.getArtifactId(), b.getArtifactId()) //
|
||||
&& Objects.equals(a.getGroupId(), b.getGroupId()) //
|
||||
&& Objects.equals(a.getVersion(), b.getVersion()) //
|
||||
&& a.isExtensions() == b.isExtensions() //
|
||||
&& dependenciesEquals(a.getDependencies(), b.getDependencies());
|
||||
}
|
||||
|
||||
private static boolean dependenciesEquals( List<Dependency> a, List<Dependency> b )
|
||||
{
|
||||
if ( a.size() != b.size() )
|
||||
{
|
||||
private static boolean dependenciesEquals(List<Dependency> a, List<Dependency> b) {
|
||||
if (a.size() != b.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Iterator<Dependency> aI = a.iterator();
|
||||
Iterator<Dependency> bI = b.iterator();
|
||||
|
||||
while ( aI.hasNext() )
|
||||
{
|
||||
while (aI.hasNext()) {
|
||||
Dependency aD = aI.next();
|
||||
Dependency bD = bI.next();
|
||||
|
||||
boolean r = Objects.equals( aD.getGroupId(), bD.getGroupId() ) //
|
||||
&& Objects.equals( aD.getArtifactId(), bD.getArtifactId() ) //
|
||||
&& Objects.equals( aD.getVersion(), bD.getVersion() ) //
|
||||
&& Objects.equals( aD.getType(), bD.getType() ) //
|
||||
&& Objects.equals( aD.getClassifier(), bD.getClassifier() ) //
|
||||
&& Objects.equals( aD.getScope(), bD.getScope() );
|
||||
boolean r = Objects.equals(aD.getGroupId(), bD.getGroupId()) //
|
||||
&& Objects.equals(aD.getArtifactId(), bD.getArtifactId()) //
|
||||
&& Objects.equals(aD.getVersion(), bD.getVersion()) //
|
||||
&& Objects.equals(aD.getType(), bD.getType()) //
|
||||
&& Objects.equals(aD.getClassifier(), bD.getClassifier()) //
|
||||
&& Objects.equals(aD.getScope(), bD.getScope());
|
||||
|
||||
r &= exclusionsEquals( aD.getExclusions(), bD.getExclusions() );
|
||||
r &= exclusionsEquals(aD.getExclusions(), bD.getExclusions());
|
||||
|
||||
if ( !r )
|
||||
{
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -104,26 +96,22 @@ class CliCacheUtils
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean exclusionsEquals( List<Exclusion> a, List<Exclusion> b )
|
||||
{
|
||||
if ( a.size() != b.size() )
|
||||
{
|
||||
private static boolean exclusionsEquals(List<Exclusion> a, List<Exclusion> b) {
|
||||
if (a.size() != b.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Iterator<Exclusion> aI = a.iterator();
|
||||
Iterator<Exclusion> bI = b.iterator();
|
||||
|
||||
while ( aI.hasNext() )
|
||||
{
|
||||
while (aI.hasNext()) {
|
||||
Exclusion aD = aI.next();
|
||||
Exclusion bD = bI.next();
|
||||
|
||||
boolean r = Objects.equals( aD.getGroupId(), bD.getGroupId() ) //
|
||||
&& Objects.equals( aD.getArtifactId(), bD.getArtifactId() );
|
||||
boolean r = Objects.equals(aD.getGroupId(), bD.getGroupId()) //
|
||||
&& Objects.equals(aD.getArtifactId(), bD.getArtifactId());
|
||||
|
||||
if ( !r )
|
||||
{
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -40,11 +40,9 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.enterprise.inject.Default;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.model.Plugin;
|
||||
@@ -64,20 +62,19 @@ import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* Default PluginCache implementation. Assumes cached data does not change.
|
||||
*
|
||||
* File origin: https://github.com/apache/maven/blob/maven-3.6.2/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
|
||||
* File origin:
|
||||
* https://github.com/apache/maven/blob/maven-3.6.2/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
|
||||
*/
|
||||
@Singleton
|
||||
@Named
|
||||
@Default
|
||||
public class CliPluginRealmCache
|
||||
implements PluginRealmCache, Disposable
|
||||
{
|
||||
implements PluginRealmCache, Disposable {
|
||||
/**
|
||||
* CacheKey
|
||||
*/
|
||||
protected static class CacheKey
|
||||
implements Key
|
||||
{
|
||||
implements Key {
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
@@ -96,79 +93,69 @@ public class CliPluginRealmCache
|
||||
private final int hashCode;
|
||||
|
||||
public CacheKey(Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader> foreignImports,
|
||||
DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
|
||||
RepositorySystemSession session )
|
||||
{
|
||||
DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
|
||||
RepositorySystemSession session) {
|
||||
this.plugin = plugin.clone();
|
||||
this.workspace = RepositoryUtils.getWorkspace( session );
|
||||
this.workspace = RepositoryUtils.getWorkspace(session);
|
||||
this.localRepo = session.getLocalRepository();
|
||||
this.repositories = new ArrayList<>( repositories.size() );
|
||||
for ( RemoteRepository repository : repositories )
|
||||
{
|
||||
if ( repository.isRepositoryManager() )
|
||||
{
|
||||
this.repositories.addAll( repository.getMirroredRepositories() );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.repositories.add( repository );
|
||||
this.repositories = new ArrayList<>(repositories.size());
|
||||
for (RemoteRepository repository : repositories) {
|
||||
if (repository.isRepositoryManager()) {
|
||||
this.repositories.addAll(repository.getMirroredRepositories());
|
||||
} else {
|
||||
this.repositories.add(repository);
|
||||
}
|
||||
}
|
||||
this.parentRealm = parentRealm;
|
||||
this.foreignImports =
|
||||
( foreignImports != null ) ? foreignImports : Collections.<String, ClassLoader>emptyMap();
|
||||
this.foreignImports = (foreignImports != null) ? foreignImports : Collections.<String, ClassLoader> emptyMap();
|
||||
this.filter = dependencyFilter;
|
||||
|
||||
int hash = 17;
|
||||
hash = hash * 31 + CliCacheUtils.pluginHashCode( plugin );
|
||||
hash = hash * 31 + Objects.hashCode( workspace );
|
||||
hash = hash * 31 + Objects.hashCode( localRepo );
|
||||
hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories );
|
||||
hash = hash * 31 + Objects.hashCode( parentRealm );
|
||||
hash = hash * 31 + CliCacheUtils.pluginHashCode(plugin);
|
||||
hash = hash * 31 + Objects.hashCode(workspace);
|
||||
hash = hash * 31 + Objects.hashCode(localRepo);
|
||||
hash = hash * 31 + RepositoryUtils.repositoriesHashCode(repositories);
|
||||
hash = hash * 31 + Objects.hashCode(parentRealm);
|
||||
hash = hash * 31 + this.foreignImports.hashCode();
|
||||
hash = hash * 31 + Objects.hashCode( dependencyFilter );
|
||||
hash = hash * 31 + Objects.hashCode(dependencyFilter);
|
||||
this.hashCode = hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return plugin.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( o == this )
|
||||
{
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !( o instanceof CacheKey ) )
|
||||
{
|
||||
if (!(o instanceof CacheKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheKey that = (CacheKey) o;
|
||||
|
||||
return parentRealm == that.parentRealm
|
||||
&& CliCacheUtils.pluginEquals( plugin, that.plugin )
|
||||
&& Objects.equals( workspace, that.workspace )
|
||||
&& Objects.equals( localRepo, that.localRepo )
|
||||
&& RepositoryUtils.repositoriesEquals( this.repositories, that.repositories )
|
||||
&& Objects.equals( filter, that.filter )
|
||||
&& Objects.equals( foreignImports, that.foreignImports );
|
||||
&& CliCacheUtils.pluginEquals(plugin, that.plugin)
|
||||
&& Objects.equals(workspace, that.workspace)
|
||||
&& Objects.equals(localRepo, that.localRepo)
|
||||
&& RepositoryUtils.repositoriesEquals(this.repositories, that.repositories)
|
||||
&& Objects.equals(filter, that.filter)
|
||||
&& Objects.equals(foreignImports, that.foreignImports);
|
||||
}
|
||||
}
|
||||
|
||||
interface RecordValidator {
|
||||
void validateRecords();
|
||||
|
||||
ValidableCacheRecord newRecord(ClassRealm pluginRealm, List<Artifact> pluginArtifacts);
|
||||
}
|
||||
|
||||
@@ -177,15 +164,14 @@ public class CliPluginRealmCache
|
||||
public ValidableCacheRecord(ClassRealm realm, List<Artifact> artifacts) {
|
||||
super(realm, artifacts);
|
||||
}
|
||||
|
||||
public abstract boolean isValid();
|
||||
|
||||
public void dispose() {
|
||||
ClassRealm realm = getRealm();
|
||||
try
|
||||
{
|
||||
realm.getWorld().disposeRealm( realm.getId() );
|
||||
}
|
||||
catch ( NoSuchRealmException e )
|
||||
{
|
||||
try {
|
||||
realm.getWorld().disposeRealm(realm.getId());
|
||||
} catch (NoSuchRealmException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -210,6 +196,7 @@ public class CliPluginRealmCache
|
||||
final Path path;
|
||||
final FileTime lastModifiedTime;
|
||||
final Object fileKey;
|
||||
|
||||
ArtifactTimestamp(Path path) {
|
||||
this.path = path;
|
||||
try {
|
||||
@@ -220,25 +207,32 @@ public class CliPluginRealmCache
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ArtifactTimestamp that = (ArtifactTimestamp) o;
|
||||
return path.equals(that.path) &&
|
||||
Objects.equals(lastModifiedTime, that.lastModifiedTime) &&
|
||||
Objects.equals(fileKey, that.fileKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(path, lastModifiedTime, fileKey);
|
||||
}
|
||||
}
|
||||
|
||||
Set<ArtifactTimestamp> timestamp;
|
||||
|
||||
public TimestampedCacheRecord(ClassRealm realm, List<Artifact> artifacts) {
|
||||
super(realm, artifacts);
|
||||
timestamp = current();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
try {
|
||||
return Objects.equals(current(), timestamp);
|
||||
@@ -246,6 +240,7 @@ public class CliPluginRealmCache
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Set<ArtifactTimestamp> current() {
|
||||
return getArtifacts().stream().map(Artifact::getFile)
|
||||
.map(File::toPath)
|
||||
@@ -253,6 +248,7 @@ public class CliPluginRealmCache
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link WatchService} with some methods to watch JARs associated with {@link WatchedCacheRecord}.
|
||||
*/
|
||||
@@ -323,27 +319,27 @@ public class CliPluginRealmCache
|
||||
*/
|
||||
void remove(ValidableCacheRecord record) {
|
||||
record.getArtifacts().stream()
|
||||
.map(Artifact::getFile)
|
||||
.map(File::toPath)
|
||||
.forEach(p -> {
|
||||
final Path dir = p.getParent();
|
||||
registrationsByDir.compute(dir, (key, value) -> {
|
||||
if (value == null) {
|
||||
log.debug("Already unwatchers for path {}", key);
|
||||
return null;
|
||||
} else {
|
||||
final int cnt = value.count.decrementAndGet();
|
||||
if (cnt <= 0) {
|
||||
log.debug("Unwatching path {}", key);
|
||||
value.watchKey.cancel();
|
||||
return null;
|
||||
} else {
|
||||
log.debug("Still {} watchers for path {}", cnt, key);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
.map(Artifact::getFile)
|
||||
.map(File::toPath)
|
||||
.forEach(p -> {
|
||||
final Path dir = p.getParent();
|
||||
registrationsByDir.compute(dir, (key, value) -> {
|
||||
if (value == null) {
|
||||
log.debug("Already unwatchers for path {}", key);
|
||||
return null;
|
||||
} else {
|
||||
final int cnt = value.count.decrementAndGet();
|
||||
if (cnt <= 0) {
|
||||
log.debug("Unwatching path {}", key);
|
||||
value.watchKey.cancel();
|
||||
return null;
|
||||
} else {
|
||||
log.debug("Still {} watchers for path {}", cnt, key);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +357,7 @@ public class CliPluginRealmCache
|
||||
final List<ValidableCacheRecord> records = validRecordsByPath.get(path);
|
||||
log.debug("Records for path {}: {}", path, records);
|
||||
if (records != null) {
|
||||
synchronized(records) {
|
||||
synchronized (records) {
|
||||
for (ValidableCacheRecord record : records) {
|
||||
log.debug("Invalidating recorder of path {}", path);
|
||||
((WatchedCacheRecord) record).valid = false;
|
||||
@@ -376,8 +372,8 @@ public class CliPluginRealmCache
|
||||
final Path entryParent = en.getKey().getParent();
|
||||
if (entryParent.equals(dir)) {
|
||||
final List<ValidableCacheRecord> records = en.getValue();
|
||||
if (records != null) {
|
||||
synchronized(records) {
|
||||
if (records != null) {
|
||||
synchronized (records) {
|
||||
for (ValidableCacheRecord record : records) {
|
||||
((WatchedCacheRecord) record).valid = false;
|
||||
remove(record);
|
||||
@@ -399,6 +395,7 @@ public class CliPluginRealmCache
|
||||
static class Registration {
|
||||
final AtomicInteger count = new AtomicInteger(1);
|
||||
final WatchKey watchKey;
|
||||
|
||||
public Registration(WatchKey watchKey) {
|
||||
this.watchKey = watchKey;
|
||||
}
|
||||
@@ -406,9 +403,9 @@ public class CliPluginRealmCache
|
||||
|
||||
@Override
|
||||
public ValidableCacheRecord newRecord(ClassRealm pluginRealm, List<Artifact> pluginArtifacts) {
|
||||
final ValidableCacheRecord result = new WatchedCacheRecord( pluginRealm, pluginArtifacts );
|
||||
final ValidableCacheRecord result = new WatchedCacheRecord(pluginRealm, pluginArtifacts);
|
||||
add(result);
|
||||
return result ;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -416,6 +413,7 @@ public class CliPluginRealmCache
|
||||
static class WatchedCacheRecord extends ValidableCacheRecord {
|
||||
|
||||
private volatile boolean valid = true;
|
||||
|
||||
public WatchedCacheRecord(ClassRealm realm, List<Artifact> artifacts) {
|
||||
super(realm, artifacts);
|
||||
}
|
||||
@@ -433,72 +431,60 @@ public class CliPluginRealmCache
|
||||
public CliPluginRealmCache() {
|
||||
this.watcher = System.getProperty("os.name").toLowerCase().contains("mac")
|
||||
? new TimestampedRecordValidator()
|
||||
: new MultiWatcher();
|
||||
: new MultiWatcher();
|
||||
}
|
||||
|
||||
public Key createKey(Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader> foreignImports,
|
||||
DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
|
||||
RepositorySystemSession session )
|
||||
{
|
||||
return new CacheKey( plugin, parentRealm, foreignImports, dependencyFilter, repositories, session );
|
||||
DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
|
||||
RepositorySystemSession session) {
|
||||
return new CacheKey(plugin, parentRealm, foreignImports, dependencyFilter, repositories, session);
|
||||
}
|
||||
|
||||
public CacheRecord get( Key key )
|
||||
{
|
||||
public CacheRecord get(Key key) {
|
||||
watcher.validateRecords();
|
||||
ValidableCacheRecord record = cache.get( key );
|
||||
ValidableCacheRecord record = cache.get(key);
|
||||
if (record != null && !record.isValid()) {
|
||||
record.dispose();
|
||||
record = null;
|
||||
cache.remove( key );
|
||||
cache.remove(key);
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
public CacheRecord put( Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts )
|
||||
{
|
||||
Objects.requireNonNull( pluginRealm, "pluginRealm cannot be null" );
|
||||
Objects.requireNonNull( pluginArtifacts, "pluginArtifacts cannot be null" );
|
||||
public CacheRecord put(Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts) {
|
||||
Objects.requireNonNull(pluginRealm, "pluginRealm cannot be null");
|
||||
Objects.requireNonNull(pluginArtifacts, "pluginArtifacts cannot be null");
|
||||
|
||||
if ( cache.containsKey( key ) )
|
||||
{
|
||||
throw new IllegalStateException( "Duplicate plugin realm for plugin " + key );
|
||||
if (cache.containsKey(key)) {
|
||||
throw new IllegalStateException("Duplicate plugin realm for plugin " + key);
|
||||
}
|
||||
|
||||
ValidableCacheRecord record = watcher.newRecord(pluginRealm, pluginArtifacts);
|
||||
cache.put( key, record );
|
||||
cache.put(key, record);
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
public void flush()
|
||||
{
|
||||
for ( ValidableCacheRecord record : cache.values() )
|
||||
{
|
||||
public void flush() {
|
||||
for (ValidableCacheRecord record : cache.values()) {
|
||||
record.dispose();
|
||||
}
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static int pluginHashCode( Plugin plugin )
|
||||
{
|
||||
return CliCacheUtils.pluginHashCode( plugin );
|
||||
protected static int pluginHashCode(Plugin plugin) {
|
||||
return CliCacheUtils.pluginHashCode(plugin);
|
||||
}
|
||||
|
||||
protected static boolean pluginEquals( Plugin a, Plugin b )
|
||||
{
|
||||
return CliCacheUtils.pluginEquals( a, b );
|
||||
protected static boolean pluginEquals(Plugin a, Plugin b) {
|
||||
return CliCacheUtils.pluginEquals(a, b);
|
||||
}
|
||||
|
||||
public void register( MavenProject project, Key key, CacheRecord record )
|
||||
{
|
||||
public void register(MavenProject project, Key key, CacheRecord record) {
|
||||
// default cache does not track plugin usage
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
public void dispose() {
|
||||
flush();
|
||||
}
|
||||
|
||||
|
@@ -23,10 +23,8 @@ import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||
import org.apache.maven.execution.ExecutionEvent;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
@@ -73,28 +71,28 @@ public class BuildTimeEventSpy extends AbstractEventSpy {
|
||||
|
||||
private void onEvent(ExecutionEvent event) throws Exception {
|
||||
switch (event.getType()) {
|
||||
case SessionStarted:
|
||||
logger.info("BuildTimeEventSpy is registered.");
|
||||
session = new Session();
|
||||
break;
|
||||
case SessionStarted:
|
||||
logger.info("BuildTimeEventSpy is registered.");
|
||||
session = new Session();
|
||||
break;
|
||||
|
||||
case MojoStarted:
|
||||
session.mojoTimer(event).start();
|
||||
break;
|
||||
case MojoStarted:
|
||||
session.mojoTimer(event).start();
|
||||
break;
|
||||
|
||||
case MojoFailed:
|
||||
case MojoSucceeded:
|
||||
session.mojoTimer(event).end();
|
||||
break;
|
||||
case MojoFailed:
|
||||
case MojoSucceeded:
|
||||
session.mojoTimer(event).end();
|
||||
break;
|
||||
|
||||
case SessionEnded:
|
||||
String prop = getExecutionProperty(event, BUILDTIME_OUTPUT_LOG_PROPERTY, "false");
|
||||
boolean output = Boolean.parseBoolean(prop);
|
||||
doReport(output);
|
||||
break;
|
||||
case SessionEnded:
|
||||
String prop = getExecutionProperty(event, BUILDTIME_OUTPUT_LOG_PROPERTY, "false");
|
||||
boolean output = Boolean.parseBoolean(prop);
|
||||
doReport(output);
|
||||
break;
|
||||
|
||||
default:
|
||||
//Ignore other events
|
||||
default:
|
||||
//Ignore other events
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +108,7 @@ public class BuildTimeEventSpy extends AbstractEventSpy {
|
||||
log.accept(DIVIDER);
|
||||
session.projects().forEach(p -> {
|
||||
log.accept(String.format("%s [%.3fs]", p.name(), p.duration() / 1000d));
|
||||
p.mojos().forEach(m ->
|
||||
log.accept(String.format(" %s [%.3fs]", m.name(), m.duration() / 1000d)));
|
||||
p.mojos().forEach(m -> log.accept(String.format(" %s [%.3fs]", m.name(), m.duration() / 1000d)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,8 +173,8 @@ public class BuildTimeEventSpy extends AbstractEventSpy {
|
||||
|
||||
public String name() {
|
||||
String name = mojo.getKey();
|
||||
String truncatedName = name.length() >= MAX_NAME_LENGTH ?
|
||||
StringUtils.substring(name, 0, MAX_NAME_LENGTH) : name + " ";
|
||||
String truncatedName = name.length() >= MAX_NAME_LENGTH ? StringUtils.substring(name, 0, MAX_NAME_LENGTH)
|
||||
: name + " ";
|
||||
return StringUtils.rightPad(truncatedName, MAX_NAME_LENGTH, ".");
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package org.jboss.fuse.mvnd.builder;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package org.jboss.fuse.mvnd.builder;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -20,7 +20,6 @@ import java.util.HashMap;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.builder;
|
||||
|
||||
import com.google.common.util.concurrent.Monitor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -22,8 +23,6 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.google.common.util.concurrent.Monitor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.jboss.fuse.mvnd.builder.ProjectExecutorService.ProjectRunnable;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -108,7 +107,7 @@ public class ProjectExecutorServiceTest extends AbstractSmartBuilderTest {
|
||||
};
|
||||
|
||||
public PausibleProjectExecutorService(int degreeOfConcurrency,
|
||||
Comparator<MavenProject> projectComparator) {
|
||||
Comparator<MavenProject> projectComparator) {
|
||||
super(degreeOfConcurrency, projectComparator);
|
||||
}
|
||||
|
||||
|
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.builder;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
Reference in New Issue
Block a user