Compare commits

..

No commits in common. "b9f24ebed9633078a291ef32664ea898e4c9d7f3" and "5dd1c08c54f493e121ca2412f7dfeb0e32f031d1" have entirely different histories.

5 changed files with 3 additions and 63 deletions

2
core

@ -1 +1 @@
Subproject commit fdce2096637ee6b9cd34fd27f8be207e23f9bb83
Subproject commit be04188f686b15ab0f9d10d924c6cea919328dc9

View file

@ -494,10 +494,7 @@ public class BldCache {
var properties = new Properties();
if (getCacheFile().exists()) {
try {
// the cache holds dependency trees with box drawing
// characters, the platform charset can't encode those on
// every JVM and would corrupt them
try (var reader = new BufferedReader(new FileReader(getCacheFile(), StandardCharsets.UTF_8))) {
try (var reader = new BufferedReader(new FileReader(getCacheFile()))) {
properties.load(reader);
}
} catch (IOException e) {
@ -658,7 +655,7 @@ public class BldCache {
cacheDir_.mkdirs();
try (var writer = new BufferedWriter(new FileWriter(getCacheFile(), StandardCharsets.UTF_8))) {
try (var writer = new BufferedWriter(new FileWriter(getCacheFile()))) {
properties.store(writer, null);
}
} catch (IOException e) {

View file

@ -258,11 +258,8 @@ public class Wrapper {
manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, getClass().getName());
try (var jar = new JarOutputStream(new FileOutputStream(new File(destinationDirectory, WRAPPER_JAR)), manifest)) {
// every nested type of the wrapper has to be added here too,
// the wrapper jar only contains what is listed
addClassToJar(jar, Wrapper.class);
addClassToJar(jar, Wrapper.LaunchMode.class);
addClassToJar(jar, Wrapper.IoAction.class);
addClassToJar(jar, WrapperClassLoader.class);
addClassToJar(jar, FileUtils.class);
addClassToJar(jar, FileUtilsErrorException.class);

View file

@ -230,36 +230,6 @@ public class TestBldCacheLifecycle {
}
}
@Test
void testDependencyTreeCacheKeepsTreeCharacters() throws Exception {
// the tree is drawn with box drawing characters, the cache file
// has to keep them no matter what the platform charset of the JVM
// is able to encode
var requests = new AtomicInteger();
var server = createArtifactServer(Map.of(
"tool:1.0.0", pom("tool", "1.0.0", dependency("liba", "1.1.0")),
"liba:1.1.0", pom("liba", "1.1.0", "")), requests);
server.start();
var tmp = Files.createTempDirectory("cachelifecycle").toFile();
try {
var build1 = new LifecycleProject(tmp, serverRepository(server));
writeWrapperProperties(build1, server, "");
build1.dependencies().scope(provided)
.include(new Dependency("com.example", "tool", new VersionNumber(1, 0, 0)));
var operation1 = new DependencyTreeOperation().fromProject(build1);
operation1.executeOnce();
assertTrue(operation1.dependencyTree().contains(""), operation1.dependencyTree());
// the characters survive the round trip through the cache file
var cached = FileUtils.readString(new File(build1.libBldDirectory(), BldCache.BLD_CACHE));
assertTrue(cached.contains(""), "the cache file lost the tree characters");
} finally {
server.stop(0);
FileUtils.deleteDirectory(tmp);
}
}
@Test
void testDependencyTreeLifecycle() throws Exception {
var requests = new AtomicInteger();

View file

@ -18,30 +18,6 @@ import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
public class TestWrapperExtensionResolver {
@Test
void testWrapperJarContainsEveryNestedType()
throws Exception {
// the wrapper jar only contains the classes that are listed
// explicitly, a nested type that isn't listed makes the wrapper
// fail with a NoClassDefFoundError while it bootstraps
var tmp = Files.createTempDirectory("wrapperjar").toFile();
try {
new Wrapper().createWrapperFiles(tmp, "2.4.0-SNAPSHOT");
var entries = new java.util.HashSet<String>();
try (var jar = new java.util.jar.JarFile(new File(tmp, "bld-wrapper.jar"))) {
jar.stream().map(java.util.zip.ZipEntry::getName).forEach(entries::add);
}
for (var nested : Wrapper.class.getDeclaredClasses()) {
assertTrue(entries.contains(nested.getName().replace('.', '/') + ".class"),
"the wrapper jar doesn't contain " + nested.getName());
}
} finally {
FileUtils.deleteDirectory(tmp);
}
}
@Test
void testNoExtensions()
throws Exception {