diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index 01d91b3..d7197d7 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -5,6 +5,7 @@ jobs: gradle: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: # 8.11 = oldest supported version # wrapper = supposed to be the oldest supported version but actually runs current diff --git a/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphInputTask.kt b/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphInputTask.kt index 0f49fb2..2d8d3c2 100644 --- a/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphInputTask.kt +++ b/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphInputTask.kt @@ -1,6 +1,7 @@ package com.ebay.plugins.graph.analytics import org.gradle.api.file.RegularFileProperty +import org.gradle.api.tasks.CacheableTask import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity @@ -11,6 +12,7 @@ import org.jgrapht.graph.DefaultDirectedGraph * Base class which can be used by tasks which need to read the graph file as * an input (only). */ +@CacheableTask abstract class BaseGraphInputTask : BaseGraphPersistenceTask() { /** * The graph input to analyze. diff --git a/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphPersistenceTask.kt b/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphPersistenceTask.kt index 2de5151..8c255cc 100644 --- a/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphPersistenceTask.kt +++ b/src/main/kotlin/com/ebay/plugins/graph/analytics/BaseGraphPersistenceTask.kt @@ -2,12 +2,14 @@ package com.ebay.plugins.graph.analytics import org.gradle.api.DefaultTask import org.gradle.api.provider.Property +import org.gradle.api.tasks.CacheableTask import org.gradle.api.tasks.Input import org.gradle.api.tasks.Internal /** * Base class used for tasks which need to read and write the graph file. */ +@CacheableTask abstract class BaseGraphPersistenceTask : DefaultTask() { // Pass the graph format in so that version changes invalidate the cache @get:Input diff --git a/src/main/kotlin/com/ebay/plugins/graph/analytics/DirectComparisonTask.kt b/src/main/kotlin/com/ebay/plugins/graph/analytics/DirectComparisonTask.kt index 283a73c..4f741a8 100644 --- a/src/main/kotlin/com/ebay/plugins/graph/analytics/DirectComparisonTask.kt +++ b/src/main/kotlin/com/ebay/plugins/graph/analytics/DirectComparisonTask.kt @@ -8,6 +8,8 @@ import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.options.Option import org.gradle.work.DisableCachingByDefault @@ -23,6 +25,7 @@ internal abstract class DirectComparisonTask : BaseGraphPersistenceTask() { internal abstract val projectLayout: ProjectLayout @get:InputFile + @get:PathSensitive(PathSensitivity.NONE) internal abstract val defaultAnalysisFile: RegularFileProperty /** diff --git a/src/main/kotlin/com/ebay/plugins/graph/analytics/GraphAnalyticsPlugin.kt b/src/main/kotlin/com/ebay/plugins/graph/analytics/GraphAnalyticsPlugin.kt index 920a57b..abaef55 100644 --- a/src/main/kotlin/com/ebay/plugins/graph/analytics/GraphAnalyticsPlugin.kt +++ b/src/main/kotlin/com/ebay/plugins/graph/analytics/GraphAnalyticsPlugin.kt @@ -231,8 +231,6 @@ internal class GraphAnalyticsPlugin : Plugin { val classifier = graphExtension.configurationClassifier.convention(ConfigurationClassifierDefault()).get() project.configurations.configureEach { config -> val configClass = classifier.classify(config) - if (configClass == ConfigurationClass.OTHER) return@configureEach - val (dependenciesConfig, taskProvider) = when(configClass) { ConfigurationClass.PRODUCTION -> { Pair(prodDependencies, gatherProdDependenciesTaskProvider) @@ -240,9 +238,9 @@ internal class GraphAnalyticsPlugin : Plugin { ConfigurationClass.TEST -> { Pair(testDependencies, gatherTestDependenciesTaskProvider) } - else -> { - // Should never happen - throw(GradleException("Unsupported config class: $configClass")) + ConfigurationClass.OTHER -> { + // We only care about prod and test dependencies + return@configureEach } }