fix tests
All checks were successful
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 58.63% (16555/28235)
* Branch Coverage: 51.34% (6336/12341)
* Lines of Code: 28235
* Cyclomatic Complexity: 11205
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 11, passed: 585
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
All checks were successful
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 58.63% (16555/28235)
* Branch Coverage: 51.34% (6336/12341)
* Lines of Code: 28235
* Cyclomatic Complexity: 11205
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 11, passed: 585
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
This commit is contained in:
parent
c20591d638
commit
58d0b38ac9
@ -8,6 +8,10 @@ import java.nio.file.Path;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class PackerRuntimeAssetMaterializer {
|
public final class PackerRuntimeAssetMaterializer {
|
||||||
|
private static final Set<String> RUNTIME_RESERVED_FILE_NAMES = Set.of(
|
||||||
|
"asset.json",
|
||||||
|
"studio.asset.json");
|
||||||
|
|
||||||
private final PackerAssetWalker assetWalker;
|
private final PackerAssetWalker assetWalker;
|
||||||
|
|
||||||
public PackerRuntimeAssetMaterializer(PackerAssetWalker assetWalker) {
|
public PackerRuntimeAssetMaterializer(PackerAssetWalker assetWalker) {
|
||||||
@ -114,7 +118,7 @@ public final class PackerRuntimeAssetMaterializer {
|
|||||||
private List<String> listAvailableFiles(Path assetRoot) {
|
private List<String> listAvailableFiles(Path assetRoot) {
|
||||||
try (var paths = Files.list(assetRoot)
|
try (var paths = Files.list(assetRoot)
|
||||||
.filter(Files::isRegularFile)
|
.filter(Files::isRegularFile)
|
||||||
.filter(path -> !path.getFileName().toString().equalsIgnoreCase("asset.json"))
|
.filter(path -> !isRuntimeReservedFile(path))
|
||||||
.map(path -> assetRoot.relativize(path.toAbsolutePath().normalize()).toString().replace('\\', '/'))
|
.map(path -> assetRoot.relativize(path.toAbsolutePath().normalize()).toString().replace('\\', '/'))
|
||||||
.sorted(String.CASE_INSENSITIVE_ORDER)) {
|
.sorted(String.CASE_INSENSITIVE_ORDER)) {
|
||||||
return paths.toList();
|
return paths.toList();
|
||||||
@ -123,6 +127,10 @@ public final class PackerRuntimeAssetMaterializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRuntimeReservedFile(Path path) {
|
||||||
|
return RUNTIME_RESERVED_FILE_NAMES.contains(path.getFileName().toString().toLowerCase(Locale.ROOT));
|
||||||
|
}
|
||||||
|
|
||||||
private PackerRuntimeWalkFile toRuntimeWalkFile(
|
private PackerRuntimeWalkFile toRuntimeWalkFile(
|
||||||
Path assetRoot,
|
Path assetRoot,
|
||||||
PackerProbeResult probeResult,
|
PackerProbeResult probeResult,
|
||||||
|
|||||||
@ -76,6 +76,7 @@ final class PackerRuntimeAssetMaterializerTest {
|
|||||||
final Path assetRoot = Files.createDirectories(tempDir.resolve("runtime-default"));
|
final Path assetRoot = Files.createDirectories(tempDir.resolve("runtime-default"));
|
||||||
final Path manifestPath = assetRoot.resolve("asset.json");
|
final Path manifestPath = assetRoot.resolve("asset.json");
|
||||||
Files.writeString(manifestPath, "{}");
|
Files.writeString(manifestPath, "{}");
|
||||||
|
Files.writeString(assetRoot.resolve("studio.asset.json"), "{}");
|
||||||
writeTile(assetRoot.resolve("selected.png"), 16);
|
writeTile(assetRoot.resolve("selected.png"), 16);
|
||||||
writeTile(assetRoot.resolve("extra.png"), 16);
|
writeTile(assetRoot.resolve("extra.png"), 16);
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ final class PackerRuntimeAssetMaterializerTest {
|
|||||||
Optional.empty());
|
Optional.empty());
|
||||||
|
|
||||||
assertEquals(2, materialized.runtimeAsset().walkProjection().buildCandidateFiles().size());
|
assertEquals(2, materialized.runtimeAsset().walkProjection().buildCandidateFiles().size());
|
||||||
|
assertEquals(List.of("extra.png", "selected.png"), materialized.runtimeAsset().walkProjection().availableFiles());
|
||||||
assertTrue(materialized.runtimeAsset().walkProjection().buildCandidateFiles().stream()
|
assertTrue(materialized.runtimeAsset().walkProjection().buildCandidateFiles().stream()
|
||||||
.allMatch(file -> file.contentBytes().isEmpty()));
|
.allMatch(file -> file.contentBytes().isEmpty()));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user