Skip to content

Commit 24cb3b7

Browse files
author
TheSnoozer
committed
give configuration options a better name
1 parent aeb86d1 commit 24cb3b7

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public Date getReproducibleBuildOutputTimestamp() throws GitCommitIdExecutionExc
205205

206206
@Override
207207
public boolean useNativeGit() {
208-
return getGitCommitIdPluginGitSettingsExtension().getUseNativeGit().get();
208+
return getGitCommitIdPluginGitSettingsExtension().getShouldUseNativeGit().get();
209209
}
210210

211211
@Override
@@ -235,7 +235,7 @@ public boolean getUseBranchNameFromBuildEnvironment() {
235235

236236
@Override
237237
public boolean isOffline() {
238-
return getGitCommitIdPluginGitSettingsExtension().getOffline().get();
238+
return getGitCommitIdPluginGitSettingsExtension().getShouldStayOffline().get();
239239
}
240240

241241
@Override

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ public abstract class GitCommitIdPluginGitSettingsExtension {
109109
*
110110
* <p>Defaults to {@code true}, so a missing {@code .git} directory may cause a build failure.
111111
*/
112-
public abstract Property<Boolean> getFailOnNoGitDirectory();
112+
public abstract Property<Boolean> getShouldFailOnNoGitDirectory();
113113

114114
/**
115115
* Control whether the plugin should fail the build if it's unable to
116116
* obtain enough data for a complete run (e.g. gather all requested information).
117117
*
118118
* <p>Defaults to {@code true}, so missing data may cause a build failure.
119119
*/
120-
public abstract Property<Boolean> getFailOnUnableToExtractRepoInfo();
120+
public abstract Property<Boolean> getShouldFailOnUnableToExtractRepoInfo();
121121

122122
/**
123123
* This plugin ships with custom {@code jgit} implementation that is being used to obtain all
@@ -133,7 +133,7 @@ public abstract class GitCommitIdPluginGitSettingsExtension {
133133
* <p>To not get your build stuck forever, this plugin also has an option to configure a
134134
* maximum timeout to wait for any native command. Refer to {@link #getNativeGitTimeoutInMs()}.
135135
*/
136-
public abstract Property<Boolean> getUseNativeGit();
136+
public abstract Property<Boolean> getShouldUseNativeGit();
137137

138138

139139
/**
@@ -159,7 +159,7 @@ public abstract class GitCommitIdPluginGitSettingsExtension {
159159
* about the repository with the native Git executable does not terminate.
160160
*
161161
* <p>Note: This option will only be taken into consideration when using the native git
162-
* executable ({@link #getUseNativeGit()} is set to {@code true}).
162+
* executable ({@link #getShouldUseNativeGit()} is set to {@code true}).
163163
*
164164
* <p>By default this timeout is set to 30000 (30 seconds).
165165
*/
@@ -180,8 +180,13 @@ public abstract class GitCommitIdPluginGitSettingsExtension {
180180
* Certainly a {@code git fetch} is an operation that may alter your local git repository
181181
* and thus the plugin will operate not perform such operation (offline is set to {@code true}).
182182
* If you however desire more accurate properties you may want to set this to {@code false}.
183+
*
184+
* <p>When enabled the "up-to-date" checking might not work correctly anymore.
185+
* A git fetch might update the state of the dotGitDir and since this
186+
* is used as input might cause gradle to think that something
187+
* in git has changed that warrants a new execution of the plugin.
183188
*/
184-
public abstract Property<Boolean> getOffline();
189+
public abstract Property<Boolean> getShouldStayOffline();
185190

186191
@Inject
187192
public ProjectLayout getProjectLayout() {
@@ -197,11 +202,11 @@ public GitCommitIdPluginGitSettingsExtension() {
197202
getProjectLayout().getProjectDirectory().dir(".git"));
198203
getGitDescribeConfig().convention(new GitDescribeConfig());
199204
getAbbrevLength().convention(7);
200-
getFailOnNoGitDirectory().convention(true);
201-
getFailOnUnableToExtractRepoInfo().convention(true);
202-
getUseNativeGit().convention(false);
205+
getShouldFailOnNoGitDirectory().convention(true);
206+
getShouldFailOnUnableToExtractRepoInfo().convention(true);
207+
getShouldUseNativeGit().convention(false);
203208
getEvaluateOnCommit().convention("HEAD");
204209
getNativeGitTimeoutInMs().convention(30000L);
205-
getOffline().convention(true);
210+
getShouldStayOffline().convention(true);
206211
}
207212
}

0 commit comments

Comments
 (0)