@@ -97,8 +97,10 @@ tasks.register('updateVersionNumbersInDocs', Copy) {
9797tasks. register(' zipMavenExamples' , Zip ) {
9898 description = ' Creates a zip archive for the Maven examples.'
9999 archiveFileName = " mvn-examples.zip"
100- // Defer reading of cfWebsite until execution time to avoid configuration failures.
101- destinationDirectory = layout. projectDirectory. dir(providers. gradleProperty(' cfWebsite' ))
100+
101+ def cfWebsite = providers. gradleProperty(' cfWebsite' )
102+ destinationDirectory = file(cfWebsite. getOrElse(layout. buildDirectory. file(' cfWebsite' ). get(). toString()))
103+
102104 from(' docs/examples/MavenExample' )
103105}
104106
@@ -107,15 +109,9 @@ tasks.register('copyToWebsite', Copy) {
107109 description = ' Copy files to location set in the property cfWebsite.'
108110 dependsOn(' :allJavadoc' , ' :manual' , ' :zip' , ' zipMavenExamples' )
109111
110- // Defer reading of cfWebsite until execution time and set the task's
111- // destination directory so it affects all subsequent `into` clauses.
112- def cfWebsite = providers. gradleProperty(' cfWebsite' )
113- doFirst {
114- if (! cfWebsite. isPresent()) {
115- throw new GradleException (" Property 'cfWebsite' is required. Pass -PcfWebsite=/abs/or/relative/path" )
116- }
117- destinationDir = file(cfWebsite. get())
118- }
112+ String cfWebsite = findProject(' cfWebsite' ) ?: layout. buildDirectory. file(' cfWebsite' ). get(). toString()
113+ destinationDir = file(cfWebsite)
114+
119115 from tasks. named(' zip' , Zip ). get(). archiveFile. get(). toString()
120116 from(' docs' ) {
121117 include(' checker-framework-webpage.html' , ' CHANGELOG.md' )
@@ -182,16 +178,19 @@ tasks.register('copyToWebsite', Copy) {
182178 into ' annotation-file-utilities'
183179 }
184180
181+ doFirst {
182+ delete(cfWebsite)
183+ }
184+
185185 doLast {
186- def dest = cfWebsite. get()
187- delete(file(" ${ dest} /index.html" ))
188- Files . createSymbolicLink(file(" ${ dest} /index.html" ). toPath(), Paths . get(' checker-framework-webpage.html' ))
186+ delete(" ${ cfWebsite} /index.html" )
187+ Files . createSymbolicLink(file(" ${ cfWebsite} /index.html" ). toPath(), Paths . get(' checker-framework-webpage.html' ))
189188
190- delete(file( " ${ dest } /manual/index.html" ) )
191- Files . createSymbolicLink(file(" ${ dest } /manual/index.html" ). toPath(), Paths . get(' manual.html' ))
189+ delete(" ${ cfWebsite } /manual/index.html" )
190+ Files . createSymbolicLink(file(" ${ cfWebsite } /manual/index.html" ). toPath(), Paths . get(' manual.html' ))
192191
193- delete " ${ dest } /annotation-file-utilities/index.html"
194- Files . createSymbolicLink(file(" ${ dest } /annotation-file-utilities/index.html" ). toPath(), Paths . get(' annotation-file-utilities.html' ))
192+ delete( " ${ cfWebsite } /annotation-file-utilities/index.html" )
193+ Files . createSymbolicLink(file(" ${ cfWebsite } /annotation-file-utilities/index.html" ). toPath(), Paths . get(' annotation-file-utilities.html' ))
195194 }
196195}
197196
@@ -200,10 +199,9 @@ tasks.register('updateCopyMavenExample', Copy) {
200199 description = ' Copies the Maven example to the location in property destDir.'
201200 // Defer reading of destDir until execution time and set the task's
202201 // destination directory so it affects all subsequent `into` clauses.
202+
203203 def destDir = providers. gradleProperty(' destDir' ). map { it + ' /MavenExample' }
204- doFirst {
205- destinationDir = file(destDir. get())
206- }
204+ destinationDir = file(destDir. getOrElse(layout. buildDirectory. file(' cfWebsite/MavenExample' ). get(). toString()))
207205 from ' docs/examples/MavenExample'
208206 filter { String line ->
209207 line. replaceAll(" <!-- checker-framework-version -->(.*)<!-- /checker-framework-version -->" , " <!-- checker-framework-version -->${ releaseVersion} <!-- /checker-framework-version -->" )
0 commit comments