Skip to content

Commit

Permalink
fix: #362 use project instead of rootProject to get the release exten…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
Hillkorn committed Sep 1, 2022
1 parent dfe5aab commit 3697ae9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ class BaseReleaseTask extends DefaultTask {
@Internal
Map<String, Object> pluginAttributes

@Internal
Project getRootProject() {
def project = getProject()
if (project.getParent() != null) {
return project.getParent()
}
return project
}

BaseReleaseTask() {
group = RELEASE_GROUP
extension = getRootProject().extensions.getByName('release') as ReleaseExtension
extension = project.extensions.getByName('release') as ReleaseExtension
pluginAttributes = extension.attributes
}

Expand Down Expand Up @@ -128,7 +119,7 @@ class BaseReleaseTask extends DefaultTask {
}

String findProperty(String key, Object defaultVal = null, String deprecatedKey = null) {
Project project = getRootProject()
Project project = project
def property = System.getProperty(key) ?: project.hasProperty(key) ? project.property(key) : null

if (!property && deprecatedKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PreTagCommit extends BaseReleaseTask {

@TaskAction
void preTagCommit() {
BaseScmAdapter scmAdapter = ((ReleaseExtension) getRootProject().extensions.getByName("release")).scmAdapter
BaseScmAdapter scmAdapter = ((ReleaseExtension) project.extensions.getByName("release")).scmAdapter
Map<String, Object> projectAttributes = extension.attributes
if (projectAttributes.usesSnapshot || projectAttributes.versionModified || projectAttributes.propertiesFileCreated) {
// should only be committed if the project was using a snapshot version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ class PrepareVersions extends BaseReleaseTask {

@TaskAction
def prepareVersions() {
Project rootProject = getRootProject()
String versionPropertyFilepath = extension.versionPropertyFile.get()
File rootVersionFile = rootProject.file(versionPropertyFilepath)
File rootVersionFile = project.file(versionPropertyFilepath)
if (rootVersionFile.file) {
return
}
Expand Down

0 comments on commit 3697ae9

Please sign in to comment.