]> 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 <florian.zschocke@devolo.de>
Fri, 31 Jan 2020 19:32:21 +0000 (20:32 +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 b4a98eb0149c13586baeb17b8a5d1f68c7d26bd0..b225f7d16bf51b41a60c54f2080577e0de76107d 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -872,34 +872,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
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+               Tag a new version and prepare for the next development cycle.\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
                Prepare for the next point release development cycle.\r
@@ -927,7 +920,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