-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow incremental restore in case of plugin parameter mismatch
- Loading branch information
1 parent
c2e4c0b
commit 1c85628
Showing
10 changed files
with
257 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/test/java/org/apache/maven/buildcache/its/Issue103Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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.apache.maven.buildcache.its; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.apache.maven.buildcache.its.junit.IntegrationTest; | ||
import org.apache.maven.it.VerificationException; | ||
import org.apache.maven.it.Verifier; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.apache.maven.buildcache.util.LogFileUtils.findFirstLineContainingTextsInLogs; | ||
|
||
/** | ||
* @author Réda Housni Alaoui | ||
*/ | ||
@IntegrationTest("src/test/projects/mbuildcache-103") | ||
class Issue103Test { | ||
|
||
private static final String PROJECT_NAME = "org.apache.maven.caching.test.mbuildcache-103:simple"; | ||
|
||
@Test | ||
void simple(Verifier verifier) throws VerificationException { | ||
verifier.setAutoclean(false); | ||
|
||
verifier.getCliOptions().clear(); | ||
verifier.addCliOption("-Dmaven.build.cache.incrementalReconciliationOnParameterMismatch"); | ||
verifier.addCliOption("-DskipTests"); | ||
verifier.setLogFileName("../log-1.txt"); | ||
verifier.executeGoals(Arrays.asList("clean", "verify")); | ||
verifier.verifyErrorFreeLog(); | ||
|
||
verifier.getCliOptions().clear(); | ||
verifier.addCliOption("-Dmaven.build.cache.incrementalReconciliationOnParameterMismatch"); | ||
verifier.setLogFileName("../log-2.txt"); | ||
verifier.executeGoals(Arrays.asList("clean", "verify")); | ||
verifier.verifyErrorFreeLog(); | ||
verifier.verifyTextInLog("No tests to run."); | ||
verifier.verifyTextInLog("Building jar"); | ||
verifier.verifyTextInLog("Saved Build to local file"); | ||
verifyNoTextInLog(verifier, "A cached mojo is not consistent, continuing with non cached build"); | ||
|
||
verifier.getCliOptions().clear(); | ||
verifier.addCliOption("-Dmaven.build.cache.incrementalReconciliationOnParameterMismatch"); | ||
verifier.setLogFileName("../log-3.txt"); | ||
verifier.executeGoals(Arrays.asList("clean", "verify")); | ||
verifier.verifyErrorFreeLog(); | ||
verifier.verifyTextInLog("Found cached build, restoring " + PROJECT_NAME + " from cache by"); | ||
verifier.verifyTextInLog("Skipping plugin execution (cached): surefire:test"); | ||
} | ||
|
||
private static void verifyNoTextInLog(Verifier verifier, String text) throws VerificationException { | ||
Assertions.assertNull(findFirstLineContainingTextsInLogs(verifier, text)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/projects/mbuildcache-103/.mvn/maven-build-cache-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<!-- | ||
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. | ||
--> | ||
|
||
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd"> | ||
<executionControl> | ||
<reconcile> | ||
<plugins> | ||
<plugin artifactId="maven-surefire-plugin" goal="test"> | ||
<reconciles> | ||
<reconcile propertyName="skipTests" skipValue="true"/> | ||
</reconciles> | ||
</plugin> | ||
</plugins> | ||
</reconcile> | ||
</executionControl> | ||
</cache> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- | ||
Copyright 2021 the original author or authors. | ||
Licensed 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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.apache.maven.caching.test.mbuildcache-103</groupId> | ||
<artifactId>simple</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.extensions</groupId> | ||
<artifactId>maven-build-cache-extension</artifactId> | ||
<version>${projectVersion}</version> | ||
</extension> | ||
</extensions> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.