Board index » cppbuilder » Can I get list of source files used in project?

Can I get list of source files used in project?

I'd dearly love to have a way to list all the sources needed to build my
project -- and be able to process this list in various ways.  For instance,
I'd like to "clean" my project directory so that old discarded *mistake*
files are tossed.  I'd also like to be able to distribute source with some
of my stuff -- and having an automated source-lister would sure help.  Is
there something in the IDE that will give me this list.  I know it's in the
makefile...sort of...but it just seems too manual to do all the cut and
paste needed to get from the makefile list to the external world.

Thanks

- Greg

 

Re:Can I get list of source files used in project?


: "Greg Belfor" <g...@rmrs.com> wrote:

Quote
>I'd dearly love to have a way to list all the sources needed to build my
>project

This is not built into C++Builder, I am afraid.

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Re:Can I get list of source files used in project?


Does anyone know of any 3rd party utilities that might do this?
Quote
>: "Greg Belfor" <g...@rmrs.com> wrote:

>>I'd dearly love to have a way to list all the sources needed to build my
>>project

>This is not built into C++Builder, I am afraid.

>Stefan Hoffmeister (TeamB)     http://www.econos.de/
>Please do apply judgement when sending email.

Re:Can I get list of source files used in project?


Quote
Greg Belfor wrote:
> but it just seems too manual to do all the cut and
> paste needed to get from the makefile list to the external world.

Here you go, Greg.  I wrote you a little Perl script.  
If you don't already have it, go get Perl32 from www.ActiveState.com.
I'm sure you'll find lots of other wonderful uses for it.  Anytime you
find yourself saying "but it just seems too manual to do all the cut and
paste...", then its a perfect job for Perl.
Just change the first line of the script to the location of your
perl.exe.

All this does is look at the following lines of the .bpr file and print
out a list of the files it sees (with the appropriate extensions).  You
can modify it to do whatever else you want.

OBJFILES
RESFILES
RESDEPEN
LIBFILES

If you're interested in Perl or have any questions about this little
script, let me know.

Jeff Wilhite

_________________________________________________________________
#!C:\Program Files\Perl\bin\perl
# Jeff Wilhite (jwilh...@acm.org)
# September 22, 1999
# Extracts the names of the source files from a BCB .bpr file.

print "Enter the name of a .bpr file: ";
$infile = <STDIN>;
chomp($infile);
open (INFILE, "$infile") or die "Cannot open $infile.\n";    

print "Where shall I write the output? : ";
$outfile = <STDIN>;
chomp($outfile);
open (OUTFILE, ">$outfile") or die "Cannot open $outfile.\n";    

$looking = 0;
while (<INFILE>) {
    $line = $_;
    if (/^OBJFILES/) { $looking = 1; }    # Starts looking at the
OBJFILES line.
    if (/^LIBRARIES/) { $looking = 0; }   # Stops looking at the
LIBRARIES line.
    if ($looking) {
        @token = split(/ /,$line);
        foreach (@token) {
            if (/([^\\]*)\.obj/) {        # Changes .obj to .cpp
                print OUTFILE "$1.cpp\n";
            } elsif (/([^\\]*)\.res/) {   # Changes .res to .rc
                print OUTFILE "$1.rc\n";
            } elsif (/([^\\]*)\.dfm/) {   # prints .dfm files
                print OUTFILE "$1.dfm\n";
            } elsif (/([^\\]*)\.lib/) {   # prints .lib files
                print OUTFILE "$1.lib\n";
            }
        }
    }

Quote
}

close(INFILE);      
close(OUTFILE);

Re:Can I get list of source files used in project?


Quote
"Stefan Hoffmeister (TeamB)" wrote:
> I am afraid, but this will miss about every header file there is.

That's right, but it looks like what Greg was asking for.  He said he
could get all the info he need from the makefile, so my little script
just saves him some cutting and pasting.

Jeff Wilhite

Re:Can I get list of source files used in project?


: Jeff Wilhite <jwilh...@acm.org> wrote:

Quote
>All this does is look at the following lines of the .bpr file

I am afraid, but this will miss about every header file there is.

Getting *that* list via the Open Tools API is reasonably easy. Getting the
files that make up a project is something that only the compiler and
linker know about - or a tool that at least does the same parsing as the
pre-processor and - to an extent the linker.

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Re:Can I get list of source files used in project?


Quote
>> I am afraid, but this will miss about every header file there is.

... I hadn't thought about the header files...I do need them too.

Quote

>That's right, but it looks like what Greg was asking for

Yup, that's what I asked for, but less than I need.  I am thinking of two
applications:

1) Back up only the source used in the project...leaving out all the chaff
along the way

2) Transfer/distribute the project source needed to rebuild the
project...including .BPR file, etc.

I'll look at the Open Tools API...but I still think this isn't such an
uncommon operation...wouldn't a well-integrated Version Control system need
this?

- Greg

Re:Can I get list of source files used in project?


: "Greg Belfor" <g...@rmrs.com> wrote:

Quote
>I'll look at the Open Tools API...

I forgot whether GExperts (http://www.gexperts.com/gexperts/) actually
serves your needs with the project backup expert.

I may or may not have it enabled for BCB.

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Re:Can I get list of source files used in project?


Quote
> I'll look at the Open Tools API...but I still think this isn't such an
> uncommon operation...wouldn't a well-integrated Version Control system need
> this?

I was going to chime in earlier. What you really need is a version
control system. I don't know how integrated you need it with the IDE (we
use a heavily non-integrated solution here).

For my personal use I choose CVS. It does most of what you are asking
though I'm certain any version control system would probably suffice.

While the system I use is not integrated with the IDE it does allow me
to ignore common file types I don't want under version control. It also
has a nice export command which allows me to easily extract any version
I want less the version control maintenance files.

--
Anduin Withers
Borland

[ Guidelines for posting to this group can be found here:  ]
[    http://www.borland.com/newsgroups/guide.html          ]
[ Note: posts to servers other than forums.borland.com     ]
[ will not be seen by most newsgroup users.                ]

Re:Can I get list of source files used in project?


Quote
>I forgot whether GExperts (http://www.gexperts.com/gexperts/) actually
>serves your needs with the project backup expert.

GExperts doesn't find header files at this time...but it looks promising.  I
may be able to do something there anyway.  Thanks for the lead.

- Greg

Re:Can I get list of source files used in project?


Quote
>I was going to chime in earlier. What you really need is a version
>control system.

No doubt about that.  Maybe I should bite the bullet and get PVCS...but the
cost keeps me away.  If they had a low-cost 1-2 user version, I'd bite in a
second.  Most VCS apps scan only on the extension, which makes it general.
That would be fine for me too except that I want to scan for extensions,
then filter those files to get only the ones actually in the project.
Manual manipulation seems to be my only option at this time unless the Open
Tools API can help.

- Greg

Re:Can I get list of source files used in project?


I'll second the vote for CVS.  It's a great little tool, and we use it too.

Chris (TeamB)

Quote
Anduin Withers (Borland) wrote in message <37E94D5A.A4B11...@inprise.com>...
>> I'll look at the Open Tools API...but I still think this isn't such an
>> uncommon operation...wouldn't a well-integrated Version Control system
need
>> this?

>I was going to chime in earlier. What you really need is a version
>control system. I don't know how integrated you need it with the IDE (we
>use a heavily non-integrated solution here).

>For my personal use I choose CVS. It does most of what you are asking
>though I'm certain any version control system would probably suffice.

>While the system I use is not integrated with the IDE it does allow me
>to ignore common file types I don't want under version control. It also
>has a nice export command which allows me to easily extract any version
>I want less the version control maintenance files.

Re:Can I get list of source files used in project?


Oh, also CVS is free (under GNU GPL).

Chris (TeamB)

Quote
Greg Belfor wrote in message <7sbma7$qg...@forums.borland.com>...
>>I was going to chime in earlier. What you really need is a version
>>control system.

>No doubt about that.  Maybe I should bite the bullet and get PVCS...but the
>cost keeps me away.  If they had a low-cost 1-2 user version, I'd bite in a
>second.  Most VCS apps scan only on the extension, which makes it general.
>That would be fine for me too except that I want to scan for extensions,
>then filter those files to get only the ones actually in the project.
>Manual manipulation seems to be my only option at this time unless the Open
>Tools API can help.

>- Greg

Re:Can I get list of source files used in project?


Quote
>>Maybe I should bite the bullet and get PVCS...but the cost keeps me away.

One of the nicest features of CVS is that it is free. Well there is also
the fact that it is an excellent tool but free is nice as well.

Quote
>>Most VCS apps scan only on the extension, which makes it general.

CVS allows you to ignore files based on a regular expression. With a
more advanced configuration you could have a tool which would allow you
to do more.

Quote
>>then filter those files to get only the ones actually in the project

I guess this leads me to the next logical question... what are
non-essential files doing in the build directory in the first place?

Even so CVS isn't going to add files to the repository unless you tell
it to. You do an 'import' to start a new project so your concerns at
least with CVS may be unfounded.

Here is how I generally create a new project:

- copy the project to a new directory
- remove anything I don't want in the repository
- check to see if my default cvsignore file should be updated
- check to see if my default cvswrappers file should be updated
- import the project into CVS
- check the new project out and make sure binary files are still binary
and everything still compiles
- remove the original directory and check the new version out
- when I create a new file I want in the repository I repeat steps three
and four above and then add the file

If I need to send the project to someone who just needs to look at the
code and possible rebuild it (but not contribute to the repository in an
ongoing fashion) I use cvs's export feature. This allows me to create a
snapshot of a particular version (usually the last stable version)
without throwing files only needed by CVS into the mix.

What this means is that I must spend a few minutes at the beginning of
each new project figuring this stuff out. Ongoing costs are minimal as
they are incurred only as new files are added which I consider no cost
at all as I am generally already there applying a tag or committing
changes.

If you don't like the command line you will probably not like the CVS I
use... there is hope however as I hear there are GUI implementations.

Oh and if you just want more info on CVS check out
http://www.cyclic.com.

--
Anduin Withers
Borland

[ Guidelines for posting to this group can be found here:  ]
[    http://www.borland.com/newsgroups/guide.html          ]
[ Note: posts to servers other than forums.borland.com     ]
[ will not be seen by most newsgroup users.                ]

Re:Can I get list of source files used in project?


: "Greg Belfor" <g...@rmrs.com> wrote:

Quote
>>I forgot whether GExperts (http://www.gexperts.com/gexperts/) actually
>>serves your needs with the project backup expert.

>GExperts doesn't find header files at this time...

Hm, it should at least find the ones associated with PAS and CPP files.
Well, perhaps in .98 (where development has not even started yet.)

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Go to page: [1] [2]

Other Threads