Skip to content

Commit

Permalink
πŸ› avoid adding /**/ mask to Gradle dependencies key
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Aug 11, 2020
1 parent d5f863c commit 6d3e893
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.github.burrunan.gradle.cache

import actions.core.debug
import com.github.burrunan.gradle.github.env.ActionsEnvironment
import com.github.burrunan.gradle.github.event.ActionsTrigger
import com.github.burrunan.gradle.github.event.cacheKey
import com.github.burrunan.gradle.github.suspendingStateVariable
import com.github.burrunan.gradle.hashFiles
import actions.core.debug

/**
* Populate cache only when building a default branch, otherwise treat the cache as read-only.
Expand Down Expand Up @@ -70,10 +70,13 @@ suspend fun gradleDependenciesCache(trigger: ActionsTrigger, path: String, gradl
// We do not want .gradle folder, so we want to have at least one character before .gradle
"$path/**/?*.gradle",
"$path/**/*.properties",
) + gradleDependenciesCacheKey.split(Regex("[\r\n]+")).map {
(if (it.startsWith("!")) "!" else "") +
"$path/**/" + it.trim().trimStart('!')
},
) + gradleDependenciesCacheKey.split(Regex("[\r\n]+"))
.map { it.trim() }
.filterNot { it.isEmpty() }
.map {
(if (it.startsWith("!")) "!" else "") +
"$path/**/" + it.trim().trimStart('!')
},
)

suspend fun mavenDependenciesCache(trigger: ActionsTrigger, path: String): Cache =
Expand Down

0 comments on commit 6d3e893

Please sign in to comment.