1-- 2-- Prepare a new Premake release. This is still incomplete and some manual 3-- work is needed to get everything packaged up. 4-- 5-- BEFORE RUNNING THIS SCRIPT: 6-- * Make sure all tests pass on Windows AND Posix systems 7-- * Update CHANGELOG.txt 8-- * Run `premake4 embed` 9-- * Commit all changes to premake-stable 10-- * Tag premake-stable with the version number 11-- * Prepare release news item 12-- 13-- RUN THE SCRIPT: 14-- On each platform, run `premake4 release x.x binary` 15-- (and copy binary to /usr/local/bin if desired) 16-- On one platform, run `premake4 release x.x source` 17-- 18-- AFTER RUNNING THIS SCRIPT: 19-- * Upload release files to SourceForge 20-- * On SourceForge, set file platforms and release changelog 21-- * Update the download page on Industrious One 22-- * Post the news item to the forums 23-- * Update the Premake project page on Industrious One 24-- * Post to Twitter 25-- * Send to email list 26-- * Add release to Freshmeat (http://freshmeat.net/projects/premake) 27-- * Push changes to repositories on BitBucket 28-- 29-- Info on using Mercurial to manage releases: 30-- http://hgbook.red-bean.com/read/managing-releases-and-branchy-development.html 31-- http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ 32-- 33 34 35function dorelease() 36 local z 37 local hgroot = "https://bitbucket.org/premake/premake-stable" 38 39-- 40-- Helper function: runs a command (formatted, with optional arguments) and 41-- suppresses any output. Works on both Windows and POSIX. Might be a good 42-- candidate for a core function. 43-- 44 45 local function exec(cmd, ...) 46 cmd = string.format(cmd, unpack(arg)) 47 local z = os.execute(cmd .. " > output.log 2> error.log") 48 os.remove("output.log") 49 os.remove("error.log") 50 return z 51 end 52 53 54 55-- 56-- Make sure a version was specified 57-- 58 59 if #_ARGS ~= 2 then 60 error("** Usage: release [version] [source | binary]", 0) 61 end 62 63 local version = _ARGS[1] 64 local kind = _ARGS[2] 65 66 local pkgname = "premake-" .. version 67 68 69-- 70-- Look for required utilities 71-- 72 73 local required = { "hg", "zip", "tar", "make", "gcc" } 74 for _, value in ipairs(required) do 75 z = exec("%s --version", value) 76 if z ~= 0 then 77 error("** '" .. value .. "' not found", 0) 78 end 79 end 80 81 82-- 83-- Pre-release checklist 84-- 85 86 print( "") 87 print( "BEFORE RUNNING THIS SCRIPT you should..." ) 88 print( "* Pass all tests on Windows AND Posix systems" ) 89 print( "* Update CHANGELOG.txt") 90 print( "* Run `premake4 embed`") 91 print( "* Commit all changes to premake-stable" ) 92 print( "* Tag premake-stable with the version number" ) 93 print( "* Prepare release news item") 94 95 print( "") 96 print( "Press [Enter] to begin.") 97 io .read() 98 99 100 101 102 103--------------------------------------------------------------------------- 104-- 105-- Everything below this needs to be reworked for Mercurial 106-- 107--------------------------------------------------------------------------- 108 109-- 110-- Check out the release tagged sources to releases/ 111-- 112 113 print("Downloading release tag...") 114 115 os.mkdir("release") 116 os.chdir("release") 117 118 os.rmdir(pkgname) 119 z = exec( "hg clone -r %s %s %s", version, hgroot, pkgname) 120 if z ~= 0 then 121 error("** Failed to download tagged sources", 0) 122 end 123 124 os.chdir(pkgname) 125 126 127-- 128-- Update the version number in premake.c 129-- 130 131 print("Updating version number...") 132 133 io.input("src/host/premake.c") 134 local text = io.read("*a") 135 text = text:gsub("HEAD", version) 136 io.output("src/host/premake.c") 137 io.write(text) 138 io.close() 139 140 141-- 142-- Make absolutely sure the embedded scripts have been updated 143-- 144 145 print("Updating embedded scripts...") 146 147 z = exec("premake4 embed") 148 if z ~= 0 then 149 error("** Failed to update the embedded scripts", 0) 150 end 151 152 153-- 154-- Generate source packaging 155-- 156 157 if kind == "source" then 158 159 -- 160 -- Remove extra directories 161 -- 162 163 print("Cleaning up the source tree...") 164 165 os.rmdir("samples") 166 os.rmdir("packages") 167 os.rmdir(".hg") 168 os.rmdir(".hgignore") 169 os.rmdir(".hgtags") 170 171 172 -- 173 -- Generate project files to the build directory 174 -- 175 176 print("Generating project files...") 177 178 exec("premake4 /to=build/vs2005 vs2005") 179 exec("premake4 /to=build/vs2008 vs2008") 180 exec("premake4 /to=build/vs2010 vs2010") 181 exec("premake4 /to=build/gmake.windows /os=windows gmake") 182 exec("premake4 /to=build/gmake.unix /os=linux gmake") 183 exec("premake4 /to=build/gmake.macosx /os=macosx /platform=universal32 gmake") 184 exec("premake4 /to=build/codeblocks.windows /os=windows codeblocks") 185 exec("premake4 /to=build/codeblocks.unix /os=linux codeblocks") 186 exec("premake4 /to=build/codeblocks.macosx /os=macosx /platform=universal32 codeblocks") 187 exec("premake4 /to=build/codelite.windows /os=windows codelite") 188 exec("premake4 /to=build/codelite.unix /os=linux codelite") 189 exec("premake4 /to=build/codelite.macosx /os=macosx /platform=universal32 codelite") 190 exec("premake4 /to=build/xcode3 /platform=universal32 xcode3") 191 192 193 -- 194 -- Create source package 195 -- 196 197 print("Creating source code package...") 198 199 os.chdir("..") 200 exec("zip -r9 %s-src.zip %s/*", pkgname, pkgname) 201 202-- 203-- Create a binary package for this platform. This step requires a working 204-- GNU/Make/GCC environment. I use MinGW on Windows. 205-- 206 207 else 208 209 print("Building platform binary release...") 210 211 exec("premake4 /platform=universal32 gmake") 212 exec("make config=%s", iif(os.is("macosx"), "releaseuniv32", "release")) 213 214 local fname 215 os.chdir("bin/release") 216 if os.is("windows") then 217 fname = string.format("%s-windows.zip", pkgname) 218 exec("zip -9 %s premake4.exe", fname) 219 else 220 fname = string.format("%s-%s.tar.gz", pkgname, os.get()) 221 exec("tar czvf %s premake4", fname) 222 end 223 224 os.copyfile(fname, "../../../" .. fname) 225 os.chdir("../../..") 226 end 227 228 229-- 230-- Upload files to SourceForge 231-- 232 233 234 235-- 236-- Clean up 237-- 238 239 240-- 241-- Remind me of required next steps 242-- 243 244 print("") 245 print( "Finished.") 246 247end 248