@@ -69,49 +69,6 @@ public abstract class GitCommitIdPluginExtension {
6969 */
7070 public abstract Property <Boolean > getVerbose ();
7171
72- /**
73- * The information on what git revision your project is built with must come from the
74- * git itself.
75- * If you'd like to tell the plugin where your {@code .git} directory is, use this setting,
76- * by default this plugin assumes {@code getProjectDirectory()/.git}.
77- */
78- // @InputDirectory
79- public abstract DirectoryProperty getDotGitDirectory ();
80-
81- /**
82- * The following {@code gitDescribeConfig} below is optional and can be leveraged as a
83- * really powerful versioning helper. If you are not familiar with
84- * <a href="https://git-scm.com/docs/git-describe">git-describe</a>
85- * it is highly recommended to go through this part of the documentation. More advanced
86- * users can most likely skip the explanations in this section, as it just explains the
87- * same options that git provides.
88- * In summary {@code gitDescribe} can translate your current branch
89- * into a human-readable name like {@code v1.0.4-14-g2414721}
90- * that represents all relevant version information.
91- *
92- * <p>Refer to {@link GitDescribeConfig} for options that can be passed towards git-describe.
93- * The result of this configuration is exposed as
94- * {@link #getPropertyPrefix()}{@code .commit.id.describe}.
95- */
96- public abstract Property <GitDescribeConfig > getGitDescribeConfig ();
97-
98- /**
99- * By default git uses 40 character long SHA-1 hashes to represent commit hashes.
100- * In most cases it is however already sufficient to display only a few characters
101- * at the front of this commit hash to get an unique enough identifier of the commit hash.
102- * By default git chooses the first 7 characters of the hash, which is then called abbreviation.
103- *
104- * <p>The plugin therefore sets the abbreviation to {@code 7} by default.
105- * Please note that larger projects might want to increase this to eight to ten characters
106- * to avoid a collision (e.g. an abbreviated hash would not be unique anymore and could
107- * point to two different commits in the database).
108- *
109- * <p>Refer to <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection">Git Tools - Revision Selection</a>
110- * for more details.
111- *
112- */
113- public abstract Property <Integer > getAbbrevLength ();
114-
11572 /**
11673 * This configuration allows you to configure the "prefix" of the generated properties and thus
11774 * will be used as the "namespace" prefix for all exposed/generated properties.
@@ -148,40 +105,6 @@ public abstract class GitCommitIdPluginExtension {
148105 */
149106 public abstract Property <String > getExportDateFormatTimeZone ();
150107
151- /**
152- * Control whether the plugin should fail when a .git directory cannot be found.
153- * The directory can be configured by {@link #getDotGitDirectory()}.
154- * When set to {@code false} and no {@code .git} directory is found the plugin
155- * will skip execution.
156- *
157- * <p>Defaults to {@code true}, so a missing {@code .git} directory may cause a build failure.
158- */
159- public abstract Property <Boolean > getFailOnNoGitDirectory ();
160-
161- /**
162- * Control whether the plugin should fail the build if it's unable to
163- * obtain enough data for a complete run (e.g. gather all requested information).
164- *
165- * <p>Defaults to {@code true}, so missing data may cause a build failure.
166- */
167- public abstract Property <Boolean > getFailOnUnableToExtractRepoInfo ();
168-
169- /**
170- * This plugin ships with custom {@code jgit} implementation that is being used to obtain all
171- * relevant information. If set to {@code true} this plugin will use the
172- * native {@code git} binary instead of the custom {@code jgit} implementation.
173- *
174- * <p>Although this should usually give your build some performance boost, it may randomly
175- * break if you upgrade your git version if it decides to print information in a different
176- * format suddenly. As rule of thumb, keep using the default {@code jgit} implementation (keep
177- * this {@code false}) until you notice performance problems within your build (usually when you
178- * have *hundreds* of gradle projects).
179- *
180- * <p>To not get your build stuck forever, this plugin also has an option to configure a
181- * maximum timeout to wait for any native command. Refer to {@link #getNativeGitTimeoutInMs()}.
182- */
183- public abstract Property <Boolean > getUseNativeGit ();
184-
185108 /**
186109 * Allows to configure to skip the execution of the {@link GitCommitIdPluginGenerationTask}
187110 * that will generate the information you have requested from this plugin.
@@ -231,35 +154,6 @@ public abstract class GitCommitIdPluginExtension {
231154 */
232155 public abstract ListProperty <String > getIncludeOnlyProperties ();
233156
234- /**
235- * Allow to tell the plugin what commit should be used as reference to
236- * generate the properties from.
237- *
238- * <p>In general this property can be set to something generic like {@code HEAD^1} or point to a
239- * branch or tag-name. To support any kind or use-case this configuration can also be set
240- * to an entire commit-hash or it's abbreviated version.
241- *
242- * <p>A use-case for this feature can be found in
243- * <a href="https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/338">here</a>.
244- *
245- * <p>Please note that for security purposes not all references might
246- * be allowed as configuration. If you have a specific use-case that is currently
247- * not white listed feel free to file an issue.
248- */
249- public abstract Property <String > getEvaluateOnCommit ();
250-
251- /**
252- * Allow to specify a timeout (in milliseconds) for fetching information with the native
253- * Git executable. This option might come in handy in cases where fetching information
254- * about the repository with the native Git executable does not terminate.
255- *
256- * <p>Note: This option will only be taken into consideration when using the native git
257- * executable ({@link #getUseNativeGit()} is set to {@code true}).
258- *
259- * <p>By default this timeout is set to 30000 (30 seconds).
260- */
261- public abstract Property <Long > getNativeGitTimeoutInMs ();
262-
263157 /**
264158 * When set to {@code true} this plugin will try to use the branch name from build environment.
265159 * Set to {@code false} to use JGit/GIT to get current branch name which can be useful
@@ -270,29 +164,6 @@ public abstract class GitCommitIdPluginExtension {
270164 */
271165 public abstract Property <Boolean > getUseBranchNameFromBuildEnvironment ();
272166
273- /**
274- * The plugin can generate certain properties that represents the count of commits
275- * that your local branch is ahead or behind in perspective to the remote branch.
276- *
277- * <p>When your branch is "ahead" it means your local branch has committed changes that are not
278- * pushed yet to the remote branch.
279- * When your branch is "behind" it means there are commits in the remote branch that are not yet
280- * integrated into your local branch.
281- *
282- * <p>This configuration allows you to control if the plugin should somewhat ensure
283- * that such properties are more accurate. More accurate means that the plugin will perform a
284- * {@code git fetch} before the properties are calculated.
285- * Certainly a {@code git fetch} is an operation that may alter your local git repository
286- * and thus the plugin will operate not perform such operation (offline is set to {@code true}).
287- * If you however desire more accurate properties you may want to set this to {@code false}.
288- */
289- public abstract Property <Boolean > getOffline ();
290-
291- @ Inject
292- public ProjectLayout getProjectLayout () {
293- throw new IllegalStateException ("Should have been injected!" );
294- }
295-
296167 /**
297168 * Setup the default values / conventions for the GitCommitIdPluginExtension.
298169 */
@@ -301,27 +172,16 @@ public GitCommitIdPluginExtension() {
301172 // injectAllReactorProjects
302173 getVerbose ().convention (false );
303174 // skipPoms
304- getDotGitDirectory ().convention (
305- getProjectLayout ().getProjectDirectory ().dir (".git" ));
306- getGitDescribeConfig ().convention (new GitDescribeConfig ());
307- getAbbrevLength ().convention (7 );
308175 getPropertyPrefix ().convention ("git" );
309176 getExportDateFormat ().convention ("yyyy-MM-dd'T'HH:mm:ssZ" );
310177 getExportDateFormatTimeZone ().convention (TimeZone .getDefault ().getID ());
311- getFailOnNoGitDirectory ().convention (true );
312- getFailOnUnableToExtractRepoInfo ().convention (true );
313- getUseNativeGit ().convention (false );
314178 getSkip ().convention (false );
315-
316179 getExcludeProperties ().convention (Collections .emptyList ());
317180 getIncludeOnlyProperties ().convention (Collections .emptyList ());
318181 // commitIdGenerationMode
319182 // replacementProperties
320- getEvaluateOnCommit ().convention ("HEAD" );
321- getNativeGitTimeoutInMs ().convention (30000L );
322183 getUseBranchNameFromBuildEnvironment ().convention (true );
323184 // injectIntoSysProperties
324- getOffline ().convention (true );
325185 // projectBuildOutputTimestamp
326186 }
327187}
0 commit comments