S19: consume versioned engineering resources and move landscape documentation
All checks were successful
Build, test and publish / verify (push) Successful in 8m54s

This commit is contained in:
2026-11-08 15:23:10 +01:00
parent bd898e92d2
commit c6a495a93c
100 changed files with 1869 additions and 4274 deletions

61
generated/ci/Recipe.java Normal file
View File

@@ -0,0 +1,61 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/** Project-owned configuration for the shared engineering mechanisms. */
final class Recipe {
private Recipe() {}
static Map<String, String> environment(final Path root, final Map<String, String> input) throws Exception {
final var result = new HashMap<String, String>(input);
final Path file = root.resolve("engineering.properties");
if (Files.exists(file)) {
final var properties = new Properties();
try (final var stream = Files.newInputStream(file)) {
properties.load(stream);
}
for (final String key : properties.stringPropertyNames()) {
result.putIfAbsent(
key, properties.getProperty(key).replace("${user.home}", System.getProperty("user.home")));
}
}
if (result.containsKey("PROJECT_NAME")) {
project(result);
for (final String role : roles(result)) {
final Path module = Path.of(result.get(role.toUpperCase() + "_MODULE"));
Pipeline.check(
!module.isAbsolute() && !module.normalize().startsWith(".."),
"Module must stay in the project");
}
Pipeline.check(
!enabled(result, "BROWSER_TESTS") || roles(result).size() == 2,
"Browser coverage requires both backend and frontend");
}
return result;
}
static String project(final Map<String, String> env) {
final String name = Setup.required(env, "PROJECT_NAME");
Pipeline.check(name.matches("[a-z][a-z0-9-]*"), "Invalid project name");
return name;
}
static List<String> roles(final Map<String, String> env) {
final var roles = new ArrayList<String>();
for (final String role : List.of("backend", "frontend")) {
if (!env.getOrDefault(role.toUpperCase() + "_MODULE", "").isBlank()) {
roles.add(role);
}
}
Pipeline.check(!roles.isEmpty(), "Configure BACKEND_MODULE, FRONTEND_MODULE, or both");
return roles;
}
static boolean enabled(final Map<String, String> env, final String key) {
return Boolean.parseBoolean(env.getOrDefault(key, "false"));
}
}