File tree Expand file tree Collapse file tree
groovy/com/github/gradle/node Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,12 +165,15 @@ class NpmInstall_integTest extends AbstractIntegTest {
165165 npmInstallCommand = ' install'
166166 }
167167
168+ def lock = file(' package-lock.json' )
168169 task verifyIO {
170+ def outputs = tasks. named(" npmInstall" ). get(). outputs. files
171+ def inputs = tasks. named(" npmInstall" ). get(). inputs. files
169172 doLast {
170- if (! tasks . named( " npmInstall " ) . get() . outputs. files . contains(file( ' package- lock.json ' ) )) {
173+ if (! outputs. contains(lock)) {
171174 throw new RuntimeException (" package-lock.json is not in INSTALL'S outputs!" )
172175 }
173- if (tasks . named( " npmInstall " ) . get() . inputs. files . contains(file( ' package- lock.json ' ) )) {
176+ if (inputs. contains(lock)) {
174177 throw new RuntimeException (" package-lock.json is in INSTALL'S inputs!" )
175178 }
176179 }
@@ -202,12 +205,15 @@ class NpmInstall_integTest extends AbstractIntegTest {
202205 npmInstallCommand = ' ci'
203206 }
204207
208+ def lock = file(' package-lock.json' )
205209 task verifyIO {
210+ def outputs = tasks. named(" npmInstall" ). get(). outputs. files
211+ def inputs = tasks. named(" npmInstall" ). get(). inputs. files
206212 doLast {
207- if (tasks . named( " npmInstall " ) . get() . outputs. files . contains(file( ' package- lock.json ' ) )) {
213+ if (outputs. contains(lock)) {
208214 throw new RuntimeException (" package-lock.json is in CI'S outputs!" )
209215 }
210- if (! tasks . named( " npmInstall " ) . get() . inputs. files . contains(file( ' package- lock.json ' ) )) {
216+ if (! inputs. contains(lock)) {
211217 throw new RuntimeException (" package-lock.json is not in CI'S inputs!" )
212218 }
213219 }
Original file line number Diff line number Diff line change @@ -81,8 +81,13 @@ class NodeTask_integTest extends AbstractIntegTest {
8181
8282 then:
8383 result8.task(":executeDirectoryScript").outcome == TaskOutcome.FAILED
84- // Gradle < 7 || Gradle >= 7
85- result8.output.contains("specified for property ' script' is not a file") || result8.output.contains("Reason: Expected an input to be a file but it was a directory.")
84+ if (gv < GradleVersion.version("7.0")) {
85+ assert result8.output.contains("specified for property ' script' is not a file")
86+ } else if (gv < GradleVersion.version("8.0-milestone-1")) {
87+ assert result8.output.contains("Reason: Expected an input to be a file but it was a directory.")
88+ } else {
89+ assert result8.output.contains("Accessing unreadable inputs or outputs is not supported.")
90+ }
8691
8792 when:
8893 def result9 = build(":version")
Original file line number Diff line number Diff line change @@ -45,9 +45,11 @@ if (ignoreExitValue) {
4545 env. ignoreExitValue = true
4646}
4747
48- if (outputFile) {
48+ if (isPropertyEnabled(" outputFile" )) {
49+ def out = project. objects. fileProperty()
50+ out. set(project. file(" ${ buildDir} /standard-output.txt" ))
4951 env. execOverrides {
50- standardOutput = new FileOutputStream (" ${ buildDir } /standard-output.txt " )
52+ standardOutput = new FileOutputStream (out . get() . asFile )
5153 }
5254}
5355
Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ task hello(type: NodeTask) {
77}
88
99task countRepositories {
10+ def size = repositories. size()
1011 dependsOn nodeSetup
1112 doLast {
12- println " Project repositories: ${ repositories. size() } "
13+ println " Project repositories: ${ size} "
1314 }
1415}
1516
Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ if (changeArgs) {
2929 hello. args = [" Bob" , " Alice" ]
3030}
3131
32+ def scriptFile = file(" ." )
33+
3234task executeDirectoryScript (type : NodeTask ) {
33- script = file( " . " )
35+ script = scriptFile
3436 outputs. upToDateWhen {
3537 true
3638 }
Original file line number Diff line number Diff line change @@ -52,8 +52,10 @@ if (isPropertyEnabled("customWorkingDir")) {
5252}
5353
5454if (isPropertyEnabled(" outputFile" )) {
55+ def out = project. objects. fileProperty()
56+ out. set(project. file(" ${ buildDir} /standard-output.txt" ))
5557 env. execOverrides {
56- standardOutput = new FileOutputStream (" ${ buildDir } /standard-output.txt " )
58+ standardOutput = new FileOutputStream (out . get() . asFile )
5759 }
5860}
5961
You can’t perform that action at this time.
0 commit comments