-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/separate plugin config and execution #1542
Changes from all commits
371035c
6ffb5ef
da07bf2
0a38e50
53630c1
23f5f91
24f06a7
ff79eed
12baebc
92f1449
02df77b
ee64ff2
9be2e78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
package com.tngtech.jgiven.gradle; | ||
|
||
import java.io.File; | ||
import org.gradle.api.file.DirectoryProperty; | ||
|
||
public class JGivenTaskExtension { | ||
private File resultsDir; | ||
public interface JGivenTaskExtension { | ||
DirectoryProperty getResultsDir(); | ||
|
||
public File getResultsDir() { | ||
return resultsDir; | ||
} | ||
|
||
public void setResultsDir( File resultsDir ) { | ||
this.resultsDir = resultsDir; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,37 @@ class JGivenPluginShould extends Specification { | |
buildFile = new File(testProjectDir,'build.gradle') | ||
} | ||
|
||
def "configuration is cacheable"() { | ||
given: | ||
buildFile << """ | ||
plugins { | ||
id 'java' | ||
id 'com.tngtech.jgiven.gradle-plugin' | ||
} | ||
|
||
repositories { mavenCentral() } | ||
dependencies { | ||
testImplementation 'com.tngtech.jgiven:jgiven-junit:1.2.5' | ||
testImplementation 'junit:junit:4.13.2' | ||
} | ||
""" | ||
|
||
new File(testProjectDir,"src/test/java").mkdirs() | ||
File scenario = new File(testProjectDir,"src/test/java/SimpleScenario.java") | ||
scenario << Resources.toByteArray(Resources.getResource("SimpleScenario.java")) | ||
|
||
when: | ||
def result = GradleRunner.create() | ||
.withProjectDir(testProjectDir) | ||
.withArguments("--configuration-cache", "test", "jgivenTestReport", "-S", "--info"/*, "-Dorg.gradle.debug=true"*/ ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this comment still have some purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could remove that comment but add this line:
Then, when you start a test in debug in IntelliJ, it will run the "Gradle under test" in the same process that you are debugging. And you can debug inside plugin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Damn, I totally missed that. but @jjohannes thanks for the suggestion |
||
.withPluginClasspath() | ||
.build() | ||
|
||
then: | ||
result.task(":test").outcome == SUCCESS | ||
result.task(":jgivenTestReport").outcome == SUCCESS | ||
} | ||
|
||
def "test is cacheable"() { | ||
given: | ||
buildFile << """ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reconsider what the formatter did here :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this import be avoidable?