]> source.dussan.org Git - gitblit.git/commitdiff
Build: create macro for creating the release process script
authorFlorian Zschocke <florian.zschocke@devolo.de>
Thu, 30 Jan 2020 20:47:12 +0000 (21:47 +0100)
committerFlorian Zschocke <f.zschocke+git@gmail.com>
Tue, 1 Feb 2022 21:58:30 +0000 (22:58 +0100)
Refactor the creation of the release process script, from
`release.template` into a `macrodef`.
Add a new target `releaseScript`, so that the release script can be
created after the `tagRelease` target was run.
This is helpful if the `tagRelease` target is run by a different,
earlier process than the actual release creation process.

build.xml

index 02c9476d40c29540e41a36bca0be87661946f284..c08a7b9a6aeab15f22d190c92dab1d317084ba4d 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -896,34 +896,27 @@ GB_RELEASE_TAG=${project.tag}
                </mx:if>\r
 \r
                <!-- create the release process script -->\r
-               <mx:if>\r
-                       <os family="windows" />\r
-                       <then>\r
-                               <!-- Windows PowerShell script        -->\r
-                               <!-- set-executionpolicy remotesigned -->\r
-                               <property name="recipe" value="release_${project.version}.ps1" />\r
-                       </then>\r
-                       <else>\r
-                               <!-- Bash script -->\r
-                               <property name="recipe" value="release_${project.version}.sh" />\r
-                       </else>\r
-               </mx:if>\r
-               <delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />\r
-               <!-- Work-around for lack of proper ant property substitution in copy -->\r
-               <property name="dollar" value="$"/>\r
-               <copy file="release.template" tofile="${recipe}">\r
-                       <filterset begintoken="${dollar}{" endtoken="}">\r
-                               <filter token="project.version" value="${project.version}" />\r
-                               <filter token="project.commitId" value="${project.commitId}" />\r
-                               <filter token="project.tag" value="${project.tag}" />\r
-                               <filter token="project.directory" value="${basedir}" />\r
-                               <filter token="maven.directory" value="${maven.directory}" />\r
-                       </filterset>\r
-               </copy>\r
-               <chmod file="${recipe}" perm="ugo+rx" />\r
+               <createReleaseScript\r
+                               projectVersion="${project.version}"\r
+                               projectTag="${project.tag}"\r
+                               projectCommitId="${project.commitId}" />\r
+       </target>\r
+\r
+\r
+       <!--\r
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+               Create the release process script from the template.\r
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+       -->\r
+       <target name="releaseScript" depends="prepare" description="create the release process script for a release version">\r
+               <!-- create the release process script -->\r
+               <createReleaseScript\r
+                               projectVersion="${project.version}"\r
+                               projectTag="${release.tag}"\r
+                               projectCommitId="${release.tag}" />\r
        </target>\r
 \r
\r
+\r
        <!--\r
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \r
                Prepare for the next point release development cycle.\r
@@ -951,7 +944,47 @@ GB_RELEASE_TAG=${project.tag}
                </mx:commit>            \r
        </target>\r
 \r
-       \r
+\r
+\r
+\r
+       <!--\r
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+               Create the release process script from the template.\r
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+       -->\r
+       <macrodef name="createReleaseScript">\r
+               <attribute name="projectVersion" />\r
+               <attribute name="projectTag" />\r
+               <attribute name="projectCommitId" />\r
+               <sequential>\r
+                       <mx:if>\r
+                               <os family="windows" />\r
+                               <then>\r
+                                       <!-- Windows PowerShell script        -->\r
+                                       <!-- set-executionpolicy remotesigned -->\r
+                                       <property name="recipe" value="release_@{projectVersion}.ps1" />\r
+                               </then>\r
+                               <else>\r
+                                       <!-- Bash script -->\r
+                                       <property name="recipe" value="release_@{projectVersion}.sh" />\r
+                               </else>\r
+                       </mx:if>\r
+                       <delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />\r
+                       <!-- Work-around for lack of proper ant property substitution in copy -->\r
+                       <property name="dollar" value="$"/>\r
+                       <copy file="release.template" tofile="${recipe}">\r
+                               <filterset begintoken="${dollar}{" endtoken="}">\r
+                                       <filter token="project.version" value="@{projectVersion}" />\r
+                                       <filter token="project.commitId" value="@{projectCommitId}" />\r
+                                       <filter token="project.tag" value="@{projectTag}" />\r
+                                       <filter token="project.directory" value="${basedir}" />\r
+                                       <filter token="maven.directory" value="${maven.directory}" />\r
+                               </filterset>\r
+                       </copy>\r
+                       <chmod file="${recipe}" perm="ugo+rx" />\r
+               </sequential>\r
+       </macrodef>\r
+\r
   <!--\r
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
                Build Gitblit Docs\r