Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sourceSets {
}

group 'net.neoforged.gradleutils'
version '4.0.1'
version '4.1.0'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class VersionCalculator {
final longBranch = head.symbolic ? head?.target?.name : null

String branch = longBranch != null ? Repository.shortenRefName(longBranch) : ''
if (branch in spec.branches.suffixExemptedBranches.get()) {
if (branch in spec.branches.suffixExemptedBranches.get() || spec.branches.suffixExemptedBranchPatterns.getOrNull()?.any { branch ==~ /$it/ }) {
// Branch is exempted from suffix
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ abstract class VersionBranchesSpec {
{
suffixBranch.convention(false)
suffixExemptedBranches.convention(DEFAULT_ALLOWED_BRANCHES).addAll(DEFAULT_ALLOWED_BRANCHES)

suffixExemptedBranchPatterns.convention([])
}

private static final Collection<String> DEFAULT_ALLOWED_BRANCHES = Arrays.asList('', 'main', 'master', 'HEAD')
Expand All @@ -26,9 +28,19 @@ abstract class VersionBranchesSpec {
@DSLProperty
abstract Property<Boolean> getSuffixBranch();

// Branch names which are exempted from being suffixed (see suffixBranch above)
// Empty string means a situation where the branch cannot be named, for some reason (detached HEAD?)
/**
* Branch names which are exempted from being suffixed (see suffixBranch above)
* Empty string means a situation where the branch cannot be named, for some reason (detached HEAD?)
*/
@Input
@DSLProperty
abstract SetProperty<String> getSuffixExemptedBranches()

/**
* Branch name patterns which are exempted from being suffixed (see suffixBranch above)
* Empty string means a situation where the branch cannot be named, for some reason (detached HEAD?)
*/
@Input
@DSLProperty
abstract SetProperty<String> getSuffixExemptedBranchPatterns()
}