@@ -174,12 +174,10 @@ task copyLicenses(type: Copy) {
174174 dependsOn ' generateLicenses'
175175 mustRunAfter ' createThirdPartyDirectory'
176176
177- def inputFiles = tasks. generateLicenses. outputs. files. asFileTree. files
178- .findAll { it. path. contains " dependency-license" }
179-
180- from inputFiles
177+ from new File (tasks. generateLicenses. xmlDestination. getAbsolutePath(), " dependency-license.json" ),
178+ new File (tasks. generateLicenses. xmlDestination. getAbsolutePath(), " dependency-license.html" ),
179+ new File (tasks. generateLicenses. xmlDestination. getAbsolutePath(), " dependency-license.xml" )
181180 into tasks. generateThirdPartyDirectory. thirdPartyDir
182- // Rename files to LICENSES.*
183181 eachFile {
184182 if (! path. contains(" dependency-license" )) {
185183 throw new GradleException (
@@ -191,11 +189,13 @@ task copyLicenses(type: Copy) {
191189 // Fails the build if we didn't copy everything. Gradle will fail silently if
192190 // it cannot copy one of the inputs which is dangerous when you're dealing
193191 // with legal obligations.
194- if (inputFiles. size() != inputs. sourceFiles. size()) {
192+ //
193+ // We're expecting exactly 3 input files, a JSON, XML and HTML version of
194+ // the license report.
195+ if (3 != inputs. sourceFiles. size()) {
195196 throw new GradleException (
196- " Failed to locate files to copy from. Expected: "
197- + inputFiles
198- + " but was: " + inputs. sourceFiles. toList())
197+ " Failed to locate files to copy from. Expected: 3 but was: "
198+ + inputs. sourceFiles. toList())
199199 }
200200 }
201201}
0 commit comments