2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
-- Prepare a new Premake release. This is still incomplete and some manual
|
|
|
|
-- work is needed to get everything packaged up.
|
|
|
|
--
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
function dorelease()
|
2009-12-05 18:00:46 +00:00
|
|
|
local z
|
|
|
|
local svnroot = "https://premake.svn.sourceforge.net/svnroot/premake"
|
2009-12-09 21:03:29 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- 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
|
|
|
|
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
-- Make sure a version was specified
|
|
|
|
--
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
if #_ARGS ~= 2 then
|
|
|
|
error("** Usage: release [version] [source | binary]", 0)
|
2009-07-16 15:20:15 +00:00
|
|
|
end
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
local version = _ARGS[1]
|
|
|
|
local kind = _ARGS[2]
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
--
|
|
|
|
-- Create a directory to hold the release
|
|
|
|
--
|
|
|
|
|
|
|
|
local workdir = "premake-" .. version
|
|
|
|
os.mkdir("release/" .. workdir)
|
|
|
|
os.chdir("release/" .. workdir)
|
|
|
|
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
2009-12-05 18:00:46 +00:00
|
|
|
-- Look for required utilities
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
local required = { "svn", "zip", "tar", "make", "gcc" }
|
2009-12-09 21:03:29 +00:00
|
|
|
for _, value in ipairs(required) do
|
|
|
|
z = exec("%s --version", value)
|
2009-12-05 18:00:46 +00:00
|
|
|
if z ~= 0 then
|
2009-12-09 21:03:29 +00:00
|
|
|
error("** '" .. value .. "' not found", 0)
|
2009-12-05 18:00:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
2009-12-05 18:00:46 +00:00
|
|
|
-- Pre-release checklist
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("")
|
|
|
|
print("Have you...")
|
|
|
|
print("* Updated the CHANGELOG?")
|
|
|
|
print("* Run tests on Windows and POSIX?")
|
|
|
|
print("* Updated the embedded scripts?")
|
|
|
|
print("* Checked in all changes?")
|
|
|
|
print("")
|
|
|
|
print("Press [Enter] to begin.")
|
|
|
|
io.read()
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
--
|
|
|
|
-- Look for a release branch in Subversion; create one if necessary
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("Checking for release branch...")
|
2009-12-09 21:03:29 +00:00
|
|
|
|
|
|
|
local branch = string.format("%s/branches/%s", svnroot, version)
|
|
|
|
z = exec("svn ls %s", branch)
|
2009-12-05 18:00:46 +00:00
|
|
|
if z ~= 0 then
|
|
|
|
print("Creating release branch...")
|
2009-12-09 21:03:29 +00:00
|
|
|
z = exec('svn cp %s/trunk %s -m "Branched for %s release"', svnroot, branch, version)
|
2009-12-05 18:00:46 +00:00
|
|
|
if z ~= 0 then
|
|
|
|
error("** Failed to create release branch.", 0)
|
|
|
|
end
|
|
|
|
end
|
2009-07-16 15:20:15 +00:00
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
2009-12-05 18:00:46 +00:00
|
|
|
-- Check out the release branch
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("Checking out release branch...")
|
2009-12-09 21:03:29 +00:00
|
|
|
|
|
|
|
z = exec("svn export --force %s .", branch)
|
2009-12-05 18:00:46 +00:00
|
|
|
if z ~= 0 then
|
|
|
|
error("** Failed to checkout release branch", 0)
|
|
|
|
end
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
2009-12-05 18:00:46 +00:00
|
|
|
-- Update the version number in premake.c
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("Updating version number...")
|
2009-12-09 21:03:29 +00:00
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
io.input("src/host/premake.c")
|
|
|
|
local text = io.read("*a")
|
2009-12-09 21:03:29 +00:00
|
|
|
text = text:gsub("SVN", version)
|
2009-12-05 18:00:46 +00:00
|
|
|
io.output("src/host/premake.c")
|
|
|
|
io.write(text)
|
|
|
|
io.close()
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
2009-12-05 18:00:46 +00:00
|
|
|
-- Make absolutely sure the embedded scripts have been updated
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("Updating embedded scripts...")
|
2009-07-16 15:20:15 +00:00
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
z = exec("premake4 embed")
|
2009-12-05 18:00:46 +00:00
|
|
|
if z ~= 0 then
|
2009-12-09 21:03:29 +00:00
|
|
|
error("** Failed to update the embedded scripts", 0)
|
2009-12-05 18:00:46 +00:00
|
|
|
end
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
2009-12-09 21:03:29 +00:00
|
|
|
-- Generate source packaging
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
if kind == "source" then
|
2009-12-05 18:00:46 +00:00
|
|
|
|
|
|
|
--
|
2009-12-09 21:03:29 +00:00
|
|
|
-- Remove extra directories
|
2009-12-05 18:00:46 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
print("Cleaning up the source tree...")
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
os.rmdir("samples")
|
|
|
|
os.rmdir("packages")
|
2009-12-05 18:00:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Generate project files to the build directory
|
|
|
|
--
|
|
|
|
|
|
|
|
print("Generating project files...")
|
2009-12-09 21:03:29 +00:00
|
|
|
exec("premake4 /to=build/vs2005 vs2005")
|
|
|
|
exec("premake4 /to=build/vs2008 vs2008")
|
|
|
|
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")
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Create source package
|
|
|
|
--
|
|
|
|
|
|
|
|
print("Creating source code package...")
|
2009-07-16 15:42:50 +00:00
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
os.chdir("..")
|
|
|
|
exec("zip -r9 %s-src.zip %s/*", workdir, workdir)
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Create a binary package for this platform. This step requires a working
|
|
|
|
-- GNU/Make/GCC environment. I use MinGW on Windows.
|
|
|
|
--
|
|
|
|
|
|
|
|
else
|
2009-12-09 21:03:29 +00:00
|
|
|
|
|
|
|
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", workdir)
|
|
|
|
exec("zip -9 %s premake4.exe", fname)
|
|
|
|
else
|
|
|
|
fname = string.format("%s-%s.tar.gz", os.get())
|
|
|
|
exec("tar czvf %s premake4", fname)
|
|
|
|
end
|
|
|
|
|
|
|
|
os.copyfile(fname, "../../../" .. fname)
|
|
|
|
os.chdir("../../..")
|
2009-07-16 15:20:15 +00:00
|
|
|
end
|
2009-12-05 18:00:46 +00:00
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Upload files to SourceForge
|
|
|
|
--
|
|
|
|
|
2009-12-09 21:03:29 +00:00
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
--
|
|
|
|
-- Clean up
|
|
|
|
--
|
|
|
|
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
--
|
|
|
|
-- Remind me of required next steps
|
|
|
|
--
|
|
|
|
|
2009-12-05 18:00:46 +00:00
|
|
|
print("")
|
|
|
|
print("Finished. Now...")
|
|
|
|
print("* Upload packages to SourceForge and create release")
|
|
|
|
print("* Write news post and publish to front page")
|
|
|
|
print("* Post to Twitter")
|
|
|
|
print("* Post to email list")
|
|
|
|
print("* Update Freshmeat")
|
|
|
|
print("* Post news item on SourceForge")
|
|
|
|
print("* Copy binaries to local path")
|
|
|
|
|
2009-07-16 15:20:15 +00:00
|
|
|
end
|