From 0fa5fb5f9ee63a315f4fdf49b668fe2433ed3879 Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 19:09:27 +0200 Subject: [PATCH 01/16] Keep track of all expansions' equipment and ships. This works on the index page but details are getting overwritten. --- .github/workflows/Build.yml | 4 ++ nbactions-Indexer.xml | 6 +- .../ooliteaddonscanner2/AddonsUtil.java | 3 + .../ooliteaddonscanner2/Registry.java | 62 +++++++++++-------- 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 9fa6015..d5b6b02 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,6 +18,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install required packages + run: | + apt-get install -y graphviz + - name: Checkout project uses: actions/checkout@v4 with: diff --git a/nbactions-Indexer.xml b/nbactions-Indexer.xml index 42e868a..ea76245 100644 --- a/nbactions-Indexer.xml +++ b/nbactions-Indexer.xml @@ -12,7 +12,7 @@ ${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs} - --out target/output --maxExpansion 290 + --out target/output --maxExpansion 2900 com.chaudhuri.ooliteaddonscanner2.Main java @@ -29,7 +29,7 @@ -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} ${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs} - --out target/output --maxExpansion 290 + --out target/output --maxExpansion 2900 com.chaudhuri.ooliteaddonscanner2.Main java true @@ -49,7 +49,7 @@ ${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs} com.chaudhuri.ooliteaddonscanner2.Main java - --out target/output --maxExpansion 290 + --out target/output --maxExpansion 2900 diff --git a/src/main/java/com/chaudhuri/ooliteaddonscanner2/AddonsUtil.java b/src/main/java/com/chaudhuri/ooliteaddonscanner2/AddonsUtil.java index 9a3e0ea..819ddf2 100644 --- a/src/main/java/com/chaudhuri/ooliteaddonscanner2/AddonsUtil.java +++ b/src/main/java/com/chaudhuri/ooliteaddonscanner2/AddonsUtil.java @@ -313,6 +313,7 @@ public static void readOolite(ExpansionCache cache, Registry registry) throws IO String url = null; Map manifest = null; + // find out the latest Download URL from Github try { manifest = cache.getOoliteManifest(tag); } catch (Exception e) { @@ -323,6 +324,8 @@ public static void readOolite(ExpansionCache cache, Registry registry) throws IO } catch (Exception e) { throw new IllegalStateException("Could not get download url for Oolite from manifest", e); } + + // now download Oolite from that URL try (InputStream olitezip = cache.getPluginInputStream(url); ZipInputStream zin = new ZipInputStream(olitezip)) { Expansion oxp = new Expansion(); oxp.setDownloadUrl(url); diff --git a/src/main/java/com/chaudhuri/ooliteaddonscanner2/Registry.java b/src/main/java/com/chaudhuri/ooliteaddonscanner2/Registry.java index 4ece4db..18757e1 100644 --- a/src/main/java/com/chaudhuri/ooliteaddonscanner2/Registry.java +++ b/src/main/java/com/chaudhuri/ooliteaddonscanner2/Registry.java @@ -45,8 +45,8 @@ public class Registry { public static final String EXPANSION_REQUIRED_OOLITE_VERSION = "required_oolite_version"; private final Map expansions; - private final Map equipment; - private final Map ships; + private final Map> equipment; + private final Map> ships; private final List warnings; private final Properties properties; @@ -411,19 +411,17 @@ public void addShip(Ship ship) { throw new IllegalArgumentException("Ship must have expansion reference"); } - if (ships.containsKey(ship.getIdentifier())) { - addWarning(String.format("Replacing %s/%s with %s/%s", - ships.get(ship.getIdentifier()).getExpansion().getName(), - ships.get(ship.getIdentifier()).getName(), - ship.getExpansion().getName(), - ship.getName())); + List list = ships.get(ship.getIdentifier()); + if (list == null) { + list = new ArrayList<>(); + ships.put(ship.getIdentifier(), list); } - - ships.put(ship.getIdentifier(), ship); + list.add(ship); } /** - * Adds equipment. + * Adds equipment to the registry. If existing equipment gets replaced + * a warning is logged. * * @param equipment the equipment */ @@ -434,14 +432,13 @@ public void addEquipment(Equipment equipment) { if (equipment.getExpansion() == null) { throw new IllegalArgumentException("equipment must have expansion"); } - if (this.equipment.containsKey(equipment.getIdentifier())) { - addWarning(String.format("Replacing %s/%s with %s/%s", - this.equipment.get(equipment.getIdentifier()).getExpansion().getName(), - this.equipment.get(equipment.getIdentifier()).getName(), - equipment.getExpansion().getName(), - equipment.getName())); + + List list = this.equipment.get(equipment.getIdentifier()); + if (list == null) { + list = new ArrayList<>(); + this.equipment.put(equipment.getIdentifier(), list); } - this.equipment.put(equipment.getIdentifier(), equipment); + list.add(equipment); } /** @@ -486,7 +483,13 @@ public void addEquipment(Expansion expansion, PlistParser.ListContext lc) throws } expansion.addEquipment(eq); - this.equipment.put(eq.getIdentifier(), eq); + + List list = equipment.get(eq.getIdentifier()); + if (list == null) { + list = new ArrayList<>(); + equipment.put(eq.getIdentifier(), list); + } + list.add(eq); } /** @@ -656,7 +659,12 @@ public List getExpansionsByUploadDate() { * @return the list */ public List getEquipment() { - return new ArrayList<>(equipment.values()); + //return new ArrayList<>(equipment.values()); + List all = new ArrayList<>(); + for (List list: equipment.values()) { + all.addAll(list); + } + return all; } /** @@ -665,7 +673,7 @@ public List getEquipment() { * @return the list */ public List getEquipmentByName() { - ArrayList result = new ArrayList<>(equipment.values()); + ArrayList result = new ArrayList<>(getEquipment()); Collections.sort(result, (t, t1) -> t.getName().compareTo(t1.getName())); return result; } @@ -676,7 +684,11 @@ public List getEquipmentByName() { * @return the list */ public List getShips() { - return new ArrayList<>(ships.values()); + List all = new ArrayList<>(); + for (List list: ships.values()) { + all.addAll(list); + } + return all; } /** @@ -685,7 +697,7 @@ public List getShips() { * @return the list */ public List getShipsByName() { - ArrayList result = new ArrayList<>(ships.values()); + ArrayList result = new ArrayList<>(getShips()); Collections.sort(result, (t, t1) -> t.getName().compareTo(t1.getName())); return result; } @@ -698,8 +710,8 @@ public List getShipsByName() { public List getAllByIdentifier() { ArrayList result = new ArrayList<>(); result.addAll(expansions.values()); - result.addAll(equipment.values()); - result.addAll(ships.values()); + result.addAll(getEquipment()); + result.addAll(getShips()); Collections.sort(result, (t, t1) -> t.getIdentifier().compareTo(t1.getIdentifier())); From 9f81550a76fad67283d21ee418f0ae8574cc040f Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 21:24:06 +0200 Subject: [PATCH 02/16] Indexes will find the detail pages. Further links still missing. --- .../ooliteaddonscanner2/Scanner.java | 4 ---- .../ooliteaddonscanner2/TemplateUtil.java | 24 +++++++++++-------- .../templates/indexAllByIdentifier.ftlh | 8 ++++++- .../templates/indexEquipmentByName.ftlh | 4 ++-- .../templates/indexExpansionsByName.ftlh | 2 +- .../indexExpansionsByUploadDate.ftlh | 2 +- .../templates/indexShipsByName.ftlh | 4 ++-- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/chaudhuri/ooliteaddonscanner2/Scanner.java b/src/main/java/com/chaudhuri/ooliteaddonscanner2/Scanner.java index 47c7a54..0864d42 100644 --- a/src/main/java/com/chaudhuri/ooliteaddonscanner2/Scanner.java +++ b/src/main/java/com/chaudhuri/ooliteaddonscanner2/Scanner.java @@ -442,10 +442,6 @@ public void run() { registry.processDependencies(); Verifier.verify(registry); - new File(outputDir, "equipment").mkdirs(); - new File(outputDir, "expansions").mkdirs(); - new File(outputDir, "ships").mkdirs(); - TemplateUtil.printExpansions(registry, outputDir, templateEngine); TemplateUtil.printEquipment(registry, outputDir, templateEngine); TemplateUtil.printShips(registry, outputDir, templateEngine); diff --git a/src/main/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtil.java b/src/main/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtil.java index f3bcb68..a2b1a8c 100644 --- a/src/main/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtil.java +++ b/src/main/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtil.java @@ -95,13 +95,15 @@ public static void printExpansions(Registry registry, File outputdir, TemplateEn throw new IllegalArgumentException(EXCEPTION_TEMPLATEENGINE_MUST_NOT_BE_NULL); } File expansionsDir = new File(outputdir, "expansions"); - expansionsDir.mkdirs(); for (Expansion expansion: registry.getExpansions()) { - File plantumlfile = new File(expansionsDir, expansion.getIdentifier()+PLANTUML_EXTENSION); + File expansionDir = new File(expansionsDir, expansion.getIdentifier()); + expansionDir.mkdirs(); + + File plantumlfile = new File(expansionDir, expansion.getIdentifier()+PLANTUML_EXTENSION); templateEngine.process(expansion, "expansionPlantUML.ftlh", plantumlfile); - PlantUMLUtil.generateDiagram(plantumlfile, expansionsDir); - templateEngine.process(expansion, "expansion.ftlh", new File(expansionsDir, expansion.getIdentifier()+HTML_EXTENSION)); + PlantUMLUtil.generateDiagram(plantumlfile, expansionDir); + templateEngine.process(expansion, "expansion.ftlh", new File(expansionDir, expansion.getIdentifier()+HTML_EXTENSION)); } } @@ -125,11 +127,12 @@ public static void printEquipment(Registry registry, File outputdir, TemplateEng if (templateEngine == null) { throw new IllegalArgumentException(EXCEPTION_TEMPLATEENGINE_MUST_NOT_BE_NULL); } - File equipmentDir = new File(outputdir, "equipment"); - equipmentDir.mkdirs(); + File expansionsDir = new File(outputdir, "expansions"); for (Equipment equipment: registry.getEquipment()) { - templateEngine.process(equipment, "equipment.ftlh", new File(equipmentDir, equipment.getIdentifier()+HTML_EXTENSION)); + File expansionDir = new File(expansionsDir, equipment.getExpansion().getIdentifier()); + expansionDir.mkdirs(); + templateEngine.process(equipment, "equipment.ftlh", new File(expansionDir, equipment.getIdentifier()+HTML_EXTENSION)); } } @@ -153,11 +156,12 @@ public static void printShips(Registry registry, File outputdir, TemplateEngine if (templateEngine == null) { throw new IllegalArgumentException(EXCEPTION_TEMPLATEENGINE_MUST_NOT_BE_NULL); } - File shipsDir = new File(outputdir, "ships"); - shipsDir.mkdirs(); + File expansionsDir = new File(outputdir, "expansions"); for (Ship ship: registry.getShips()) { - templateEngine.process(ship, "ship.ftlh", new File(shipsDir, ship.getIdentifier()+HTML_EXTENSION)); + File expansionDir = new File(expansionsDir, ship.getExpansion().getIdentifier()); + expansionDir.mkdirs(); + templateEngine.process(ship, "ship.ftlh", new File(expansionDir, ship.getIdentifier()+HTML_EXTENSION)); } } diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexAllByIdentifier.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexAllByIdentifier.ftlh index 085cc7f..1f9bc8c 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexAllByIdentifier.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexAllByIdentifier.ftlh @@ -24,7 +24,13 @@ <#list allByIdentifier as ww> <#assign type><#if ww.type == "Ship">ships<#if ww.type == "Expansion">expansions<#if ww.type == "Equipment">equipment - ${ww.type}${ ww.identifier }${ ww.name }<#if ww.expansion??>${ ww.expansion.name }<#if ww.asWikipage??>Wiki Page<#else>No Wiki + + ${ww.type} + <#if ww.expansion??><#else>${ ww.identifier } + <#if ww.expansion??><#else>${ ww.name } + <#if ww.expansion??>${ ww.expansion.name } + <#if ww.asWikipage??>Wiki Page<#else>No Wiki + diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh index 7ab6a98..c92af68 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh @@ -24,8 +24,8 @@ <#list equipmentByName as equipment> - ${ equipment.name } - ${ equipment.expansion.name } + ${ equipment.name } + ${ equipment.expansion.name } ${ equipment.cost } ${ equipment.techlevel?number + 1 }+ diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByName.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByName.ftlh index c55af43..8fe3bbe 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByName.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByName.ftlh @@ -25,7 +25,7 @@ <#list expansionsByName as expansion> - ${ expansion.title } + ${ expansion.title } <#if expansion.category??>${ expansion.category } <#if expansion.author??>${ expansion.author } <#if expansion.version??>${ expansion.version } diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByUploadDate.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByUploadDate.ftlh index efb2c33..2a257c6 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByUploadDate.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexExpansionsByUploadDate.ftlh @@ -25,7 +25,7 @@ <#list expansionsByUploadDate as expansion> - ${ expansion.title } + ${ expansion.title } <#if expansion.category??>${ expansion.category } <#if expansion.author??>${ expansion.author } <#if expansion.version??>${ expansion.version } diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh index 61a9597..6b5299d 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh @@ -23,8 +23,8 @@ <#list shipsByName as ship> - ${ ship.name } - ${ ship.expansion.name } + ${ ship.name } + ${ ship.expansion.name } ${ ship.features.roles!"" } <#if ship.template> From 164e76b5e7a4db095a97c062986ff8232d98b499 Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 22:14:15 +0200 Subject: [PATCH 03/16] Reduce wrong links --- .../chaudhuri/ooliteaddonscanner2/templates/expansion.ftlh | 4 ++-- .../ooliteaddonscanner2/templates/indexEquipmentByName.ftlh | 2 +- .../ooliteaddonscanner2/templates/indexShipsByName.ftlh | 2 +- .../com/chaudhuri/ooliteaddonscanner2/templates/ship.ftlh | 2 +- .../com/chaudhuri/ooliteaddonscanner2/templates/warnings.ftlh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/expansion.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/expansion.ftlh index 6d33095..a215b44 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/expansion.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/expansion.ftlh @@ -238,7 +238,7 @@ <#list equipment as e> - ${ e.name } + ${ e.name } ${ e.visible?string('yes', 'no') } ${ e.cost } ${ e.techlevel?number + 1 }+ @@ -259,7 +259,7 @@ <#list ships as ship> - ${ ship.name } + ${ ship.name } diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh index c92af68..aeb6531 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexEquipmentByName.ftlh @@ -24,7 +24,7 @@ <#list equipmentByName as equipment> - ${ equipment.name } + ${ equipment.name } ${ equipment.expansion.name } ${ equipment.cost } ${ equipment.techlevel?number + 1 }+ diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh index 6b5299d..60da7d4 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/indexShipsByName.ftlh @@ -23,7 +23,7 @@ <#list shipsByName as ship> - ${ ship.name } + ${ ship.name } ${ ship.expansion.name } ${ ship.features.roles!"" } diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/ship.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/ship.ftlh index bea4569..e841e56 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/ship.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/ship.ftlh @@ -16,7 +16,7 @@ - +
Identifier${ identifier }
Name${ name }
Expansion${ expansion.title }
Expansion${ expansion.title }
<#if asWikipage??>

More on ${asWikipage}

diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/warnings.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/warnings.ftlh index 1642048..3b8cfad 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/warnings.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/warnings.ftlh @@ -23,7 +23,7 @@ <#list expansions as expansion> <#if expansion.warnings?has_content> -

${ expansion.title }

+

${ expansion.title }

    <#list expansion.warnings as w>
  • ${ w }
  • From 35e7a426c4b40245b89167d6c1fe92cf08c7b48c Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 22:28:33 +0200 Subject: [PATCH 04/16] Reduce wrong links --- .../com/chaudhuri/ooliteaddonscanner2/templates/equipment.ftlh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/equipment.ftlh b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/equipment.ftlh index 184c1b7..2bbd90b 100644 --- a/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/equipment.ftlh +++ b/src/main/resources/com/chaudhuri/ooliteaddonscanner2/templates/equipment.ftlh @@ -21,7 +21,7 @@ Name${ name } Cost${ cost } deci-credits (divide by 10 to get credits) Tech Level${ techlevel } (available on ${ techlevel?number + 1 }+) - Expansion${ expansion.title } + Expansion${ expansion.title } Primeable<#if primeable>Yes<#else>No From 1e2f0c39fe5cfbed37d60805459c47f9f2498058 Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 22:31:27 +0200 Subject: [PATCH 05/16] Fix pipeline --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d5b6b02..aabff3a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Install required packages run: | - apt-get install -y graphviz + sudo apt-get install -y graphviz - name: Checkout project uses: actions/checkout@v4 From ed93513c701fb7ef34f626387808b6c0ab1186f0 Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 23:01:50 +0200 Subject: [PATCH 06/16] Fix testcase --- .../ooliteaddonscanner2/RegistryTest.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/chaudhuri/ooliteaddonscanner2/RegistryTest.java b/src/test/java/com/chaudhuri/ooliteaddonscanner2/RegistryTest.java index bf6741c..e6e8f5d 100644 --- a/src/test/java/com/chaudhuri/ooliteaddonscanner2/RegistryTest.java +++ b/src/test/java/com/chaudhuri/ooliteaddonscanner2/RegistryTest.java @@ -124,13 +124,14 @@ public void testAddShip_Ship() { log.debug("ships in registry: {}", registry.getShips()); assertEquals(2, registry.getShips().size()); assertEquals(0, registry.getWarnings().size()); - + + // see whether we overwrite or add ships with same identifier Ship ship3 = new Ship("s2"); ship3.setExpansion(oxp); registry.addShip(ship3); log.debug("ships in registry: {}", registry.getShips()); - assertEquals(2, registry.getShips().size()); - assertEquals(1, registry.getWarnings().size()); + assertEquals(3, registry.getShips().size()); + assertEquals(0, registry.getWarnings().size()); } /** @@ -438,25 +439,29 @@ public void testAddGetEquipment_Equipment() { } equipment.setExpansion(expansion); - registry.addEquipment(equipment); + registry.addEquipment(equipment); // add blah assertEquals(1, registry.getEquipment().size()); assertEquals(equipment, registry.getEquipment().get(0)); Equipment equipment2 = new Equipment(); equipment2.setIdentifier("blah2"); equipment2.setExpansion(expansion); - registry.addEquipment(equipment2); + registry.addEquipment(equipment2); // add blah2 assertEquals(2, registry.getEquipment().size()); assertEquals(equipment, registry.getEquipment().get(0)); assertEquals(equipment2, registry.getEquipment().get(1)); + // we used to overwrite equipment with same IDs. This is no longer the case, + // so we expect equipment to pile up. Equipment equipment3 = new Equipment(); equipment3.setIdentifier("blah"); equipment3.setExpansion(expansion); - registry.addEquipment(equipment3); - assertEquals(2, registry.getEquipment().size()); - assertEquals(equipment3, registry.getEquipment().get(0)); - assertEquals(equipment2, registry.getEquipment().get(1)); + registry.addEquipment(equipment3); // add another blah + log.info("expansions: {}", registry.getEquipment()); + assertEquals(3, registry.getEquipment().size()); + assertEquals(equipment, registry.getEquipment().get(0)); + assertEquals(equipment3, registry.getEquipment().get(1)); + assertEquals(equipment2, registry.getEquipment().get(2)); } /** From 731a63ca9af7033162111a2cf1e202cc0ad418ac Mon Sep 17 00:00:00 2001 From: cube Date: Mon, 8 Jun 2026 23:15:37 +0200 Subject: [PATCH 07/16] Fix testcase --- .../chaudhuri/ooliteaddonscanner2/TemplateUtilTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtilTest.java b/src/test/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtilTest.java index 590b53a..8f9f665 100644 --- a/src/test/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtilTest.java +++ b/src/test/java/com/chaudhuri/ooliteaddonscanner2/TemplateUtilTest.java @@ -285,7 +285,7 @@ public void testPrintExpansions4() throws Exception { assertTrue(outputdir.isDirectory()); TemplateUtil.printExpansions(registry, outputdir, templateEngine); - assertTrue(new File(outputdir, "expansions/myId.html").isFile()); + assertTrue(new File(outputdir, "expansions/myId/myId.html").isFile()); } /** @@ -312,7 +312,7 @@ public void testPrintExpansions5() throws Exception { assertTrue(outputdir.isDirectory()); TemplateUtil.printExpansions(registry, outputdir, templateEngine); - assertTrue(new File(outputdir, "expansions/myId.html").isFile()); + assertTrue(new File(outputdir, "expansions/myId/myId.html").isFile()); } /** @@ -395,7 +395,7 @@ public void testPrintEquipment4() throws Exception { assertTrue(outputdir.isDirectory()); TemplateUtil.printEquipment(registry, outputdir, templateEngine); - assertTrue(new File(outputdir, "equipment/myEquipment.html").isFile()); + assertTrue(new File(outputdir, "expansions/myExpansion/myEquipment.html").isFile()); } /** @@ -476,7 +476,7 @@ public void testPrintShips4() throws Exception { assertTrue(outputdir.isDirectory()); TemplateUtil.printShips(registry, outputdir, templateEngine); - assertTrue(new File(outputdir, "ships/myShip.html").isFile()); + assertTrue(new File(outputdir, "expansions/myExpansion/myShip.html").isFile()); } } From 1dbe8ff1cb10f868bf6c2469738112c15b4d4508 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 20:49:36 +0200 Subject: [PATCH 08/16] Add test run to pipeline --- .github/workflows/Build.yml | 61 ++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index aabff3a..57ba33f 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -14,14 +14,9 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Install required packages - run: | - sudo apt-get install -y graphviz - - name: Checkout project uses: actions/checkout@v4 with: @@ -59,6 +54,62 @@ jobs: name: OoliteAddonScanner path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip + test: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Install required packages + run: | + sudo apt-get install -y graphviz + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'adopt' + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: OoliteAddonScanner + path: artifacts + + - name: Restore expansions cache + id: cache-restore + uses: actions/cache/restore@v3 + with: + path: | + expansion-cache + key: ${{ runner.os }}-expansion_cache + + - name: Run example scan + run: | + B=$(basename "OoliteAddonScanner*") + java -jar $B/$B.jar --out target/OoliteExpansionIndex --cache expansion-cache --maxExpansion 30 + + - uses: actions/upload-artifact@v7 + with: + name: ExampleCatalog + path: target/output + + - name: Save Expansions Cache + id: cache-save + uses: actions/cache/save@v3 + with: + path: | + expansion-cache + key: ${{ runner.os }}-expansion_cache + + release: + needs: [build, test] + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: OoliteAddonScanner + path: artifacts + - name: Remove old prereleases if: github.ref != 'refs/heads/main' uses: s00d/delete-older-releases@0.2.1 From 8606afbd47710972230cc7b359536fe2979ddeb6 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 20:57:09 +0200 Subject: [PATCH 09/16] Fix yaml syntax --- .github/workflows/Build.yml | 254 ++++++++++++++++++------------------ 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 57ba33f..bff8d93 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -1,6 +1,6 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - +--- name: Build on: @@ -8,72 +8,72 @@ on: - cron: '0 0 1 * *' workflow_dispatch: push: - # branches: [ main ] + # branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout project - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.3.3 - with: - versionSpec: '6.6.x' - - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - java-version: '21' - distribution: 'adopt' - - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v4.3.3 - - - name: Build with Maven - run: | - mvn versions:set "-DnewVersion=${{ env.GitVersion_SemVer }}" - mvn -B package -e --file pom.xml - - - name: Check status - run: | - set - echo -n "Current directory: " - pwd - find - - - uses: actions/upload-artifact@v7 - with: - name: OoliteAddonScanner - path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip + - name: Checkout project + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v4.3.3 + with: + versionSpec: '6.6.x' + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'adopt' + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v4.3.3 + + - name: Build with Maven + run: | + mvn versions:set "-DnewVersion=${{ env.GitVersion_SemVer }}" + mvn -B package -e --file pom.xml + + - name: Check status + run: | + set + echo -n "Current directory: " + pwd + find + + - uses: actions/upload-artifact@v7 + with: + name: OoliteAddonScanner + path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip test: needs: [build] runs-on: ubuntu-latest steps: - - name: Install required packages - run: | - sudo apt-get install -y graphviz - - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - java-version: '21' - distribution: 'adopt' - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: OoliteAddonScanner - path: artifacts - + - name: Install required packages + run: | + sudo apt-get install -y graphviz + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'adopt' + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: OoliteAddonScanner + path: artifacts + - name: Restore expansions cache id: cache-restore uses: actions/cache/restore@v3 @@ -82,80 +82,80 @@ jobs: expansion-cache key: ${{ runner.os }}-expansion_cache - - name: Run example scan - run: | - B=$(basename "OoliteAddonScanner*") - java -jar $B/$B.jar --out target/OoliteExpansionIndex --cache expansion-cache --maxExpansion 30 - - - uses: actions/upload-artifact@v7 - with: - name: ExampleCatalog - path: target/output - - - name: Save Expansions Cache - id: cache-save - uses: actions/cache/save@v3 - with: - path: | - expansion-cache - key: ${{ runner.os }}-expansion_cache + - name: Run example scan + run: | + B=$(basename "OoliteAddonScanner*") + java -jar $B/$B.jar --out target/OoliteExpansionIndex --cache expansion-cache --maxExpansion 30 + + - uses: actions/upload-artifact@v7 + with: + name: ExampleCatalog + path: target/output + + - name: Save Expansions Cache + id: cache-save + uses: actions/cache/save@v3 + with: + path: | + expansion-cache + key: ${{ runner.os }}-expansion_cache release: needs: [build, test] runs-on: ubuntu-latest steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: OoliteAddonScanner - path: artifacts - - - name: Remove old prereleases - if: github.ref != 'refs/heads/main' - uses: s00d/delete-older-releases@0.2.1 - with: - #repo: / # defaults to current repo - keep_latest: 3 - delete_tag_pattern: v - delete_type: 'prerelease' - delete_branch: '${{ github.ref_name }}' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Prerelease - if: github.ref != 'refs/heads/main' - id: create_prerelease - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ env.GitVersion_SemVer }}" - prerelease: true - title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" - files: | - target/*.zip - target/*.tar.gz - - - name: Remove old releases - if: github.ref == 'refs/heads/main' - uses: s00d/delete-older-releases@0.2.1 - with: - #repo: / # defaults to current repo - keep_latest: 3 - delete_tag_pattern: v - delete_type: 'release' - delete_branch: 'main' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - if: github.ref == 'refs/heads/main' - id: create_release - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ env.GitVersion_SemVer }}" - prerelease: false - title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" - files: | - target/*.zip - target/*.tar.gz + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: OoliteAddonScanner + path: artifacts + + - name: Remove old prereleases + if: github.ref != 'refs/heads/main' + uses: s00d/delete-older-releases@0.2.1 + with: + # repo: / # defaults to current repo + keep_latest: 3 + delete_tag_pattern: v + delete_type: 'prerelease' + delete_branch: '${{ github.ref_name }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Prerelease + if: github.ref != 'refs/heads/main' + id: create_prerelease + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "v${{ env.GitVersion_SemVer }}" + prerelease: true + title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" + files: | + target/*.zip + target/*.tar.gz + + - name: Remove old releases + if: github.ref == 'refs/heads/main' + uses: s00d/delete-older-releases@0.2.1 + with: + # repo: / # defaults to current repo + keep_latest: 3 + delete_tag_pattern: v + delete_type: 'release' + delete_branch: 'main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + if: github.ref == 'refs/heads/main' + id: create_release + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "v${{ env.GitVersion_SemVer }}" + prerelease: false + title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" + files: | + target/*.zip + target/*.tar.gz From 4f379d55e36e2db25621e94dd04cad0d951ce5d9 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 21:10:48 +0200 Subject: [PATCH 10/16] add filesystem dump --- .github/workflows/Build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index bff8d93..1d12d8a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -73,6 +73,10 @@ jobs: with: name: OoliteAddonScanner path: artifacts + + - name: check filesystem + run: | + find - name: Restore expansions cache id: cache-restore From c31dea43e9dbbf39dbc7578987d02dd150fa9063 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 21:14:31 +0200 Subject: [PATCH 11/16] add extraction step --- .github/workflows/Build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1d12d8a..2b9b135 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -74,6 +74,10 @@ jobs: name: OoliteAddonScanner path: artifacts + - name: extract distribution + run: | + unzip artifacts/OoliteAddonScanner*.zip + - name: check filesystem run: | find From cc59304484cee07332aafa2613f8099e1553286e Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 21:21:21 +0200 Subject: [PATCH 12/16] Correct artifact upload --- .github/workflows/Build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 2b9b135..4036f6e 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -93,12 +93,12 @@ jobs: - name: Run example scan run: | B=$(basename "OoliteAddonScanner*") - java -jar $B/$B.jar --out target/OoliteExpansionIndex --cache expansion-cache --maxExpansion 30 + java -jar $B/$B.jar --out target/OoliteExpansionIndex --cache expansion-cache --maxExpansion 20 - uses: actions/upload-artifact@v7 with: name: ExampleCatalog - path: target/output + path: target/OoliteExpansionIndex - name: Save Expansions Cache id: cache-save From 89e53dfe55441954d416ac0cb7cf9fe7fcf213fc Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 22:06:32 +0200 Subject: [PATCH 13/16] Route semver through the pipeline --- .github/workflows/Build.yml | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 4036f6e..384567b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -13,8 +13,10 @@ on: branches: [main] jobs: - build: + versioning: runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} steps: - name: Checkout project @@ -27,19 +29,29 @@ jobs: with: versionSpec: '6.6.x' + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v4.3.3 + + build: + needs: [versioning] + runs-on: ubuntu-latest + + steps: + - name: Checkout project + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 21 uses: actions/setup-java@v5 with: java-version: '21' distribution: 'adopt' - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v4.3.3 - - name: Build with Maven run: | - mvn versions:set "-DnewVersion=${{ env.GitVersion_SemVer }}" + mvn versions:set "-DnewVersion=${{ needs.versioning.outputs.semVer }}" mvn -B package -e --file pom.xml - name: Check status @@ -52,7 +64,7 @@ jobs: - uses: actions/upload-artifact@v7 with: name: OoliteAddonScanner - path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip + path: target/OoliteAddonScanner-${{ needs.versioning.outputs.semVer }}-executable.zip test: needs: [build] @@ -136,9 +148,9 @@ jobs: uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ env.GitVersion_SemVer }}" + automatic_release_tag: "v${{ needs.versioning.outputs.semVer }}" prerelease: true - title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" + title: "OoliteAddonScanner v${{ needs.versioning.outputs.semVer }}" files: | target/*.zip target/*.tar.gz @@ -161,9 +173,9 @@ jobs: uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ env.GitVersion_SemVer }}" + automatic_release_tag: "v${{ needs.versioning.outputs.semVer }}" prerelease: false - title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" + title: "OoliteAddonScanner v${{ needs.versioning.outputs.semVer }}" files: | target/*.zip target/*.tar.gz From 92cd0323644ba292d7f3707b50f0542992044751 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 22:10:22 +0200 Subject: [PATCH 14/16] Route semver through the pipeline --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 384567b..fa8d4aa 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -121,7 +121,7 @@ jobs: key: ${{ runner.os }}-expansion_cache release: - needs: [build, test] + needs: [versioning, build, test] runs-on: ubuntu-latest steps: - name: Download artifacts From 4dea1377268c4db95a9969469d7b7f4f819a6c68 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 22:40:47 +0200 Subject: [PATCH 15/16] Fix adding artifacts to the releases --- .github/workflows/Build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index fa8d4aa..45ffb56 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -64,7 +64,7 @@ jobs: - uses: actions/upload-artifact@v7 with: name: OoliteAddonScanner - path: target/OoliteAddonScanner-${{ needs.versioning.outputs.semVer }}-executable.zip + path: target/OoliteAddonScanner-${{ needs.versioning.outputs.semVer }}-executable.* test: needs: [build] @@ -130,6 +130,10 @@ jobs: name: OoliteAddonScanner path: artifacts + - name: check filesystem + run: | + find + - name: Remove old prereleases if: github.ref != 'refs/heads/main' uses: s00d/delete-older-releases@0.2.1 @@ -152,8 +156,8 @@ jobs: prerelease: true title: "OoliteAddonScanner v${{ needs.versioning.outputs.semVer }}" files: | - target/*.zip - target/*.tar.gz + artifacts/target/*.zip + artifacts/target/*.tar.gz - name: Remove old releases if: github.ref == 'refs/heads/main' From 0b7cddc7c94c0a26da13650074ff4247a1bdc212 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 9 Jun 2026 22:44:15 +0200 Subject: [PATCH 16/16] Fix adding artifacts to the releases --- .github/workflows/Build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 45ffb56..3c3d75b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -156,8 +156,8 @@ jobs: prerelease: true title: "OoliteAddonScanner v${{ needs.versioning.outputs.semVer }}" files: | - artifacts/target/*.zip - artifacts/target/*.tar.gz + artifacts/*.zip + artifacts/*.tar.gz - name: Remove old releases if: github.ref == 'refs/heads/main'