Skip to content

Commit

Permalink
cacheBug: copy target directory instead of project
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Jul 14, 2023
1 parent 96a6a40 commit 9ac0565
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ private void build(final File project) throws IOException {
target
)
);
FileUtils.copyDirectory(project, cached);
FileUtils.copyDirectory(target, cached);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;

import org.eolang.maven.rust.Names;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -80,17 +82,30 @@ void failsWithIncorrectInsert(@TempDir final Path temp) throws IOException {
@Tag("slow")
void savesToCache(@TempDir final Path temp) throws IOException {
final FakeMaven maven;
final Path cache = temp.resolve(".cache");
synchronized (BinarizeMojoTest.class) {
maven = new FakeMaven(temp)
.with("cache", temp.resolve(".cache"))
.with("cache", cache)
.withProgram(Paths.get("src/test/resources/org/eolang/maven/simple-rust.eo"));
}
final Map<String, Path> res = maven
.execute(new FakeMaven.Binarize())
.result();
MatcherAssert.assertThat(
res,
Matchers.hasValue(temp.resolve(".cache").resolve("Lib"))
Matchers.hasValue(
cache.resolve("Lib")
)
);
MatcherAssert.assertThat(
res,
Matchers.not(
Matchers.hasValue(
cache.resolve(
String.format("Lib/%s0/target/target", Names.PREFIX)
)
)
)
);
Assertions.assertDoesNotThrow(
() -> maven.execute(new FakeMaven.Binarize())
Expand Down

0 comments on commit 9ac0565

Please sign in to comment.