diff --git a/jgiven-core/build.gradle b/jgiven-core/build.gradle index cee214e381..6e6273a343 100644 --- a/jgiven-core/build.gradle +++ b/jgiven-core/build.gradle @@ -24,31 +24,32 @@ sourceSets { } } -def buildNumber = getGitHash() +def buildNumber = 'git rev-parse --short HEAD'.execute().text.trim() + println 'BUILD SHA1: ' + buildNumber processResources { expand( - 'version': project.version, - 'buildNumber': buildNumber + 'version': project.version, + 'buildNumber': buildNumber ) } files { file("src/main/translations").listFiles() }.collect { - def pkg=it.getName().split("\\.")[0] + def pkg = it.getName().split("\\.")[0] def props = new Properties() it.withInputStream { props.load(it) } - props.pkg=pkg - def taskName = pkg+'Translation' + props.pkg = pkg + def taskName = pkg + 'Translation' - tasks.create(name: taskName, type: Copy) { + tasks.register(taskName, Copy) { from 'src/main/templates' into generatedSourceDir + "/com/tngtech/jgiven/lang/" + pkg - rename("Stage.template",props.stage_class+".java") - rename("SimpleScenarioTestBase.template",props.simple_scenario_test_base_class+".java") - rename("ScenarioTestBase.template",props.scenario_test_base_class+".java") + rename("Stage.template", props.stage_class + ".java") + rename("SimpleScenarioTestBase.template", props.simple_scenario_test_base_class + ".java") + rename("ScenarioTestBase.template", props.scenario_test_base_class + ".java") expand(props) filteringCharset = 'UTF-8' } @@ -58,15 +59,6 @@ files { file("src/main/translations").listFiles() }.collect { javadoc.dependsOn += taskName } -/** - * Copied from https://stackoverflow.com/questions/28498688/gradle-script-to-autoversion-and-include-the-commit-hash-in-android - * Author: Paul - */ -def getGitHash() { - def stdout = new ByteArrayOutputStream() - exec { - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = stdout - } - return stdout.toString().trim() +tasks.register("runShellCommand", Exec){ + commandLine 'git', 'rev-parse', '--short', 'HEAD' } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java index c1054ee442..195d534fe8 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ExecutionStatus.java @@ -6,4 +6,4 @@ public enum ExecutionStatus { FAILED, ABORTED, SOME_STEPS_PENDING -} \ No newline at end of file +} diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/report/text/PlainTextReportGeneratorTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/report/text/PlainTextReportGeneratorTest.java index 3b798332c3..8df29f2f14 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/report/text/PlainTextReportGeneratorTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/report/text/PlainTextReportGeneratorTest.java @@ -32,4 +32,4 @@ public void can_create_an_output_folder() throws IOException { assertThat(outputDir.list()) .contains("com.tngtech.jgiven.report.text.ResourceForPlainTextReportGeneratorTest.feature"); } -} \ No newline at end of file +} diff --git a/jgiven-core/src/test/resources/com.tngtech.jgiven.report.text.ResourceForPlainTextReportGeneratorTest.json b/jgiven-core/src/test/resources/com.tngtech.jgiven.report.text.ResourceForPlainTextReportGeneratorTest.json index 5f91045598..158c0ed81b 100644 --- a/jgiven-core/src/test/resources/com.tngtech.jgiven.report.text.ResourceForPlainTextReportGeneratorTest.json +++ b/jgiven-core/src/test/resources/com.tngtech.jgiven.report.text.ResourceForPlainTextReportGeneratorTest.json @@ -24,4 +24,4 @@ } ], "tagMap": {} -} \ No newline at end of file +} diff --git a/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/AssumptionTest.java b/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/AssumptionTest.java index 91248797d0..1d1705b5c4 100644 --- a/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/AssumptionTest.java +++ b/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/AssumptionTest.java @@ -54,4 +54,4 @@ private static void assertJAssumptionFailure() { private static void junitAssumptionFailure() { Assume.assumeTrue(false); } -} \ No newline at end of file +}