mirror of
https://github.com/runelite/plugin-hub.git
synced 2026-04-04 15:03:37 -04:00
package: require plugins to be non-empty
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
path: |
|
||||
~/.gradle/caches/
|
||||
~/.gradle/wrapper/
|
||||
key: package-2.0.4
|
||||
key: package-2.0.5
|
||||
- name: prepare
|
||||
run: |
|
||||
pushd package
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
path: |
|
||||
~/.gradle/caches/
|
||||
~/.gradle/wrapper/
|
||||
key: upload-2.0.4
|
||||
key: upload-2.0.5
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: manifest_diff
|
||||
|
||||
@@ -627,6 +627,21 @@ public class Plugin implements Closeable
|
||||
.trimResults()
|
||||
.splitToList(pluginsStr);
|
||||
|
||||
if (plugins.isEmpty())
|
||||
{
|
||||
throw PluginBuildException.of(this, "No plugin classes listed")
|
||||
.withHelp(() ->
|
||||
{
|
||||
String m = "You must list your plugin class names in the plugin descriptor";
|
||||
if (!pluginClasses.isEmpty())
|
||||
{
|
||||
m += "\nPerhaps you wanted plugins=" + String.join(", ", pluginClasses);
|
||||
}
|
||||
return m;
|
||||
})
|
||||
.withFileLine(propFile, "plugins=" + pluginsStr);
|
||||
}
|
||||
|
||||
manifest.setPlugins(plugins.toArray(new String[0]));
|
||||
|
||||
for (String className : plugins)
|
||||
|
||||
@@ -100,6 +100,26 @@ public class PluginTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyPlugins() throws DisabledPluginException, PluginBuildException, IOException, InterruptedException
|
||||
{
|
||||
try (Plugin p = createExamplePlugin("empty-plugins"))
|
||||
{
|
||||
File propFile = new File(p.repositoryDirectory, "runelite-plugin.properties");
|
||||
Properties props = Plugin.loadProperties(propFile);
|
||||
props.setProperty("plugins", "");
|
||||
writeProperties(props, propFile);
|
||||
p.build(Util.readRLVersion());
|
||||
p.assembleManifest();
|
||||
Assert.fail();
|
||||
}
|
||||
catch (PluginBuildException e)
|
||||
{
|
||||
log.info("ok: ", e);
|
||||
assertContains(e.getHelpText(), "com.example.ExamplePlugin");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnverifiedDependency() throws InterruptedException, DisabledPluginException, PluginBuildException, IOException
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user