build(coverage): Set up min and max bounds for coverage.

This commit is contained in:
Mateusz Armatys 2023-12-19 17:37:01 +01:00
parent 341feed3c2
commit cde18282f2
75 changed files with 206 additions and 177 deletions

View File

@ -28,8 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(16) branchCoveragePercentage.set(45)
minLineCoveragePercentage.set(50) lineCoveragePercentage.set(79)
} }
protonDagger { protonDagger {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2020 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton Technologies AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(75)
minLineCoveragePercentage.set(50) lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2020 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton Technologies AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(7) branchCoveragePercentage.set(7)
minLineCoveragePercentage.set(23) lineCoveragePercentage.set(23)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,6 +26,11 @@ plugins {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage {
branchCoveragePercentage.set(100)
lineCoveragePercentage.set(96)
}
android { android {
namespace = "me.proton.core.accountrecovery.data" namespace = "me.proton.core.accountrecovery.data"
} }

View File

@ -27,7 +27,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(77) branchCoveragePercentage.set(78)
lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(50)
minLineCoveragePercentage.set(77) lineCoveragePercentage.set(77)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,7 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(64) branchCoveragePercentage.set(64)
lineCoveragePercentage.set(91)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(50)
minLineCoveragePercentage.set(49) lineCoveragePercentage.set(49)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(60) branchCoveragePercentage.set(60)
minLineCoveragePercentage.set(84) lineCoveragePercentage.set(84)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -31,8 +31,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(45) branchCoveragePercentage.set(45)
minLineCoveragePercentage.set(61) lineCoveragePercentage.set(61)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -24,8 +24,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(1) branchCoveragePercentage.set(3)
minLineCoveragePercentage.set(16) lineCoveragePercentage.set(31)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -23,7 +23,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(66) branchCoveragePercentage.set(80)
lineCoveragePercentage.set(94)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(17) branchCoveragePercentage.set(17)
minLineCoveragePercentage.set(38) lineCoveragePercentage.set(38)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -1,7 +1,5 @@
import studio.forface.easygradle.dsl.*
/* /*
* Copyright (c) 2022 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
@ -18,6 +16,8 @@ import studio.forface.easygradle.dsl.*
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>. * along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/ */
import studio.forface.easygradle.dsl.*
plugins { plugins {
protonAndroidLibrary protonAndroidLibrary
protonDagger protonDagger
@ -30,8 +30,8 @@ android {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(55) branchCoveragePercentage.set(56)
minLineCoveragePercentage.set(74) lineCoveragePercentage.set(74)
} }
dependencies { dependencies {

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(8) branchCoveragePercentage.set(10)
minLineCoveragePercentage.set(27) lineCoveragePercentage.set(27)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2020 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton Technologies AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,8 +23,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(0) branchCoveragePercentage.set(39)
minLineCoveragePercentage.set(4) lineCoveragePercentage.set(38)
} }
protonBuild { protonBuild {

View File

@ -28,7 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(66)
lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,7 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(50)
lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(6) branchCoveragePercentage.set(6)
minLineCoveragePercentage.set(16) lineCoveragePercentage.set(60)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -1,3 +1,21 @@
/*
* Copyright (c) 2023 Proton AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
plugins { plugins {
id("me.proton.core.gradle-plugins.global-coverage") id("me.proton.core.gradle-plugins.global-coverage")
} }
@ -6,6 +24,6 @@ publishOption.shouldBePublishedAsLib = false
// Global minimum coverage percentage. // Global minimum coverage percentage.
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(27) branchCoveragePercentage.set(33)
minLineCoveragePercentage.set(48) lineCoveragePercentage.set(59)
} }

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(40) branchCoveragePercentage.set(50)
minLineCoveragePercentage.set(50) lineCoveragePercentage.set(78)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -28,8 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(8) branchCoveragePercentage.set(8)
minLineCoveragePercentage.set(11) lineCoveragePercentage.set(11)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(8) branchCoveragePercentage.set(8)
minLineCoveragePercentage.set(2) lineCoveragePercentage.set(2)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(20) branchCoveragePercentage.set(22)
minLineCoveragePercentage.set(13) lineCoveragePercentage.set(13)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,6 +26,11 @@ protonBuild {
apiModeDisabled() apiModeDisabled()
} }
protonCoverage {
branchCoveragePercentage.set(95)
lineCoveragePercentage.set(100)
}
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
android { android {

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(15) branchCoveragePercentage.set(15)
minLineCoveragePercentage.set(21) lineCoveragePercentage.set(21)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(59) branchCoveragePercentage.set(59)
minLineCoveragePercentage.set(77) lineCoveragePercentage.set(78)
} }
protonDagger { protonDagger {

View File

@ -30,8 +30,8 @@ protonBuild {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(53) branchCoveragePercentage.set(53)
minLineCoveragePercentage.set(80) lineCoveragePercentage.set(81)
} }
dependencies { dependencies {

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(44) branchCoveragePercentage.set(46)
minLineCoveragePercentage.set(79) lineCoveragePercentage.set(81)
} }
protonDagger { protonDagger {

View File

@ -29,7 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(76) branchCoveragePercentage.set(76)
lineCoveragePercentage.set(96)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,7 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minLineCoveragePercentage.set(40) lineCoveragePercentage.set(40)
branchCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -31,8 +31,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(75) branchCoveragePercentage.set(75)
minLineCoveragePercentage.set(83) lineCoveragePercentage.set(83)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(5) branchCoveragePercentage.set(6)
minLineCoveragePercentage.set(5) lineCoveragePercentage.set(5)
} }
protonDagger { protonDagger {

View File

@ -28,8 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(61) branchCoveragePercentage.set(68)
minLineCoveragePercentage.set(85) lineCoveragePercentage.set(85)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(58) branchCoveragePercentage.set(58)
minLineCoveragePercentage.set(90) lineCoveragePercentage.set(90)
} }
android { android {

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(47) branchCoveragePercentage.set(47)
minLineCoveragePercentage.set(59) lineCoveragePercentage.set(59)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(5) branchCoveragePercentage.set(6)
minLineCoveragePercentage.set(13) lineCoveragePercentage.set(13)
} }
protonDagger { protonDagger {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2020 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton Technologies AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(25) branchCoveragePercentage.set(50)
minLineCoveragePercentage.set(50) lineCoveragePercentage.set(84)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(31) branchCoveragePercentage.set(48)
minLineCoveragePercentage.set(81) lineCoveragePercentage.set(81)
} }
protonDagger { protonDagger {

View File

@ -26,7 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(42) branchCoveragePercentage.set(42)
lineCoveragePercentage.set(92)
} }
protonDagger { protonDagger {

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(53) branchCoveragePercentage.set(56)
minLineCoveragePercentage.set(76) lineCoveragePercentage.set(80)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(36) branchCoveragePercentage.set(38)
minLineCoveragePercentage.set(36) lineCoveragePercentage.set(37)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(50) branchCoveragePercentage.set(100)
minLineCoveragePercentage.set(46) lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ plugins {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(61) branchCoveragePercentage.set(61)
minLineCoveragePercentage.set(90) lineCoveragePercentage.set(96)
} }
android { android {

View File

@ -30,7 +30,8 @@ plugins {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage { protonCoverage {
minLineCoveragePercentage.set(88) branchCoveragePercentage.set(92)
lineCoveragePercentage.set(91)
} }
dependencies { dependencies {

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(80) branchCoveragePercentage.set(84)
minLineCoveragePercentage.set(80) lineCoveragePercentage.set(81)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -25,7 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(83) branchCoveragePercentage.set(88)
lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(55) branchCoveragePercentage.set(55)
minLineCoveragePercentage.set(49) lineCoveragePercentage.set(49)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -24,8 +24,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(89) branchCoveragePercentage.set(89)
minLineCoveragePercentage.set(100) lineCoveragePercentage.set(100)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(58) branchCoveragePercentage.set(59)
minLineCoveragePercentage.set(70) lineCoveragePercentage.set(73)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -24,8 +24,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(54) branchCoveragePercentage.set(54)
minLineCoveragePercentage.set(70) lineCoveragePercentage.set(70)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -24,8 +24,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(80) branchCoveragePercentage.set(80)
minLineCoveragePercentage.set(65) lineCoveragePercentage.set(67)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -26,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(37) branchCoveragePercentage.set(38)
minLineCoveragePercentage.set(66) lineCoveragePercentage.set(66)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -28,8 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(74) branchCoveragePercentage.set(74)
minLineCoveragePercentage.set(79) lineCoveragePercentage.set(82)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(56) branchCoveragePercentage.set(56)
minLineCoveragePercentage.set(76) lineCoveragePercentage.set(77)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(47) branchCoveragePercentage.set(47)
minLineCoveragePercentage.set(52) lineCoveragePercentage.set(52)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -57,15 +57,15 @@ public interface ProtonCoverageExtension {
*/ */
public val excludes: ListProperty<KoverReportFilter.() -> Unit> public val excludes: ListProperty<KoverReportFilter.() -> Unit>
/** The minimum branch coverage percentage (0-100) that the project must meet. /** The branch coverage percentage (0-100) that the project must meet (+/- 1%).
* Use only if you want to override a default value. * Use only if you want to override a default value.
*/ */
public val minBranchCoveragePercentage: Property<Int> public val branchCoveragePercentage: Property<Int>
/** The minimum line coverage percentage (0-100) that the project must meet. /** The line coverage percentage (0-100) that the project must meet (+/- 1%).
* Use only if you want to override a default value. * Use only if you want to override a default value.
*/ */
public val minLineCoveragePercentage: Property<Int> public val lineCoveragePercentage: Property<Int>
/** Explicitly enable Common rules. By default, they are enabled. */ /** Explicitly enable Common rules. By default, they are enabled. */
public val enableCommonRules: Property<Boolean> public val enableCommonRules: Property<Boolean>
@ -88,16 +88,16 @@ internal fun ProtonCoverageExtension.applyConventionsFrom(other: ProtonCoverageE
other.enableKotlinSerializationRules.orNull?.let { enableKotlinSerializationRules.convention(it) } other.enableKotlinSerializationRules.orNull?.let { enableKotlinSerializationRules.convention(it) }
other.enableRoomDbRules.orNull?.let { enableRoomDbRules.convention(it) } other.enableRoomDbRules.orNull?.let { enableRoomDbRules.convention(it) }
other.excludes.orNull?.let { excludes.convention(it) } other.excludes.orNull?.let { excludes.convention(it) }
other.minBranchCoveragePercentage.orNull?.let { minBranchCoveragePercentage.convention(it) } other.branchCoveragePercentage.orNull?.let { branchCoveragePercentage.convention(it) }
other.minLineCoveragePercentage.orNull?.let { minLineCoveragePercentage.convention(it) } other.lineCoveragePercentage.orNull?.let { lineCoveragePercentage.convention(it) }
other.enableCommonRules.orNull?.let { enableCommonRules.convention(it) } other.enableCommonRules.orNull?.let { enableCommonRules.convention(it) }
} }
internal fun ProtonCoverageExtension.applyGeneralConventions() { internal fun ProtonCoverageExtension.applyGeneralConventions() {
disabled.convention(false) disabled.convention(false)
excludes.convention(emptyList()) excludes.convention(emptyList())
minBranchCoveragePercentage.convention(DEFAULT_MIN_BRANCH_PERCENTAGE_COVERAGE) branchCoveragePercentage.convention(DEFAULT_MIN_BRANCH_PERCENTAGE_COVERAGE)
minLineCoveragePercentage.convention(DEFAULT_MIN_LINE_PERCENTAGE_COVERAGE) lineCoveragePercentage.convention(DEFAULT_MIN_LINE_PERCENTAGE_COVERAGE)
} }
internal fun ProtonCoverageExtension.finalizeValuesOnRead() { internal fun ProtonCoverageExtension.finalizeValuesOnRead() {
@ -110,6 +110,6 @@ internal fun ProtonCoverageExtension.finalizeValuesOnRead() {
enableKotlinSerializationRules.finalizeValueOnRead() enableKotlinSerializationRules.finalizeValueOnRead()
enableRoomDbRules.finalizeValueOnRead() enableRoomDbRules.finalizeValueOnRead()
excludes.finalizeValueOnRead() excludes.finalizeValueOnRead()
minBranchCoveragePercentage.finalizeValueOnRead() branchCoveragePercentage.finalizeValueOnRead()
minLineCoveragePercentage.finalizeValueOnRead() lineCoveragePercentage.finalizeValueOnRead()
} }

View File

@ -199,16 +199,23 @@ public class ProtonCoveragePlugin : Plugin<Project> {
} }
private fun KoverVerifyReportConfig.applyVerificationConfig(ext: ProtonCoverageExtension) { private fun KoverVerifyReportConfig.applyVerificationConfig(ext: ProtonCoverageExtension) {
rule("minBranchCoveragePercentage") { // Set up the requirement:
minBound( // Min coverage percentage must be equal to max coverage (+/- 1).
ext.minBranchCoveragePercentage.get(), // As a result, the build will fail, if the coverage changes.
// This will give us a chance to update the coverage value in build files.
rule("branchCoveragePercentage") {
bound(
minValue = ext.branchCoveragePercentage.get() - 1,
maxValue = ext.branchCoveragePercentage.get() + 1,
MetricType.BRANCH, MetricType.BRANCH,
AggregationType.COVERED_PERCENTAGE AggregationType.COVERED_PERCENTAGE
) )
} }
rule("minLineCoveragePercentage") { rule("lineCoveragePercentage") {
minBound( bound(
ext.minLineCoveragePercentage.get(), minValue = ext.lineCoveragePercentage.get() - 1,
maxValue = ext.lineCoveragePercentage.get() + 1,
MetricType.LINE, MetricType.LINE,
AggregationType.COVERED_PERCENTAGE AggregationType.COVERED_PERCENTAGE
) )

View File

@ -31,8 +31,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(26) branchCoveragePercentage.set(35)
minLineCoveragePercentage.set(27) lineCoveragePercentage.set(32)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -19,24 +19,6 @@
import studio.forface.easygradle.dsl.* import studio.forface.easygradle.dsl.*
import studio.forface.easygradle.dsl.android.* import studio.forface.easygradle.dsl.android.*
/*
* Copyright (c) 2021 Proton Technologies AG
* This file is part of Proton Technologies AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
plugins { plugins {
protonAndroidLibrary protonAndroidLibrary
protonDagger protonDagger
@ -44,8 +26,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(51) branchCoveragePercentage.set(56)
minLineCoveragePercentage.set(67) lineCoveragePercentage.set(67)
} }
protonDagger { protonDagger {

View File

@ -25,7 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(71) branchCoveragePercentage.set(76)
lineCoveragePercentage.set(91)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -24,8 +24,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(62) branchCoveragePercentage.set(62)
minLineCoveragePercentage.set(57) lineCoveragePercentage.set(57)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,8 +27,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(31) branchCoveragePercentage.set(42)
minLineCoveragePercentage.set(34) lineCoveragePercentage.set(65)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -25,7 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(83) branchCoveragePercentage.set(86)
lineCoveragePercentage.set(94)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(56) branchCoveragePercentage.set(87)
minLineCoveragePercentage.set(43) lineCoveragePercentage.set(87)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -25,8 +25,8 @@ plugins {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(12) branchCoveragePercentage.set(17)
minLineCoveragePercentage.set(45) lineCoveragePercentage.set(50)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(33) branchCoveragePercentage.set(52)
minLineCoveragePercentage.set(71) lineCoveragePercentage.set(78)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -27,8 +27,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(22) branchCoveragePercentage.set(32)
minLineCoveragePercentage.set(60) lineCoveragePercentage.set(67)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(15) branchCoveragePercentage.set(28)
minLineCoveragePercentage.set(24) lineCoveragePercentage.set(52)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -30,8 +30,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(23) branchCoveragePercentage.set(23)
minLineCoveragePercentage.set(18) lineCoveragePercentage.set(18)
} }
android { android {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2020 Proton Technologies AG * Copyright (c) 2023 Proton AG
* This file is part of Proton Technologies AG and ProtonCore. * This file is part of Proton AG and ProtonCore.
* *
* ProtonCore is free software: you can redistribute it and/or modify * ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,8 +29,8 @@ protonBuild {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(78) branchCoveragePercentage.set(78)
minLineCoveragePercentage.set(31) lineCoveragePercentage.set(32)
} }
dependencies { dependencies {

View File

@ -26,8 +26,8 @@ plugins {
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(35) branchCoveragePercentage.set(43)
minLineCoveragePercentage.set(37) lineCoveragePercentage.set(64)
} }
android { android {

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(37) branchCoveragePercentage.set(75)
minLineCoveragePercentage.set(67) lineCoveragePercentage.set(67)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -29,8 +29,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(25) branchCoveragePercentage.set(25)
minLineCoveragePercentage.set(6) lineCoveragePercentage.set(8)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true

View File

@ -28,8 +28,8 @@ protonBuild {
} }
protonCoverage { protonCoverage {
minBranchCoveragePercentage.set(24) branchCoveragePercentage.set(26)
minLineCoveragePercentage.set(30) lineCoveragePercentage.set(37)
} }
publishOption.shouldBePublishedAsLib = true publishOption.shouldBePublishedAsLib = true