Skip to content

Commit 396ab1c

Browse files
author
TheSnoozer
committed
move the getUseBranchNameFromBuildEnvironment from GitCommitIdPluginExtension to GitCommitIdPluginGitSettingsExtension
1 parent 0b5fc93 commit 396ab1c

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/main/java/io/github/git/commit/id/gradle/plugin/GitCommitIdPluginExtension.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ public abstract class GitCommitIdPluginExtension {
7171
*/
7272
public abstract Property<Boolean> getSkip();
7373

74-
/**
75-
* When set to {@code true} this plugin will try to use the branch name from build environment.
76-
* Set to {@code false} to use JGit/GIT to get current branch name which can be useful
77-
* when using the JGitflow maven plugin. I'm not sure if there are similar plugins for gradle
78-
* where this needs to set to {@code false}.
79-
*
80-
* <p>By default this is set to {@code true}.
81-
*/
82-
public abstract Property<Boolean> getUseBranchNameFromBuildEnvironment();
83-
8474
/**
8575
* Setup the default values / conventions for the GitCommitIdPluginExtension.
8676
*/
@@ -92,7 +82,6 @@ public GitCommitIdPluginExtension() {
9282
getSkip().convention(false);
9383
// commitIdGenerationMode
9484
// replacementProperties
95-
getUseBranchNameFromBuildEnvironment().convention(true);
9685
// injectIntoSysProperties
9786
// projectBuildOutputTimestamp
9887
}

src/main/java/io/github/git/commit/id/gradle/plugin/GitCommitIdPluginGenerationTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ public CommitIdGenerationMode getCommitIdGenerationMode() {
245245

246246
@Override
247247
public boolean getUseBranchNameFromBuildEnvironment() {
248-
return extension.getUseBranchNameFromBuildEnvironment().get();
248+
return getGitCommitIdPluginGitSettingsExtension()
249+
.getUseBranchNameFromBuildEnvironment().get();
249250
}
250251

251252
@Override

src/main/java/io/github/git/commit/id/gradle/plugin/GitCommitIdPluginGitSettingsExtension.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ public abstract class GitCommitIdPluginGitSettingsExtension {
193193
*/
194194
public abstract Property<Boolean> getShouldStayOffline();
195195

196+
/**
197+
* When set to {@code true} this plugin will try to use the branch name from build environment.
198+
* Set to {@code false} to use JGit/GIT to get current branch name which can be useful
199+
* when using the JGitflow maven plugin. I'm not sure if there are similar plugins for gradle
200+
* where this needs to set to {@code false}.
201+
*
202+
* <p>By default this is set to {@code true}.
203+
*/
204+
public abstract Property<Boolean> getUseBranchNameFromBuildEnvironment();
205+
196206
@Inject
197207
public ProjectLayout getProjectLayout() {
198208
throw new IllegalStateException("Should have been injected!");
@@ -213,5 +223,6 @@ public GitCommitIdPluginGitSettingsExtension() {
213223
getEvaluateOnCommit().convention("HEAD");
214224
getNativeGitTimeoutInMs().convention(30000L);
215225
getShouldStayOffline().convention(true);
226+
getUseBranchNameFromBuildEnvironment().convention(true);
216227
}
217228
}

0 commit comments

Comments
 (0)