Wow, are *you* in for a mess. :)

OK--this is just a suggestion, and half this stuff is being made up on the
spot, but this is how I'd structure your directory. Assume your project is
called "Project"

Project
+--src
+--cls
    These two are your Java "source" and "class" directories, respectively.
Assuming you're building with Java 2, you can do the following quickie
script to build all the java code in the 'src' directory (from the project
root) and have the compiled .class files show up in the 'cls' directory:

(where $(PROJECT_HOME) = the "project root" directory)
find $(PROJECT_HOME) -name '*.java' -print > $(PROJECT_HOME)/.sourcefiles
javac -srcpath $(PROJECT_HOME)/src -d $(PROJECT_HOME)/cls
@$(PROJECT_HOME)/.sourcefiles

Add a $(DEBUG) or other flags-type environment variable to switch
debug/nondebug modes on or off; I'd put this into a makefile that also
controls the JNI/C compilation (discussed in a second). This script doesn't
perform full dependency-checking, so you'll probably want to do a 'rm -r
*.class' from the $(PROJECT_HOME) directory, but it's quick and dirty and
doesn't require .java-file dependency tracking, at the cost of longer
compiles. Adjust as necessary for your own needs.

Then, under the same directory, do

Project
+--c_src
+--inc

This is, of course, where the JNI/C code goes, and the JNI headers go into
the $(PROJECT_HOME)/inc (or 'include', if you prefer) directory. Depending
on what #include syntax you prefer (I like '#include <$(PROJECT)/file.h>',
as opposed to just '#include "file.h"', so I know where each include file is
coming from), you can rename the 'inc' directory to $(PROJECT) and set the
compiler's "-I $(PROJECT_HOME)" flag. That way your JNI/C code is explicitly
documenting where it's getting the JNI headers from. Do the usual
make/makedeps with this, either in the same makefile that handles the java
code (ideally), or in a makefile that's fired from the java project's
makefile.

For the HTML/JavaScript code, I'd do

Project
+--public_html
     +--cgi_bin <or> javascript

I'm less familiar with how to arrange HTML files in a source-controlled
project, since I've not done much with them recently, but since HTML
requires no compilation, you're really just trying to create the appropriate
HTML structure here, nothing more.

For debug/release deployment, I'd set up your makefile/build-script to
compile everything, with $(DEBUG) flags turned on or off (depending on
whether you do 'make -DDEBUG' or not, for example), and have the generated
executables, .jar files and .zip (of the HTML files) files "released" (that
is, copied) to one of two directories in the same project directory:

Project
+--alpha
+--release

Ideally, you'd be able to then run a script from within each directory to
"deploy" the code (to a Web server or simply to another location on your
filesystem) as appropriate.

As far as RCS goes, either just store the files in a separate location, or
use CVS (my preference) and store them on another server--it doesn't affect
how the files themselves are laid out on disk, IMHO.

It's rough, crude, and could probably use several iterations of refinement.
I *more* than welcome comments--I'd love to hear anybody's ideas on so
complex an application of "proper build procedures".

Ted Neward
CTO, WebRaiser ( http://www.webraiser.com )
Java Instructor, DevelopMentor ( http://www.develop.com )
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward


-----Original Message-----
From: Solomon Douglas <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Cc: David Harrison <[EMAIL PROTECTED]>
Date: Monday, November 08, 1999 11:42 AM
Subject: easy question


>I apologize that this isn't a specifically Linux-related question.
>
>I'm working on a project involving several servlets and other classes,
>organized in multiple java packages, and I don't think I've figured
>out the ideal way to structure my directories.  This is a web-based
>application, so in addition to the server-side Java classes, I also
>have HTML and javascript files to deal with.  Thank goodness there are
>no applets (yet), because that would make it even more confusing!  I
>have the following files:
>
>- Java source code files and their associated RCS files
>- C source code (and RCS) for JNI methods
>- the development version of the shared libraries for the JNI methods
>- the production version of the shared libraries for the JNI methods
>- the development version of the Java class files
>- the production version of the Java class files
>- static HTML and JavaScript source files (development version and RCS)
>- static HTML and JavaScript source files (production version)
>
>How does one set up the directory structure for such a project?  The
>class files evidently need to be in a directory hierarchy that mirrors
>the package hierarchy.  I feel that I need the Java source files to be
>in a similar hierarchy - should it be a parallel tree or should I keep
>the sources in the same directories as the development versions of
>their corresponding classes?  If I don't keep the .class files in the
>same directories as their .java files, do I need to "mv" them after
>compiling or can I convince javac to understand my CLASSPATH and put
>the .class files in the right place?
>
>Thanks in advance,
>
>Solomon
>
>
>----------------------------------------------------------------------
>To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to