diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2024-09-11 17:21:38 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-12 20:02:54 +0000 |
commit | d81011029f01e49072fb5ac2108668b6a5815a12 (patch) | |
tree | 9777b4701d0d9e94c5da1ee929e05d01facae85d /sonar-application | |
parent | 8ccdb482516b9f096c4cf2a858663915850d02f9 (diff) | |
download | sonarqube-d81011029f01e49072fb5ac2108668b6a5815a12.tar.gz sonarqube-d81011029f01e49072fb5ac2108668b6a5815a12.zip |
NO-JIRA Simplify the handling of sonar-application min/max archive size
Diffstat (limited to 'sonar-application')
-rw-r--r-- | sonar-application/build.gradle | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index ee484a67c46..a217fd7aab3 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -339,14 +339,20 @@ task zip(type: Zip, dependsOn: [configurations.compileClasspath]) { zip { mustRunAfter cyclonedxBom doLast { - def minLength = 342000000 - def maxLength = 750000000 - - def length = archiveFile.get().asFile.length() - if (length < minLength) - throw new GradleException("${archiveFileName.get()} size ($length) too small. Min is $minLength") - if (length > maxLength) - throw new GradleException("${destinationDirectory.get()}/${archiveFileName.get()} size ($length) too large. Max is $maxLength") + //When the archive size increases due to dependencies, the expected size should be updated as well. + //Bump the expected size by at least 10 more megabytes than what is strictly needed, this in conjunction with the + //tolerance will allow for some growth in the archive size. + def expectedSize = 760000000 + //We set a tolerance of 15MB to avoid failing the build for small differences in the archive size. + def tolerance = 15000000 + def minArchiveSize = expectedSize - tolerance + def maxArchiveSize = expectedSize + tolerance + + def archiveSize = archiveFile.get().asFile.length() + if (archiveSize < minArchiveSize) + throw new GradleException("${archiveFileName.get()} size ($archiveSize) too small. Min is $minArchiveSize") + if (archiveSize > maxArchiveSize) + throw new GradleException("${destinationDirectory.get()}/${archiveFileName.get()} size ($archiveSize) too large. Max is $maxArchiveSize") } } assemble.dependsOn zip |