Skip to content

Commit

Permalink
fix: updated gradle plugin to work with multimodule projects
Browse files Browse the repository at this point in the history
  • Loading branch information
YamStranger committed Feb 9, 2016
1 parent 18019a4 commit cbc92cb
Showing 1 changed file with 12 additions and 4 deletions.
@@ -1,7 +1,9 @@
package net.serenitybdd.plugins.gradle

import net.thucydides.core.guice.Injectors
import net.thucydides.core.reports.ResultChecker
import net.thucydides.core.reports.html.HtmlAggregateStoryReporter
import net.thucydides.core.webdriver.Configuration
import org.gradle.api.Plugin
import org.gradle.api.Project

Expand All @@ -11,12 +13,9 @@ class SerenityPlugin implements Plugin<Project> {

@Override
void apply(Project project) {
if(!System.properties['project.build.directory']){
System.properties['project.build.directory'] = project.projectDir.getAbsolutePath()
}
project.extensions.create("serenity", SerenityPluginExtension)

project.task('aggregate') {
updateProperties(project)
group 'Serenity BDD'
description 'Generates aggregated Serenity reports'
doLast {
Expand All @@ -38,6 +37,7 @@ class SerenityPlugin implements Plugin<Project> {
}

project.task('checkOutcomes') {
updateProperties(project)
group 'Serenity BDD'
description "Checks the Serenity reports and fails the build if there are test failures (run automatically with 'check')"

Expand All @@ -53,6 +53,7 @@ class SerenityPlugin implements Plugin<Project> {
}
}
project.task('clearReports') {
updateProperties(project)
group 'Serenity BDD'
description "Deletes the Serenity output directory (run automatically with 'clean')"

Expand Down Expand Up @@ -80,4 +81,11 @@ class SerenityPlugin implements Plugin<Project> {
}
outputDir
}

def updateProperties(Project project) {
System.properties['project.build.directory'] = project.projectDir.getAbsolutePath()
def config = Injectors.getInjector().getProvider(Configuration.class).get()
project.serenity.outputDirectory = config.getOutputDirectory()
project.serenity.sourceDirectory = config.getOutputDirectory()
}
}

0 comments on commit cbc92cb

Please sign in to comment.