Commit f6052632 authored by Christian Meyer's avatar Christian Meyer
Browse files

ZmtLaunchPlugin.groovy: fixed issues when applying plugin to launcher project

parent cd26c900
......@@ -35,17 +35,14 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
}
}
// if launcher is not available
if (launcherProject == null) {
// ... add dependency
project.dependencies {
runtime 'de.zmt:zmt-launcher:latest.release'
}
// if this project is the launcher
if (project.name == 'zmt-launcher') {
// make it an application
configure(project, MAKE_APPLICATION)
}
// if launcher project is available and it is not this project
if (launcherProject != null && launcherProject != project) {
// ... include its distribution
// else if the launcher project is present
else if (launcherProject != null) {
// include distribution contents from that project
launcherProject.afterEvaluate {
project.distributions.main.contents {
// include launcher and dependencies without sources
......@@ -56,25 +53,38 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
}
}
}
// ... otherwise generate start scripts pointing to launcher
// the launcher project is not present
else {
apply plugin: 'application'
mainClassName = MAIN_CLASS_NAME
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
startScripts {
/* Although launcher does not depend on other simulations, those
* are needed to be included in the class path to be launched. */
classpath += files('$APP_HOME/lib/*')
applicationName = 'launcher'
// add launcher dependency and make it an application
project.dependencies {
runtime 'de.zmt:zmt-launcher:latest.release'
}
configure(project, MAKE_APPLICATION)
}
// make jar executable
jar {
manifest {
attributes 'Main-Class': MAIN_CLASS_NAME
}
}
}
/**
* Applies the application plugin, makes the main class point to launcher
* and adds start scripts.
*/
private static final def MAKE_APPLICATION = {
apply plugin: 'application'
mainClassName = MAIN_CLASS_NAME
startScripts {
/* Although launcher does not depend on other simulations, those
* are needed to be included in the class path to be launched. */
classpath += files('$APP_HOME/lib/*')
applicationName = 'launcher'
}
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment