mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-12-06 11:17:19 +00:00
Throw custom exception on missing plugin dependency
This commit is contained in:
1 parent
86fba62ab9
commit
7e6039356d
1 file changed
+17
-1
@@ -68,9 +68,25 @@ class ApolloPluginExtension {
|
||||
|
||||
def setDependencies(List<String> dependencies) {
|
||||
dependencies.each {
|
||||
project.dependencies.add('compile', project.findProject(":game:plugin:$it"))
|
||||
def project = project.findProject(":game:plugin:$it")
|
||||
if (project == null) {
|
||||
throw new MissingPluginDependencyException(name, it)
|
||||
}
|
||||
|
||||
this.project.dependencies.add('compile', project)
|
||||
}
|
||||
|
||||
this.dependencies = dependencies
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link RuntimeException} thrown when a plugin dependency was missing.
|
||||
*/
|
||||
class MissingPluginDependencyException extends RuntimeException {
|
||||
|
||||
MissingPluginDependencyException(String plugin, String dependency) {
|
||||
super("Missing dependency in the `$plugin` plugin: failed to resolve `$dependency`.")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user