Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .github/ci-mimir-daemon.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

# Pre-seed itself
mimir.daemon.preSeedItself=true
mimir.file.exclusiveAccess=true
mimir.file.cachePurge=ON_BEGIN
11 changes: 10 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ concurrency:
permissions: {}

env:
MIMIR_VERSION: 0.10.0
MIMIR_VERSION: 0.10.3
MIMIR_BASEDIR: ~/.mimir
MIMIR_LOCAL: ~/.mimir/local
MAVEN_OPTS: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./target/java_heapdump.hprof
Expand Down Expand Up @@ -101,6 +101,15 @@ jobs:
apache-maven/target/apache-maven*.zip
apache-maven/target/apache-maven*.tar.gz

- name: Upload test artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: failure() || cancelled()
with:
name: ${{ github.run_number }}-initial
path: |
**/target/surefire-reports/*
**/target/java_heapdump.hprof

full-build:
needs: initial-build
runs-on: ${{ matrix.os }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ public final class Environment {
private Environment() {}

public static final String TOOLBOX_VERSION = System.getProperty("version.toolbox", "UNSET version.toolbox");

public static final String MIMIR_VERSION = System.getProperty("version.mimir", "UNSET version.mimir");
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ void conflictingSettings(
Map<String, String> logs = invoke(
cwd,
userHome,
List.of("eu.maveniverse.maven.plugins:toolbox:" + Environment.TOOLBOX_VERSION + ":help"),
List.of("eu.maveniverse.maven.plugins:toolbox:" + Environment.TOOLBOX_VERSION + ":dump"),
List.of("--force-interactive"));

String log = logs.get("eu.maveniverse.maven.plugins:toolbox:" + Environment.TOOLBOX_VERSION + ":help");
String log = logs.get("eu.maveniverse.maven.plugins:toolbox:" + Environment.TOOLBOX_VERSION + ":dump");
assertTrue(log.contains("https://repo1.maven.org/maven2"), log);
assertFalse(log.contains("https://repo.maven.apache.org/maven2"), log);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ protected Map<String, String> invoke(Path cwd, Path userHome, Collection<String>
Files.writeString(appJava, APP_JAVA_STRING);

if (MimirInfuser.isMimirPresentUW()) {
MimirInfuser.doInfuseUW(Environment.MIMIR_VERSION, userHome);
MimirInfuser.doInfuseUW(userHome);
MimirInfuser.preseedItselfIntoInnerUserHome(userHome);
}

HashMap<String, String> logs = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ public interface Executor extends AutoCloseable {
* @throws ExecutorException if an error occurs while closing the {@link Executor}
*/
@Override
default void close() throws ExecutorException {}
void close() throws ExecutorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ protected void disposeRuntimeCreatedRealms(Context context) {
@Override
public String mavenVersion(ExecutorRequest executorRequest) throws ExecutorException {
requireNonNull(executorRequest);
validate(executorRequest);
if (closed.get()) {
throw new ExecutorException("Executor is closed");
}
validate(executorRequest);
return mayCreate(executorRequest).version;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.maven.api.cli.Executor;
import org.apache.maven.api.cli.ExecutorException;
Expand All @@ -45,18 +46,23 @@
*/
public class ForkedMavenExecutor implements Executor {
protected final boolean useMavenArgsEnv;
protected final AtomicBoolean closed;

public ForkedMavenExecutor() {
this(true);
}

public ForkedMavenExecutor(boolean useMavenArgsEnv) {
this.useMavenArgsEnv = useMavenArgsEnv;
this.closed = new AtomicBoolean(false);
}

@Override
public int execute(ExecutorRequest executorRequest) throws ExecutorException {
requireNonNull(executorRequest);
if (closed.get()) {
throw new ExecutorException("Executor is closed");
}
validate(executorRequest);

return doExecute(executorRequest);
Expand All @@ -65,6 +71,9 @@ public int execute(ExecutorRequest executorRequest) throws ExecutorException {
@Override
public String mavenVersion(ExecutorRequest executorRequest) throws ExecutorException {
requireNonNull(executorRequest);
if (closed.get()) {
throw new ExecutorException("Executor is closed");
}
validate(executorRequest);
try {
Path cwd = Files.createTempDirectory("forked-executor-maven-version");
Expand Down Expand Up @@ -207,4 +216,11 @@ protected CountDownLatch pump(Process p, ExecutorRequest executorRequest) {
stdinPump.start();
return latch;
}

@Override
public void close() throws ExecutorException {
if (closed.compareAndExchange(false, true)) {
// nothing yet
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ public final class Environment {
private Environment() {}

public static final String TOOLBOX_VERSION = System.getProperty("version.toolbox", "UNSET version.toolbox");

public static final String MIMIR_VERSION = System.getProperty("version.mimir", "UNSET version.mimir");
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void beforeEach(TestInfo testInfo) throws Exception {
.resolve("home");
Files.createDirectories(userHome);
MimirInfuser.infuseUW(userHome);
MimirInfuser.preseedItselfIntoInnerUserHome(userHome);

System.out.println("=== " + testInfo.getTestMethod().orElseThrow().getName());
}
Expand Down Expand Up @@ -338,10 +339,11 @@ protected void execute(@Nullable Path logFile, Collection<ExecutorRequest> reque
for (ExecutorRequest request : requests) {
if (MimirInfuser.isMimirPresentUW()) {
if (maven3Home().equals(request.installationDirectory())) {
MimirInfuser.doInfusePW(Environment.MIMIR_VERSION, request.cwd(), request.userHomeDirectory());
MimirInfuser.doInfusePW(request.cwd(), request.userHomeDirectory());
} else if (maven4Home().equals(request.installationDirectory())) {
MimirInfuser.doInfuseUW(Environment.MIMIR_VERSION, request.userHomeDirectory());
MimirInfuser.doInfuseUW(request.userHomeDirectory());
}
MimirInfuser.preseedItselfIntoInnerUserHome(request.userHomeDirectory());
}
int exitCode = invoker.execute(request);
if (exitCode != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ void beforeEach(TestInfo testInfo) throws Exception {

if (MimirInfuser.isMimirPresentUW()) {
if (testName.contains("3")) {
MimirInfuser.doInfusePW(Environment.MIMIR_VERSION, cwd, userHome);
MimirInfuser.doInfusePW(cwd, userHome);
} else {
MimirInfuser.doInfuseUW(Environment.MIMIR_VERSION, userHome);
MimirInfuser.doInfuseUW(userHome);
}
MimirInfuser.preseedItselfIntoInnerUserHome(userHome);
}

System.out.println("=== " + testInfo.getTestMethod().orElseThrow().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class Verifier {
private final List<String> jvmArguments = new ArrayList<>();

// TestSuiteOrdering creates Verifier in non-forked JVM as well, and there no prop set is set (so use default)
private final String toolboxVersion = System.getProperty("version.toolbox", "0.14.0");
private final String toolboxVersion = System.getProperty("version.toolbox", "0.14.1");

private Path userHomeDirectory; // the user home

Expand Down
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ under the License.
<version.palantirJavaFormat>2.80.0</version.palantirJavaFormat>

<!-- Set as system property in surefire/failsafe to propagate to tests and IT Verifier -->
<toolboxVersion>0.14.0</toolboxVersion>
<toolboxVersion>0.14.1</toolboxVersion>
</properties>

<!--bootstrap-start-comment-->
Expand Down Expand Up @@ -677,7 +677,7 @@ under the License.
<dependency>
<groupId>eu.maveniverse.maven.mimir</groupId>
<artifactId>testing</artifactId>
<version>0.10.0</version>
<version>0.10.3</version>
</dependency>
</dependencies>
<!--bootstrap-start-comment-->
Expand All @@ -695,7 +695,6 @@ under the License.
<argLine>-Xmx256m @{jacocoArgLine}</argLine>
<systemPropertyVariables combine.children="append">
<version.toolbox>${toolboxVersion}</version.toolbox>
<version.mimir>${env.MIMIR_VERSION}</version.mimir>
</systemPropertyVariables>
</configuration>
</plugin>
Expand All @@ -707,7 +706,6 @@ under the License.
<argLine>-Xmx256m @{jacocoArgLine}</argLine>
<systemPropertyVariables combine.children="append">
<version.toolbox>${toolboxVersion}</version.toolbox>
<version.mimir>${env.MIMIR_VERSION}</version.mimir>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down
Loading