mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
Make LoggedExec gradle task configuration cache compatible (#87621)
This changes the LoggedExec task to be configuration cache compatible. We changed the implementation to use `ExecOperations` instead of extending `Exec` task. As double checked with the Gradle team this task is not planned to be made configuration cache compatible out of the box anytime soon. This is part of the effort on https://github.com/elastic/elasticsearch/issues/57918
This commit is contained in:
parent
f99ee51c5d
commit
dbf39741a0
12 changed files with 381 additions and 127 deletions
|
@ -475,15 +475,13 @@ subprojects {
|
|||
if (project.name.contains('deb')) {
|
||||
checkLicenseMetadataTaskProvider.configure { LoggedExec exec ->
|
||||
onlyIf dpkgExists
|
||||
final ByteArrayOutputStream output = new ByteArrayOutputStream()
|
||||
exec.commandLine 'dpkg-deb', '--info', "${-> buildDist.get().outputs.files.filter(debFilter).singleFile}"
|
||||
exec.standardOutput = output
|
||||
exec.getCaptureOutput().set(true)
|
||||
doLast {
|
||||
String expectedLicense
|
||||
expectedLicense = "Elastic-License"
|
||||
final Pattern pattern = Pattern.compile("\\s*License: (.+)")
|
||||
final String info = output.toString('UTF-8')
|
||||
final String[] actualLines = info.split("\n")
|
||||
final String[] actualLines = getOutput().split("\n")
|
||||
int count = 0
|
||||
for (final String actualLine : actualLines) {
|
||||
final Matcher matcher = pattern.matcher(actualLine)
|
||||
|
@ -507,11 +505,10 @@ subprojects {
|
|||
assert project.name.contains('rpm')
|
||||
checkLicenseMetadataTaskProvider.configure { LoggedExec exec ->
|
||||
onlyIf rpmExists
|
||||
final ByteArrayOutputStream output = new ByteArrayOutputStream()
|
||||
exec.commandLine 'rpm', '-qp', '--queryformat', '%{License}', "${-> buildDist.get().outputs.files.singleFile}"
|
||||
exec.standardOutput = output
|
||||
exec.getCaptureOutput().set(true)
|
||||
doLast {
|
||||
String license = output.toString('UTF-8')
|
||||
String license = getOutput()
|
||||
String expectedLicense
|
||||
expectedLicense = "Elastic License"
|
||||
if (license != expectedLicense) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue