Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ecomod
zmt-build
Commits
f6052632
Commit
f6052632
authored
Aug 18, 2016
by
Christian Meyer
Browse files
ZmtLaunchPlugin.groovy: fixed issues when applying plugin to launcher project
parent
cd26c900
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/groovy/de/zmt/gradle/ZmtLaunchPlugin.groovy
View file @
f6052632
...
@@ -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,17 +53,32 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
...
@@ -56,17 +53,32 @@ 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'
}
configure
(
project
,
MAKE_APPLICATION
)
}
// make jar executable
jar
{
jar
{
manifest
{
manifest
{
attributes
'Main-Class'
:
mainClassName
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
{
startScripts
{
/* Although launcher does not depend on other simulations, those
/* Although launcher does not depend on other simulations, those
* are needed to be included in the class path to be launched. */
* are needed to be included in the class path to be launched. */
...
@@ -75,8 +87,6 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
...
@@ -75,8 +87,6 @@ public class ZmtLaunchPlugin implements Plugin<Project> {
}
}
}
}
}
@Override
@Override
void
apply
(
Project
project
)
{
void
apply
(
Project
project
)
{
project
.
configure
(
project
,
CONFIGURE
)
project
.
configure
(
project
,
CONFIGURE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment