Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<dirty> marker always showing up and never replaced #30

Open
jpschewe opened this issue Oct 27, 2023 · 0 comments
Open

<dirty> marker always showing up and never replaced #30

jpschewe opened this issue Oct 27, 2023 · 0 comments

Comments

@jpschewe
Copy link

Using gradle 7.5.1 and git 2.34.1 on Linux

Build file:

// -*- java -*-

buildscript {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
}    

plugins {
    id "java"
    id "distribution"
    
    // needs to use old plugin mechanism otherwise I can't set the extra properties   
    // https://github.com/Nasdaq/semver-git
    // execute showVersion task to see what the version will be   
    id "com.cinnober.gradle.semver-git" version "2.3.1" apply false
}

//foo
// needs to use old plugin mechanism otherwise I can't set nextVersion and snapshotSuffix
//ext.nextVersion = "patch" // "major", "minor" (default), "patch" or e.g. "3.0.0-rc2"
ext.dirtyMarker = "-dirty" // (default) replaces <dirty> in snapshotSuffix
ext.snapshotSuffix = "beta.<count>+g<sha><dirty>" // "SNAPSHOT" (default) or a pattern, e.g. "<count>.g<sha><dirty>-SNAPSHOT"
// optionally: ext.gitDescribeArgs = '--match *[0-9].[0-9]*.[0-9]*' (default) or other arguments for git describe.

// must be after the ext.* variables are set
apply plugin: "com.cinnober.gradle.semver-git"

repositories {
    mavenCentral()
}

group = "test"
>git --no-pager status
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   build.gradle

no changes added to commit (use "git add" and/or "git commit -a")

>./gradlew showVersion

> Task :showVersion
Version: 0.1.0-beta.1+g4d4a7d7<dirty>

BUILD SUCCESSFUL in 413ms
1 actionable task: 1 executed


 >git --no-pager status
On branch main
nothing to commit, working tree clean

>./gradlew showVersion

> Task :showVersion
Version: 0.1.0-beta.2+g6fd2f4b<dirty>

BUILD SUCCESSFUL in 445ms
1 actionable task: 1 executed

I expected the first execution to replace "" with "-dirty".
The second execution should not have "" in it at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant