mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-05-02 12:48:36 +02:00
Use build-results file for root project dirs
Instead of using a separate mechanism and init script, reuse the information captured in the build-results file.
This commit is contained in:
parent
e234151ec9
commit
e644288a42
6 changed files with 8 additions and 145 deletions
|
@ -1,77 +0,0 @@
|
|||
package com.gradle.gradlebuildaction
|
||||
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
||||
class TestProjectRootCapture extends BaseInitScriptTest {
|
||||
def initScript = 'project-root-capture.init.gradle'
|
||||
|
||||
def "captures project root on #testGradleVersion"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
run(['help'], initScript, testGradleVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assertCapturesProjectRoot()
|
||||
|
||||
where:
|
||||
testGradleVersion << CONFIGURATION_CACHE_VERSIONS
|
||||
}
|
||||
|
||||
def "captures project root on #testGradleVersion when build fails"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
addFailingTaskToBuild()
|
||||
|
||||
when:
|
||||
runAndFail(['expectFailure'], initScript, testGradleVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assertCapturesProjectRoot()
|
||||
|
||||
where:
|
||||
testGradleVersion << CONFIGURATION_CACHE_VERSIONS
|
||||
}
|
||||
|
||||
def "captures project root on #testGradleVersion with --configuration-cache"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
run(['help', '--configuration-cache'], initScript, testGradleVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assertCapturesProjectRoot()
|
||||
assert projectRootList.delete()
|
||||
|
||||
when:
|
||||
run(['help', '--configuration-cache'], initScript, testGradleVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assertCapturesProjectRoot()
|
||||
|
||||
where:
|
||||
testGradleVersion << CONFIGURATION_CACHE_VERSIONS
|
||||
}
|
||||
|
||||
def "has no effect on #testVersion"() {
|
||||
assumeTrue testVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
run(['help'], initScript, testVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assert !projectRootList.exists()
|
||||
|
||||
where:
|
||||
testVersion << (ALL_VERSIONS - CONFIGURATION_CACHE_VERSIONS)
|
||||
}
|
||||
|
||||
private void assertCapturesProjectRoot() {
|
||||
assert projectRootList.exists()
|
||||
assert new File(projectRootList.text.trim()).canonicalPath == testProjectDir.canonicalPath
|
||||
}
|
||||
|
||||
private File getProjectRootList() {
|
||||
new File(testProjectDir, 'project-roots.txt')
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue