Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: hcye on December 20, 2007, 12:31:59 am

Title: Create delivery package based on the project file
Post by: hcye on December 20, 2007, 12:31:59 am
Is it possible to copy a set files used by a project file, using the same directory hierarchy, in order to package them for delivery?
Title: Re: Create delivery package based on the project file
Post by: mandrav on December 20, 2007, 11:51:24 am
Not yet but it's something so easy to do that I just added a script plugin that does just that.
Wait for the next nightly.
Title: Re: Create delivery package based on the project file
Post by: Jenna on December 21, 2007, 11:50:30 am
"make_dist.script" is missing from "Makefile.am" in "src/scripts", so it's doesn't get installed when using "./configure", "make" and "make install".

If there is more then one project iin the workspace the CurrentWorkingDir is the one of the last loaded project, what makes zip unable to find the projects files.
If run twice the replacement of "$ARCHIVE" and "$FILES_LIST" is permanent (until restarting C::B), because "local cmd = Cmd;"  make "cmd" use the same memory then "Cmd".

Here is a patch to fix this.
After patching you need to run "./bootstrap" to update "src/scripts/Makefile.in".

Code
--- codeblocks-1.0svn.orig/src/scripts/make_dist.script 2007-12-20 14:20:59.000000000 +0100
+++ codeblocks-1.0svn.work/src/scripts/make_dist.script 2007-12-21 11:28:48.000000000 +0100
@@ -53,6 +53,10 @@
                return -1;
         }

+        // if there is more then one project in the workspace the current working dir is the one of the last loaded project,
+        // so we have to set it explicitely to make the zip-command find the files
+        IO.SetCwd(prj.GetCommonTopLevelPath());
+
         // good, now let's get the project's filename
         local prj_fname = wxFileName();
         prj_fname.Assign(prj.GetFilename(), ::wxPATH_NATIVE);
@@ -71,7 +75,10 @@
         }

         // all that's left is to replace the variables in the command
-               local cmd = Cmd;
+               // local cmd = Cmd;
+               // we have to copy Cmd into cmd or both are two names for the same instance and the placeholders get overwritten
+               local cmd = wxString();
+               cmd += Cmd;
         cmd.Replace(_T("$ARCHIVE"), prj_fname.GetName());
         cmd.Replace(_T("$FILES_LIST"), file_list);

--- codeblocks-1.0svn.orig/src/scripts/Makefile.am      2007-11-15 12:49:38.000000000 +0100
+++ codeblocks-1.0svn.work/src/scripts/Makefile.am      2007-12-20 17:54:38.000000000 +0100
@@ -3,4 +3,5 @@
 dist_pkgdata_DATA = startup.script \
                        gdb_types.script \
                        edit_startup_script.script \
-                       wx_help.script
+                       wx_help.script \
+                       make_dist.script
Title: Re: Create delivery package based on the project file
Post by: Jenna on December 21, 2007, 07:17:34 pm
Just submitted the patch to berlios: http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2296&group_id=5358 (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2296&group_id=5358).