diff options
author | starkos <none@none> | 2009-12-05 21:00:46 +0300 |
---|---|---|
committer | starkos <none@none> | 2009-12-05 21:00:46 +0300 |
commit | 79dfb9bf9d54b9556c0f5718baad2947d426759d (patch) | |
tree | cee5df4b588b71471817465231ed370f181f0fdd /scripts/release.lua | |
parent | 0a5f439ccf9c6d1ad86c9b2662e4f81d41774c49 (diff) |
Automated most of the release
Diffstat (limited to 'scripts/release.lua')
-rw-r--r-- | scripts/release.lua | 191 |
1 files changed, 151 insertions, 40 deletions
diff --git a/scripts/release.lua b/scripts/release.lua index 5157ea3..c7df4b2 100644 --- a/scripts/release.lua +++ b/scripts/release.lua @@ -3,14 +3,10 @@ -- work is needed to get everything packaged up. -- -local function executef(cmd, ...) - cmd = string.format(cmd, unpack(arg)) - os.execute(cmd) -end - - function dorelease() - + local z + local svnroot = "https://premake.svn.sourceforge.net/svnroot/premake" + -- -- Make sure a version was specified -- @@ -19,64 +15,160 @@ function dorelease() error("** You must specify a version number", 0) end - + -- --- Look for a release branch in Subversion; create one if necessary +-- Look for required utilities -- + local required = { "svn", "zip", "tar", "make", "gcc" } + for _, cmd in ipairs(required) do + z = os.executef("%s --version &> release.log", cmd) + if z ~= 0 then + error("** '" .. cmd .. "' not found", 0) + end + end + -- --- Check out the release branch +-- Pre-release checklist -- + 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() + -- --- Update the version number in premake.c +-- Create a directory to hold releases +-- + + os.mkdir("release") + os.chdir("release") + + +-- +-- Look for a release branch in Subversion; create one if necessary -- + print("Checking for release branch...") + local branch = string.format("%s/branches/%s", svnroot, _ARGS[1]) + z = os.executef("svn ls %s &> release.log", branch) + if z ~= 0 then + print("Creating release branch...") + z = os.executef('svn cp %s/trunk %s -m "Branched for %s release" > release.log', svnroot, branch, _ARGS[1]) + if z ~= 0 then + error("** Failed to create release branch.", 0) + end + end + -- --- Make absolutely sure the embedded scripts have been updated +-- Check out the release branch -- + print("Checking out release branch...") + local branchdir = "premake-" .. _ARGS[1] + z = os.executef("svn co %s %s &> release.log", branch, branchdir) + if z ~= 0 then + error("** Failed to checkout release branch", 0) + end + os.chdir(branchdir) + -- --- If anything changed in those last two steps, check it in to the branch +-- 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("SVN", _ARGS[1]) + io.output("src/host/premake.c") + io.write(text) + io.close() + -- --- Remove .svn, samples, and packages directories +-- Make absolutely sure the embedded scripts have been updated -- + print("Updating embedded scripts...") + z = os.executef("premake4 embed &> ../release.log") + if z ~= 0 then + error("** Failed to update the embedded scripts", 0) + end + -- --- Generate project files to the build directory +-- If anything changed in those last two steps, check it in to the branch -- - os.execute("premake4 /to=build/vs2005 vs2005") - os.execute("premake4 /to=build/vs2008 vs2008") - os.execute("premake4 /to=build/gmake.windows /os=windows gmake") - os.execute("premake4 /to=build/gmake.unix /os=linux gmake") - os.execute("premake4 /to=build/gmake.macosx /os=macosx /platform=universal32 gmake") - os.execute("premake4 /to=build/codeblocks.windows /os=windows codeblocks") - os.execute("premake4 /to=build/codeblocks.unix /os=linux codeblocks") - os.execute("premake4 /to=build/codeblocks.macosx /os=macosx /platform=universal32 codeblocks") - os.execute("premake4 /to=build/codelite.windows /os=windows codelite") - os.execute("premake4 /to=build/codelite.unix /os=linux codelite") - os.execute("premake4 /to=build/codelite.macosx /os=macosx /platform=universal32 codelite") - + print("Committing changes...") + z = os.executef('svn commit -m "Updated version and scripts" &> ../release.log') + if z ~= 0 then + error("** Failed to commit changes", 0) + end + -- --- Create a source package +-- Right now I only generate the source packaging under Mac OS X -- if os.is("macosx") then - local fname = "premake-" .. _ARGS[1] + + -- + -- Remove .svn, samples, and packages directories + -- + + print("Cleaning up the source tree...") + z = os.executef("rm -rf `find . -name .svn`") + if z ~= 0 then + error("** Failed to remove .svn directories", 0) + end + + z = os.executef("rm -rf samples") + if z ~= 0 then + error("** Failed to remove samples directories", 0) + end + + z = os.executef("rm -rf packages") + if z ~= 0 then + error("** Failed to remove samples directories", 0) + end + + -- + -- Generate project files to the build directory + -- + + print("Generating project files...") + os.executef("premake4 /to=build/vs2005 vs2005 &> ../release.log") + os.executef("premake4 /to=build/vs2008 vs2008 &> ../release.log") + os.executef("premake4 /to=build/gmake.windows /os=windows gmake &> ../release.log") + os.executef("premake4 /to=build/gmake.unix /os=linux gmake &> ../release.log") + os.executef("premake4 /to=build/gmake.macosx /os=macosx /platform=universal32 gmake &> ../release.log") + os.executef("premake4 /to=build/codeblocks.windows /os=windows codeblocks &> ../release.log") + os.executef("premake4 /to=build/codeblocks.unix /os=linux codeblocks &> ../release.log") + os.executef("premake4 /to=build/codeblocks.macosx /os=macosx /platform=universal32 codeblocks &> ../release.log") + os.executef("premake4 /to=build/codelite.windows /os=windows codelite &> ../release.log") + os.executef("premake4 /to=build/codelite.unix /os=linux codelite &> ../release.log") + os.executef("premake4 /to=build/codelite.macosx /os=macosx /platform=universal32 codelite &> ../release.log") + os.executef("premake4 /to=build/xcode3 /platform=universal32 xcode3 &> ../release.log") + + -- + -- Create source package + -- + + print("Creating source code package...") os.chdir("..") - executef("zip -r9 %s-src.zip %s/*", fname, fname) - executef("mv %s-src.zip %s", fname, fname) - os.chdir(fname) + os.executef("zip -r9 %s-src.zip %s/* &> ../release.log", branchdir, branchdir) + os.chdir(branchdir) + end @@ -85,29 +177,48 @@ function dorelease() -- GNU/Make/GCC environment. I use MinGW on Windows. -- - local fname = string.format("premake-%s-%s", _ARGS[1], os.get()) + print("Building platform binary release...") + local fname = string.format("%s-%s", branchdir, os.get()) os.chdir("build/gmake." .. os.get()) - os.execute("make config=" .. iif(os.is("macosx"), "releaseuniv32", "release")) + os.executef("make config=%s &> ../../../release.log", iif(os.is("macosx"), "releaseuniv32", "release")) os.chdir("../../bin/release") if os.is("windows") then - executef("7z -tzip a %s.zip premake4.exe", fname) - executef("move %s.zip ../..", fname) + os.executef("zip -9 %s.zip premake4.exe &> ../../../release.log", fname) + os.executef("move %s.zip ../../.. &> ../../../release.log", fname) else - executef("tar czvf %s.tar.gz premake4", fname) - executef("mv %s.tar.gz ../..", fname) + os.executef("tar czvf %s.tar.gz premake4 &> ../../../release.log", fname) + os.executef("mv %s.tar.gz ../../.. &> ../../../release.log", fname) end - - + -- -- Upload files to SourceForge -- + os.chdir("../..") -- +-- Clean up +-- + + os.chdir("..") + os.remove("release.log") + + +-- -- Remind me of required next steps -- + 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") + end |