Skip to content

Commit 3b9d9c6

Browse files
committed
release-version.sh: handle missing/invalid license
If licenseName is not set, or set to N/A, skip copyright blurb update.
1 parent 9c9a993 commit 3b9d9c6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

release-version.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ Options include:
102102

103103
# -- Extract project details --
104104

105-
projectDetails=$(mvn -N -Dexec.executable='echo' -Dexec.args='${project.version}::${project.parent.groupId}:${project.parent.artifactId}:${project.parent.version}' exec:exec -q)
106-
parentGAV=${projectDetails#*::}
107-
currentVersion=${projectDetails%::*}
105+
projectDetails=$(mvn -N -Dexec.executable='echo' -Dexec.args='${project.version}/${license.licenseName}/${project.parent.groupId}:${project.parent.artifactId}:${project.parent.version}' exec:exec -q)
106+
currentVersion=${projectDetails%%/*}
107+
projectDetails=${projectDetails#*/}
108+
licenseName=${projectDetails%%/*}
109+
parentGAV=${projectDetails#*/}
108110

109111
# -- Sanity checks --
110112

@@ -171,11 +173,13 @@ test "$FETCH_HEAD" = "$(git merge-base $FETCH_HEAD $HEAD)" ||
171173
die "'master' is not up-to-date"
172174

173175
# Ensure license headers are up-to-date.
174-
mvn license:update-project-license license:update-file-header &&
175-
git add LICENSE.txt ||
176-
die 'Failed to update copyright blurbs'
177-
no_changes_pending ||
178-
die 'Copyright blurbs needed an update -- commit changes and try again'
176+
test -z "$licenseName" -o "$licenseName" = "N/A" || {
177+
mvn license:update-project-license license:update-file-header &&
178+
git add LICENSE.txt ||
179+
die 'Failed to update copyright blurbs'
180+
no_changes_pending ||
181+
die 'Copyright blurbs needed an update -- commit changes and try again'
182+
}
179183

180184
# Prepare new release without pushing (requires the release plugin >= 2.1).
181185
$DRY_RUN mvn $BATCH_MODE release:prepare -DpushChanges=false -Dresume=false $TAG \

0 commit comments

Comments
 (0)