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