From 467a9816e722b823629fddc65e06356da3f4fe39 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 4 May 2023 21:46:10 -0700 Subject: [PATCH] package: Fail building manifest with placeholder values --- .../net/runelite/pluginhub/packager/Plugin.java | 14 +++++++++++--- .../runelite/pluginhub/packager/PluginTest.java | 10 +++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/package/package/src/main/java/net/runelite/pluginhub/packager/Plugin.java b/package/package/src/main/java/net/runelite/pluginhub/packager/Plugin.java index 452c8966b..c21622bbc 100644 --- a/package/package/src/main/java/net/runelite/pluginhub/packager/Plugin.java +++ b/package/package/src/main/java/net/runelite/pluginhub/packager/Plugin.java @@ -739,7 +739,7 @@ public class Plugin implements Closeable { String displayName = (String) props.remove("displayName"); - if (Strings.isNullOrEmpty(displayName)) + if (Strings.isNullOrEmpty(displayName) || disallowedFatal && "Example".equals(displayName)) { throw PluginBuildException.of(this, "\"displayName\" must be set") .withFile(propFile); @@ -749,7 +749,7 @@ public class Plugin implements Closeable { String author = (String) props.remove("author"); - if (Strings.isNullOrEmpty(author)) + if (Strings.isNullOrEmpty(author) || disallowedFatal && "Nobody".equals(author)) { throw PluginBuildException.of(this, "\"author\" must be set") .withFile(propFile); @@ -775,7 +775,15 @@ public class Plugin implements Closeable } } - manifest.setDescription((String) props.remove("description")); + { + String description = (String) props.remove("description"); + if (disallowedFatal && "An example greeter plugin".equals(description)) + { + throw PluginBuildException.of(this, "\"description\" must be set") + .withFile(propFile); + } + manifest.setDescription(description); + } { String tagsStr = (String) props.remove("tags"); diff --git a/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java b/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java index 7c0b6c2a9..a5a72e2e7 100644 --- a/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java +++ b/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java @@ -96,7 +96,7 @@ public class PluginTest catch (PluginBuildException e) { log.info("ok: ", e); - assertContains(e.getHelpText(), "com.example.ExamplePlugin"); + assertContains(e.getHelpText(), "com.example.TestExamplePlugin"); } } @@ -116,7 +116,7 @@ public class PluginTest catch (PluginBuildException e) { log.info("ok: ", e); - assertContains(e.getHelpText(), "com.example.ExamplePlugin"); + assertContains(e.getHelpText(), "com.example.TestExamplePlugin"); } } @@ -180,10 +180,10 @@ public class PluginTest new File("./create_new_plugin.py").getAbsolutePath(), "--noninteractive", "--output_directory", p.repositoryDirectory.getAbsolutePath(), - "--name", "Example", + "--name", "Test Example", "--package", "com.example", - "--author", "Nobody", - "--description", "An example greeter plugin") + "--author", "Test Nobody", + "--description", "Test An example greeter plugin") .inheritIO() .start() .waitFor());