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> { ...@@ -35,17 +35,14 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
} }
} }
// if launcher is not available // if this project is the launcher
if (launcherProject == null) { if (project.name == 'zmt-launcher') {
// ... add dependency // make it an application
project.dependencies { configure(project, MAKE_APPLICATION)
runtime 'de.zmt:zmt-launcher:latest.release'
}
} }
// else if the launcher project is present
// if launcher project is available and it is not this project else if (launcherProject != null) {
if (launcherProject != null && launcherProject != project) { // include distribution contents from that project
// ... include its distribution
launcherProject.afterEvaluate { launcherProject.afterEvaluate {
project.distributions.main.contents { project.distributions.main.contents {
// include launcher and dependencies without sources // include launcher and dependencies without sources
...@@ -56,25 +53,38 @@ public class ZmtLaunchPlugin implements Plugin<Project> { ...@@ -56,25 +53,38 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
} }
} }
} }
// ... otherwise generate start scripts pointing to launcher // the launcher project is not present
else { else {
apply plugin: 'application' // add launcher dependency and make it an application
project.dependencies {
mainClassName = MAIN_CLASS_NAME runtime 'de.zmt:zmt-launcher:latest.release'
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'
} }
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 @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