Repository navigation
Treat a missing dependency directory as empty instead of an I/O error #1179
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,10 @@ | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| import static org.mockito.ArgumentMatchers.contains; | ||
| import static org.mockito.Mockito.mock; | ||
| import static org.mockito.Mockito.never; | ||
| import static org.mockito.Mockito.verify; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| class DependencyStateTest { | ||
|
|
@@ -113,6 +116,33 @@ void preservesRepeatedDependencyEntriesAndPathKinds() throws Exception { | |
| assertTrue(state.get(2).startsWith("modulepath:")); | ||
| } | ||
|
|
||
| @Test | ||
| void treatsMissingDependencyDirectoryAsEmptyWithoutWarningOrForcedRebuild() throws Exception { | ||
| Path dependency = temporaryDirectory.resolve("classes-not-yet-compiled"); | ||
| IncrementalBuildHelper helper = mock(IncrementalBuildHelper.class); | ||
| when(helper.getMojoStatusDirectory()).thenReturn(temporaryDirectory.toFile()); | ||
| Log log = mock(Log.class); | ||
|
|
||
| DependencyState.Configuration configuration = | ||
| new DependencyState.Configuration(Collections.emptySet(), BUILD_START, 0, log, false); | ||
| List<String> classpath = Collections.singletonList(dependency.toString()); | ||
|
|
||
| assertFalse(DependencyState.hasChanged( | ||
| helper, | ||
| temporaryDirectory.resolve("output").toFile(), | ||
| classpath, | ||
| Collections.emptyList(), | ||
| configuration)); | ||
| assertFalse(DependencyState.hasChanged( | ||
| helper, | ||
| temporaryDirectory.resolve("output").toFile(), | ||
| classpath, | ||
| Collections.emptyList(), | ||
| configuration)); | ||
|
|
||
| verify(log, never()).warn(contains("I/O error")); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
PR #1125 already covers this transition in its commit |
||
| } | ||
|
|
||
| @Test | ||
| void retainsCurrentBuildDetectionWhenStatusDirectoryIsUnavailable() throws Exception { | ||
| Path dependency = dependency("dependency.jar", 3_000, 1); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 + ":"is a redundant int-to-String promotion that looks like a mistake. Prefer the string literal directly:(Note: the existing PR #1125 uses the same pattern — worth fixing there too.)