Commit 043c1672 authored by Christian Meyer's avatar Christian Meyer
Browse files

tests: project gets evaluated

ZmtEclipsePlugin.java
    fixed import
    launcher project is accessed only if present
    replaced launcher project names with constant
ZmtEclipsePlugin, ZmtJavadocPlugin.java
    referring to class literals via '.class' to be explicit
parent 5502e710
package de.zmt.gradle;
import org.gradle.api.*
import org.gradle.api.artifacts.ProjectDependency
/*
* Eclipse Plugin for simulations based on zmt.core
......@@ -8,12 +9,14 @@ import org.gradle.api.*
* With this plugin a launch configuration will be generated to launch the
* simulation in eclipse via launcher.
*/
public class ZmtEclipsePlugin implements Plugin<Project> {
class ZmtEclipsePlugin implements Plugin<Project> {
private static final def LAUNCHER_PROJECT_NAME = 'zmt-launcher'
private static final def CONFIGURE = {
// need to have dependencies and stuff evaluated
afterEvaluate {
// also generate eclipse files in dependencies
configurations.compile.dependencies.withType(ProjectDependency).each {
configurations.compile.dependencies.withType(ProjectDependency.class).each {
// need to evaluate dependencies first
evaluationDependsOn(it.dependencyProject.path)
if (it.dependencyProject.plugins.hasPlugin('eclipse')) {
......@@ -23,13 +26,14 @@ public class ZmtEclipsePlugin implements Plugin<Project> {
}
}
// ... and for launcher
tasks.eclipse.dependsOn(':zmt.launcher:eclipse')
tasks.cleanEclipse.dependsOn(':zmt.launcher:cleanEclipse')
tasks.eclipse.dependsOn(':LAUNCHER_PROJECT_NAME:eclipse')
tasks.cleanEclipse.dependsOn(':LAUNCHER_PROJECT_NAME:cleanEclipse')
/* add runtime dependency for this project in launcher
to make it executable in eclipse */
project(':zmt.launcher').afterEvaluate {
project(':zmt.launcher').dependencies {
Project launcherProject = findProject(':LAUNCHER_PROJECT_NAME')
launcherProject?.afterEvaluate {
launcherProject.dependencies {
runtime(project) {
transitive = false
}
......@@ -47,14 +51,14 @@ public class ZmtEclipsePlugin implements Plugin<Project> {
launchConfig.text = """<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<launchConfiguration type=\"org.eclipse.jdt.launching.localJavaApplication\">
<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_PATHS\">
<listEntry value=\"/zmt.launcher/src/main/java/de/zmt/Main.java\"/>
<listEntry value=\"/$LAUNCHER_PROJECT_NAME/src/main/java/de/zmt/Main.java\"/>
</listAttribute>
<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_TYPES\">
<listEntry value=\"1\"/>
</listAttribute>
<stringAttribute key=\"org.eclipse.jdt.launching.MAIN_TYPE\" value=\"de.zmt.Main\"/>
<stringAttribute key=\"org.eclipse.jdt.launching.PROGRAM_ARGUMENTS\" value=\"$project.name gui\"/>
<stringAttribute key=\"org.eclipse.jdt.launching.PROJECT_ATTR\" value=\"zmt.launcher\"/>
<stringAttribute key=\"org.eclipse.jdt.launching.PROJECT_ATTR\" value=\"$LAUNCHER_PROJECT_NAME\"/>
<stringAttribute key=\"org.eclipse.jdt.launching.WORKING_DIRECTORY\" value=\"\${workspace_loc:$project.name}\"/>
</launchConfiguration>"""
}
......
......@@ -14,10 +14,9 @@ class ZmtJavadocPlugin implements Plugin<Project> {
apply plugin: be.jlrhome.gradle.plantuml.PlantumlPlugin
// use svg instead of the default (png)
plantuml.fileFormat = net.sourceforge.plantuml.FileFormat.SVG
// do javadoc setup after evaluating project build files
afterEvaluate {
def projectDependencies = configurations.compile.dependencies.withType(ProjectDependency)
def projectDependencies = configurations.compile.dependencies.withType(ProjectDependency.class)
// making compile dependency project evaluate before
projectDependencies.each {
......
......@@ -19,5 +19,7 @@ class ZmtLibraryPluginTest {
assertTrue(plugins.hasPlugin(ZmtDeployPlugin.class))
assertTrue(plugins.hasPlugin(ZmtPublishPlugin.class))
}
project.evaluate()
}
}
......@@ -20,5 +20,7 @@ class ZmtSimulationPluginTest {
assertTrue(plugins.hasPlugin(ZmtDistributionPlugin.class))
assertTrue(plugins.hasPlugin(ZmtEclipsePlugin.class))
}
project.evaluate()
}
}
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