-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable gradle configuration cache #151
- Loading branch information
1 parent
a0ce6dc
commit 7ed8752
Showing
9 changed files
with
99 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Gradle | ||
.gradle | ||
.kotlin | ||
build | ||
!gradle/wrapper/gradle-wrapper.jar | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/kotlin/com/coditory/gradle/integration/IntegrationTestPluginConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.coditory.gradle.integration | ||
|
||
import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.INTEGRATION | ||
import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.INTEGRATION_TEST | ||
import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.SKIP_INTEGRATION_TEST_FLAG_NAME | ||
import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.SKIP_TEST_ALL_FLAG_NAME | ||
import com.coditory.gradle.integration.IntegrationTestPlugin.Companion.SKIP_UNIT_TEST_FLAG_NAME | ||
import org.gradle.api.Project | ||
|
||
internal data class IntegrationTestPluginConfig( | ||
val allTestTaskEnabled: Boolean, | ||
val unitTestsEnabled: Boolean, | ||
val integrationTestsEnabled: Boolean, | ||
) { | ||
companion object { | ||
fun resolve(project: Project): IntegrationTestPluginConfig { | ||
return IntegrationTestPluginConfig( | ||
allTestTaskEnabled = !skipAllTests(project), | ||
unitTestsEnabled = !skipUnitTests(project), | ||
integrationTestsEnabled = !skipIntegrationTests(project), | ||
) | ||
} | ||
|
||
private fun skipAllTests(project: Project): Boolean { | ||
return hasTestAllFlag(project) || | ||
(hasSkipUnitTestFlag(project) && hasSkipIntegrationTestFlag(project)) | ||
} | ||
|
||
private fun skipUnitTests(project: Project): Boolean { | ||
return hasTestAllFlag(project) || hasSkipUnitTestFlag(project) | ||
} | ||
|
||
private fun skipIntegrationTests(project: Project): Boolean { | ||
return hasTestAllFlag(project) || hasSkipIntegrationTestFlag(project) | ||
} | ||
|
||
private fun hasTestAllFlag(project: Project): Boolean { | ||
return hasPropertyFlag(project, SKIP_TEST_ALL_FLAG_NAME) | ||
} | ||
|
||
private fun hasSkipUnitTestFlag(project: Project): Boolean { | ||
return hasPropertyFlag(project, SKIP_UNIT_TEST_FLAG_NAME) | ||
} | ||
|
||
private fun hasSkipIntegrationTestFlag(project: Project): Boolean { | ||
return hasPropertyFlag(project, SKIP_INTEGRATION_TEST_FLAG_NAME) || | ||
hasExcludeIntegrationTestTaskParam( | ||
project, | ||
) | ||
} | ||
|
||
private fun hasExcludeIntegrationTestTaskParam(project: Project): Boolean { | ||
return hasExcludedTask(project, INTEGRATION_TEST) || hasExcludedTask(project, INTEGRATION) | ||
} | ||
|
||
private fun hasPropertyFlag(project: Project, name: String): Boolean { | ||
if (project.properties.containsKey(name)) { | ||
val value = project.properties[name] | ||
return value == null || !value.toString().equals("false", true) | ||
} | ||
return false | ||
} | ||
|
||
private fun hasExcludedTask(project: Project, name: String): Boolean { | ||
return project.gradle.startParameter.excludedTaskNames.contains(name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
src/main/kotlin/com/coditory/gradle/integration/TestSkippingConditions.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters