3

I like to backup up the source code set for a project when I release a version. I use GExperts project backups, which seems to gather up all the files in the project manager into the ZIP file. You can also add arbitrary files to this file set, but I'm always conscious of the fact that I haven't necessarily got all the files. Unless I specifically go though the uses clauses and add all the units I have sources for to the project, I'll never be sure of storing all the files necessary to recreate the installable/executable.

I've thought about rolling an app to traverse a project, following all the units used and looking down all the search paths and seeing if there is a source file available for that unit, and building a list of files to back up that way, but hey - maybe someone has already done the work?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
rossmcm
  • 5,493
  • 10
  • 55
  • 118

4 Answers4

12

You should (highly recommend) look into Version Control.

e.g. SVN (subversion), CVS

This will allow you to control revisions of all of your source. It will allow you to add or remove source files, roll back merge and all other nice things related to managing project sources.

This WILL save your a$%# one day.

Simon
  • 9,197
  • 13
  • 72
  • 115
  • @Simon I have to admit that version control is one of those things where I feel I missed a crucial episode somewhere (mind you I thought that about objects when I first encountered them). I'm interested to hear your comments on the learning curve/impact on existing project management procedures, etc. – rossmcm Mar 08 '11 at 04:13
  • I use Subversion. It is free and you can use it in a simple manner or more complex. Look for TortoiseSVN. You will need to install a SVN server, create a repository and then use TortoiseSVN to check your source in and out. Seriously spend a bit of time looking at it - it only took me a day or so to figure it out – Simon Mar 08 '11 at 04:16
  • @Simon I carry out development an work and at home. I keep the sources sync'ed via regular incremental backups to and from dropbox so that I can move from work to home and vice versa and pretty much know that the sources I'm about to work on are current. Would SVN get in the way of this, or would it offer anything that is as convenient? – rossmcm Mar 08 '11 at 04:30
  • If you have access to your work server from home, then it will be no issue at all. Tortoise connects to the SVN server much like HTTP - a svn server address looks like: svn://svnserver/repository. I also use from work and home, and can be accessed through VPN. Current sources - no problem, simply select 'Update' and any code will be updated. If you are working in a multi-user environment, SVN can 'merge' users edits together. Seriously, it will take a little to get it set up, but i have never looked back. Im sure most people on here would highlt recommend it too. – Simon Mar 08 '11 at 04:42
  • +1 for SVN. Unfuddle.com + TortoiseSVN is a painless and quick way to start. – Stuart Mar 08 '11 at 10:00
  • +1 It doesn't matter so much what VCS you use so long as you use one. In my opinion, if you are using a VCS you aren't doing software development. – David Heffernan Mar 08 '11 at 10:53
  • I think it's funny that this is marked as an answer. While it's insightful (I +1'd it myself), it doesn't answer the question. Because now how does the OP find out _what files to add to the version control system_? It's still trial and error with an existing project, starting with all units in the dpr, then tracing through library parts, resources, files loaded, etc etc. – Paul-Jan Mar 08 '11 at 15:34
  • @David please check your post, or explain your reasoning – rossmcm Mar 08 '11 at 19:35
  • @Paul The OP never mentioned VCS. I marked this response as an "answer" because it was useful, and it didn't look as if there really was an answer. – rossmcm Mar 08 '11 at 19:46
  • @David " In my opinion, if you are using a VCS you aren't doing software development.". Did you mean : " In my opinion, if you AREN'T using a VCS you aren't doing software development." ? – rossmcm Mar 08 '11 at 19:48
  • Just reading the question again seems, yes, i didnt actually answer it completely. But VCS goes a very long way to managing projcet sources. If the OP just needs to ensure he can recompile and has all his sources, Tortoise SVN has nice features such as status icons and 'Check for Modifications' – Simon Mar 08 '11 at 19:53
  • @ross Sorry, now I see. You are right, my logic was backwards. I know I'm stating my point very strongly for extra effect. But once you've spent just a little time with VCS you'll understand what I mean!! – David Heffernan Mar 08 '11 at 19:55
  • @David Thanks. I'll need to RTFM. I'm a bit spooked in that my sources are arranged in a particular way (folder structure) and I'm unsure as to how much that will need to change, if any. The other thing I'm unsure of is what overhead is involved in making a small incremental change. Presently, I edit the sources (be it with Delphi, the help author, Inno Setup, or whatever), and then fire up a batch file to produce a new installable. – rossmcm Mar 08 '11 at 20:21
  • @ross A good VCS will not impinge on your folder structure. It will also support very fine grained changes. I'd personally go for TortoiseSVN. It does take a bit of work to set up repositories but read and follow the instructions very carefully. Try it out on a couple of dummy projects first. Then do it for real. – David Heffernan Mar 08 '11 at 20:24
1

You can interpret your question in two ways:

  1. How can I make sure that I backup at least enough files so I can build the project
  2. How can I make sure that I backup not too many files so I can still build the project

The first is to make sure you can build the system at all, the second to allow you to clean up unused files.

For both, a version control system including a separate build system is the way to go.

You then - for each new set of changes - can use these steps to assure that both conditions hold:

  1. On your daily development system, check in the new revision of your source code into your version control system.
  2. On your separate build system, get the latest version of your source control system.
  3. Build the project on the build system; if this fails, go to Step 1, and add the missing files to your version control system from your development system
  4. Start removing (one-by-one) files from the project that you suspect are not needed, then rebuild until it fails.
  5. When the build fails, restore that particular file from the version control system, then continue step 3 with the next candidate
  6. When the build succeed you have the minimum set of files.
  7. Now make a difference overview of the files in your version control system, and the build machine.
  8. Mark the files that are in your version control system but not on your build machine as deprecated or deleted.

Most version control systems have good ways of generating a difference between the files on your development or build system against the files in the version control system (usually fine grained for each historic point in time you added/removed/updated files in your version control system).

The reason you want a separate build system (or two separate development systems) is that you want them to be independent: you use one for developing, and the other for checking if the build is still OK.

This is the first step that in the future you might want to extend this into a continuous integration system (that runs unit tests, automatically creates product setups and much more).

--jeroen

Jeroen Wiert Pluimers
  • 23,965
  • 9
  • 74
  • 154
1

I'm not sure if you're asking about version control or how to be sure you've got all the files.

One useful utility I run occasionally is a program that makes a DirList of all of the files in my dcu output folder. Changing the extensions from .dcu to .pas gives me a list of all of the source code files.

Of course it misses .inc files and other non-.pas files, but perhaps this line of thinking would be helpful to you in some way?

The value of this utility to me is that a second housekeeping utility program then makes a list of all .pas files in my source tree that do not have corresponding .dcu files. This (after a full compile of all programs) generally reveals some "junk" .pas files that are no longer in use.

RobertFrank
  • 7,332
  • 11
  • 53
  • 99
1

For getting a list of all units compiled into an executable, you could let the compiler generate a MAP file. This file will contain entries for all the units used.

dummzeuch
  • 10,975
  • 4
  • 51
  • 158