Author Topic: Create delivery package based on the project file  (Read 4469 times)

Offline hcye

  • Multiple posting newcomer
  • *
  • Posts: 20
Create delivery package based on the project file
« 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?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Create delivery package based on the project file
« Reply #1 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.
Be patient!
This bug will be fixed soon...

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Create delivery package based on the project file
« Reply #2 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255