Skip to content

Commit e12f6b2

Browse files
author
TheSnoozer
committed
drop the name 'properties' from the configruation options, since we can generate a json output file, a yml, xml, ....just avoids confusion
1 parent 2b4f054 commit e12f6b2

2 files changed

Lines changed: 27 additions & 25 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public DirectoryProperty getInput() {
9191
*/
9292
@OutputFile
9393
public RegularFileProperty getOutput() {
94-
return getGitCommitIdPluginOutputSettingsExtension().getGenerateGitPropertiesFilename();
94+
return getGitCommitIdPluginOutputSettingsExtension().getOutputFile();
9595
}
9696

9797
/**
@@ -240,7 +240,7 @@ public File getDotGitDirectory() {
240240
@Override
241241
public boolean shouldGenerateGitPropertiesFile() {
242242
return getGitCommitIdPluginOutputSettingsExtension()
243-
.getGenerateGitPropertiesFile().get();
243+
.getShouldGenerateOutputFile().get();
244244
}
245245

246246
@Override
@@ -256,7 +256,7 @@ public void performPropertiesReplacement(Properties properties) {
256256
@Override
257257
public CommitIdPropertiesOutputFormat getPropertiesOutputFormat() {
258258
return getGitCommitIdPluginOutputSettingsExtension()
259-
.getGenerateGitPropertiesFormat()
259+
.getOutputFormat()
260260
.get();
261261
}
262262

@@ -280,7 +280,7 @@ public File getProjectBaseDir() {
280280
@Override
281281
public File getGenerateGitPropertiesFile() {
282282
return getGitCommitIdPluginOutputSettingsExtension()
283-
.getGenerateGitPropertiesFilename()
283+
.getOutputFile()
284284
.get().getAsFile();
285285
}
286286

@@ -300,7 +300,7 @@ public Charset getPropertiesSourceCharset() {
300300
@Override
301301
public boolean shouldPropertiesEscapeUnicode() {
302302
return getGitCommitIdPluginOutputSettingsExtension()
303-
.getGenerateGitPropertiesFileWithEscapedUnicode().get();
303+
.getShouldEscapedUnicodeForPropertiesOutput().get();
304304
}
305305
};
306306

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,26 @@
4545
public abstract class GitCommitIdPluginOutputSettingsExtension {
4646

4747
/**
48-
* Configuration option to enable or disable the generation of a properties file.
48+
* Configuration option to enable or disable the generation of an output file.
4949
* To enable such generation, set this to {@code true}.
5050
* By default, this setting is disabled (set to {@code false}).
5151
*
52-
* <p>To configure the location of the properties file refer to
53-
* {@link #getGenerateGitPropertiesFilename()}, to configure the format (json, properties, ...)
54-
* of this file refer to {@link #getGenerateGitPropertiesFormat()}.
52+
* <p>To configure the location of the output file refer to
53+
* {@link #getOutputFile()}, to configure the format (json, properties, ...)
54+
* of this file refer to {@link #getOutputFormat()}.
5555
*/
56-
public abstract Property<Boolean> getGenerateGitPropertiesFile();
56+
public abstract Property<Boolean> getShouldGenerateOutputFile();
5757

5858
/**
59-
* Configuration location of a properties file that can be generated by the plugin.
60-
* Defaults to {@code ${project.getBuildDir()}/git.properties}.
59+
* Configuration location of an output file that can be generated by the plugin.
60+
* Defaults to {@code ${project.getBuildDir()}/git.properties}, formatted as "properties" file.
6161
*
62-
* <p>To enable or disable the generation of such properties file refer to
63-
* {@link #getGenerateGitPropertiesFile()}, to configure the format (json, properties, ...)
64-
* of this file refer to {@link #getGenerateGitPropertiesFormat()}.
62+
* <p>To enable or disable the generation of such output file refer to
63+
* {@link #getShouldGenerateOutputFile()}, to configure the format (json, properties, ...)
64+
* of this file refer to {@link #getOutputFormat()}.
6565
*/
6666
// @OutputFile
67-
public abstract RegularFileProperty getGenerateGitPropertiesFilename();
67+
public abstract RegularFileProperty getOutputFile();
6868

6969
/**
7070
* Configuration option to enable or disable unicode escaping in the generated properties file.
@@ -84,19 +84,21 @@ public abstract class GitCommitIdPluginOutputSettingsExtension {
8484
* <p>Hence by default this setting is set to {@code false}.
8585
* If you so desire and wish for unicode escaping (e.g. \\u6E2C\\u8A66\\u4E2D\\u6587) you
8686
* can set this to {@code true}.
87+
*
88+
* <p>Only applies if the {@link #getOutputFormat()} is instructed to generate a "properties" file</p>
8789
*/
88-
public abstract Property<Boolean> getGenerateGitPropertiesFileWithEscapedUnicode();
90+
public abstract Property<Boolean> getShouldEscapedUnicodeForPropertiesOutput();
8991

9092
/**
91-
* Allows to configure the format (json, properties, ...) in which the properties
93+
* Allows to configure the format (json, properties, ...) in which the output file
9294
* should be saved in.
9395
* To enable or disable the generation of such properties file refer to
94-
* {@link #getGenerateGitPropertiesFile()} and to configure the location
95-
* of the properties file refer to {@link #getGenerateGitPropertiesFilename()}.
96+
* {@link #getShouldGenerateOutputFile()} and to configure the location
97+
* of the properties file refer to {@link #getOutputFile()}.
9698
*
9799
* <p>By default will assume that the desired format is "properties".
98100
*/
99-
public abstract Property<CommitIdPropertiesOutputFormat> getGenerateGitPropertiesFormat();
101+
public abstract Property<CommitIdPropertiesOutputFormat> getOutputFormat();
100102

101103
@Inject
102104
public ProjectLayout getProjectLayout() {
@@ -108,12 +110,12 @@ public ProjectLayout getProjectLayout() {
108110
*/
109111
@Inject
110112
public GitCommitIdPluginOutputSettingsExtension() {
111-
getGenerateGitPropertiesFile()
113+
getShouldGenerateOutputFile()
112114
.convention(false);
113-
getGenerateGitPropertiesFilename().convention(
115+
getOutputFile().convention(
114116
getProjectLayout().getBuildDirectory().file("git.properties"));
115-
getGenerateGitPropertiesFileWithEscapedUnicode().convention(false);
116-
getGenerateGitPropertiesFormat()
117+
getShouldEscapedUnicodeForPropertiesOutput().convention(false);
118+
getOutputFormat()
117119
.convention(CommitIdPropertiesOutputFormat.PROPERTIES);
118120
}
119121
}

0 commit comments

Comments
 (0)