-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- I learned that to use Gradle plugin extensions, the properties of t…
…he extension must be retrieved from within the action passed to project.afterEvaluate(). If buildAndVersioning.doExcute() is not executed within afterEvaluate, it seems that the properties of the extension cannot be used because the build script is still incomplete. - Add gradle.properties to the .gitignore file
- Loading branch information
1 parent
7ea9906
commit 2738250
Showing
7 changed files
with
77 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 4 additions & 60 deletions
64
...inmethod0126/gradle/simple/versioning/extension/SimpleSemanticVersionPluginExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,8 @@ | ||
package io.github.mainmethod0126.gradle.simple.versioning.extension; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.api.provider.Property; | ||
|
||
import io.github.mainmethod0126.gradle.simple.versioning.utils.DateUtils; | ||
public interface SimpleSemanticVersionPluginExtension { | ||
Property<Boolean> getIsDateInBuildArtifactDirPath(); | ||
|
||
/** | ||
* | ||
* I wanted to create it as a singleton object, but it seemed like we would | ||
* always have to pass the 'project' object as an argument when calling | ||
* {@code getInstance()} from outside. Therefore, I created the object to be | ||
* conveniently used after calling the initial {@code initExtension()} function. | ||
* | ||
* warn! : This class was not designed with consideration for multi-threading | ||
* and is not thread-safe. Please be cautious when using it in a multi-threaded | ||
* environment. | ||
*/ | ||
public class SimpleSemanticVersionPluginExtension { | ||
|
||
/** | ||
* This is not a singleton object, but rather a global variable used for the | ||
* convenience of users. | ||
*/ | ||
private static SimpleSemanticVersionPluginExtension extension; | ||
|
||
public static void init(Project project) { | ||
if (extension == null) { | ||
extension = project.getExtensions().create("ssv", | ||
SimpleSemanticVersionPluginExtension.class); | ||
} | ||
} | ||
|
||
public static SimpleSemanticVersionPluginExtension getExtension() { | ||
return extension; | ||
} | ||
|
||
private String buildDate = DateUtils.getCurrentDate(DateUtils.DateUnit.DAY); | ||
private boolean isDateInBuildArtifactDirPath = false; | ||
private String applicationVersion = "0.0.0"; | ||
|
||
public boolean isDateInBuildArtifactDirPath() { | ||
return isDateInBuildArtifactDirPath; | ||
} | ||
|
||
public void setDateInBuildPath(boolean isDateInBuildArtifactDirPath) { | ||
this.isDateInBuildArtifactDirPath = isDateInBuildArtifactDirPath; | ||
} | ||
|
||
public String getBuildDate() { | ||
return buildDate; | ||
} | ||
|
||
public void setBuildDate(String buildDate) { | ||
this.buildDate = buildDate; | ||
} | ||
|
||
public String getApplicationVersion() { | ||
return applicationVersion; | ||
} | ||
|
||
public void setApplicationVersion(String applicationVersion) { | ||
this.applicationVersion = applicationVersion; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters