package: Fail building manifest with placeholder values

This commit is contained in:
Jordan Atwood
2023-05-04 21:46:10 -07:00
committed by Abex
parent 039d5cd034
commit 467a9816e7
2 changed files with 16 additions and 8 deletions

View File

@@ -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");

View File

@@ -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());