/*  Requirements
    
    the mapped A Spec requirements: (Arch2.2.doc version 2.2)
    
    3.1.24
    3.1.24.1
    3.1.24.2(The part of building the executable image)
    3.1.24.3
    
    the mapped B Spec requirements:
    
    Test BuildCommandLine_1(BuildSciptCommandLineHandler.1.xml)
    Test BuildCommandLine_2(BuildSciptCommandLineHandler.1.xml)
    Test BuildCommandLine_3(BuildSciptCommandLineHandler.1.xml)
    Test Build_1(BuildScriptProcessor.1.xml)
    Test Build_2(BuildScriptProcessor.1.xml)
    Test Build_3(BuildScriptProcessor.1.xml)
    Test Build_4(BuildScriptProcessor.1.xml)
    Test Build_5(BuildScriptProcessor.1.xml)
    Test Build_6(BuildScriptProcessor.1.xml)
    Test Build_7(BuildScriptProcessor.1.xml)
    Test Build_8(BuildScriptProcessor.1.xml)
*/
/* Preconditions 

   1. Commmand line arguments :
   (user can print out this page by execute the program "buildscript /?") 

Buildmanifest.exe command line arguments help file: v. 0.02
  Date: October 28, 2002
  Tsung Shin Jei, Software Tools Team, Project Member.
  Ozer Ozkaraoglu, Software Tools Team, Project Leader.
Usage:
Buildmanifest { /? | /config:[configFile]| /quiet | /rebuild 
	| /compiler#:[compilerFile] | compiler++:[compilerFile]
	| /save:[saveDir] | /build:[manifestName] 
	| /saveConfig:[configFile]| /test:[LogFileName]
	}

configFile	default: Null
		-The file which includes command line arguments.
		 It must have one argument per line. 
		 The arguments parsed from this file is inserted to where 
		 /config argument was called. 

compilerFile	default: C:\\WINNT\\Microsoft.NET\\Framework
		\\v1.0.3705\\csc.exe
		-The full path of the compiler. Currently, ONLY Microsoft
		 .NET Framework C# compiler is supported.
saveConfig	 default: Null
		-This program saves it's current configuration into this file
saveDir	 default: build[manifestName]
		-Provides the full or relative path where the source files
		 are going to be copied.
		-The build files created in the same directory.

manifestName	default: NONE
		-The name of the manifest file.
		-This argument must be provided. 
LogFileName	default: NONE
		-The name of the log file.
		-If the file already exists, the old one will be deleted.
Options:
/?		* Displays the command line help pages.
/quiet:		* Does not create any console output other 
		than the warning/error messages of the compiler.
/rebuild:	* Forces rebuilding of the manifest and all other 
		manifests it is directly/indirectly referring to.
/compiler#:	* Provides the location of the C-Sharp compiler. 
/compiler++:	* Provides the location of the C++ compiler. This 
		option is currently DISABLED, and is reserved for 
		future implementation.
/save:		* Provides the directory where all the components
		of this program are saved there. The output files
		will also stored in this directory.
/build:		* Name of the manifest which is going to be built.
		This argument MUST be provided.
/saveConfig:	* Name of the file which will store the current
		configuration, if the file doesn't exist, the
		program will create it.
/config:	* Name of the config file.
/test:		* Name of the log file.
		The log file name of this program. Program will log
		error message and other debug information in this file.

Example:
BuildScript.exe	/save:c:\\tmp /build:manifest.1.xml /config:config.cfg ");
		/compiler#:c:\\WINNT\\microsoft.net\\framework\\v1.0.3705");
		\\csc.exe");

The flags /compiler#: and /build: /save: are essential for this process.

*/
/* Post Conditions 
	1.Output Dynimic Link Library files for each refered component.
	2.Output Executable test driver for the target component.
	3.Output the executable file for program manifests.

   Please be aware, in this document, the word "component" means the 
   combination of {System, Program, Module, Component}.
*/
//////////////////////////////////////////////////////////////////
//  BSProcessor.cs   -is responsible for reviewing the manifests//
//                    and compile each componments				//
//  Language:         Visual C#, ver 7                          //
//  Platform:         AMD Duron, Windows 2000 SP2               //
//  Application:      CSE784 Final Project "Foundry", Fall 2002 //
//                    Syracuse University                       //
//  Author:           Tsung Shin Jei, (315) 4427250             //
//                    460 slocum height APT.7                   //
//                    Syracuse, NY  13210                       //
//  E-Mail            jasonsjt@hotmail.com                      //
//////////////////////////////////////////////////////////////////
/*
	Module Operations
	=================
1.BSCommandHandler::BSCommandHandler()

To initiate the BSCommandHandler object, this program will set up
the default path of C Sharp compiler. 

If the compiler exist in the default path then the default path is 
set to "c:\\WINNT\\microsoft.net\\framework\\v1.0.3705\\csc.exe", 
else it is set to be null.

2.BSProcessor::	BSProcessor(string compilerPath,string workDir,
		bool isQuiet,string logFile)
compilerPath:	The path of the C-Sharp compiler. Including the 
		filename(csc.exe).
workDir:	The path of the target manifest.
isQuiet:	True:Print out both debug/information and error messages.
		False:Only print out the error message.
logFile:	The file name of the log file. The content of this 
		file would be deleted.The log file would be in the
		same path of the target manifest.
This function set up some essential configuration in this module.

3.BSProcessor::	preBuild(string manifestName,bool rebuild,
		bool buildtest)

manifestName:	The file name of the target manifest.
rebuild:	True: Compile and rewrite the output files(DLL and EXEs),
		even they already exist.
		False: Only compile the file which does not exist in the 
		directory.
buildtest:	True: Build the component and the test driver for the 
		trget manifest/component.
		False: Build the manifest/component with test driver.
This function is the entry point of the build process. 

Pre-Condition:
With all refered files in the directory "workDir", valid manifest 
"manifestName", and other configuration.

Post-Condition:
The program outputs the error/debug message to the standard output 
and log file(if logFile isn't null). 
The program outputs the DLL(Dynamic Link Library) files, executable file
and the test driver of target component and refered components to the 
directory "workDir".

4.StorRef::storRef(string manifestName,string maniPath, bool quiet)
manifestName:	The file name of the manifest.
maniPath:	The the directory of the target manifest.
quiet:		True: Only print out the error message.
		False: Print out both the debug/information and error 
		messages.
This function check the existence of the manifest and maniPath, than set
up the variables.

5.StorRef::stor()
The entry point of the storRef procedure.
Pre-Condition:
The file "manifest" exists in the directory "maniPath".
Post-Condition:
For each manifest the target manifest refered to, the program creates 
one sub directory, named by its file name, stors the refered files 
into that directory.
While copying files, the program would exam the file names. If the file
name is prepended, the copied file would remove the prepended part of its
file name.

6.StorRef::deleteDir()
This function deletes all sub directory created in this modul. 
Pre-Condition:
All sub directory created by the function "stor()" exists in the directory
"maniPath".
Post-Condition:
The sub directory and all its contents created by the function "stor()" 
would be removed.

*/
//////////////////////////////////////////////////////////////////
//  Build Process                                               //
//////////////////////////////////////////////////////////////////
//  Required Files:                                             //
//   BSProcessor.cs                                             //
//   storRef.cs													//
//	 BSCommandHandler.cs										//
//  Compiler Command:                                           //
//	csc BSProcessor.cs storRef.cs BSCommandHandler.cs			//
//////////////////////////////////////////////////////////////////

/*
Maintenance History
=====================
ver 1.0 : 10 Nov 02
-first release
ver 1.5 : 20 Nov 02
-support compile 
	.dll and test driver for component
	.exe for program manifest
	collection of .exe	for system and test driver or .cs can also be compiled


Known Issues
=====================
Doesn't support the Active X component
Doesn't support compiling the .resx file
(any program using the resource will encounter an exception.)

*/

//////////////////////////////////////////////////////////////////
//  BSCommandHandler.cs   - is responseible for handling the    //
//                        command argument for build script     //
//  Language:         Visual C#, ver 7                          //
//  Platform:         AMD Duron, Windows 2000 SP2               //
//  Application:      CSE784 Final Project "Foundry", Fall 2002 //
//                    Syracuse University                       //
//  Author:           Tsung Shin Jei, (315) 4427250             //
//                    460 slocum height APT.7                   //
//                    Syracuse, NY  13210                       //
//  E-Mail            jasonsjt@hotmail.com                      //
//////////////////////////////////////////////////////////////////
/*
	Module Operations
	=================
  //review the manifest and compile the component,program,or system
	buildscript  /?	//print out the help page.
	please refer to the help page for further information.  
*/
//////////////////////////////////////////////////////////////////
//  Build Process                                               //
//////////////////////////////////////////////////////////////////
//  Required Files:                                             //
//   BSProcessor.cs                                             //
//   storRef.cs                                                 //
//  Compiler Command:                                           //
//																//
//////////////////////////////////////////////////////////////////

/*
Maintenance History
=====================
Maintenance History
=====================
ver 1.0 : 11 Nov 02
-first release

ver 2.0 : 17 Nov 02
-second release
-Support the log file (/test:)

ver 3.0 : 18 Nov 02
-third release
-Support the process of prepended-file names

ver 4.0 : 21 Nov 02
-fourth relase
-Support the executable file output for program
 manifest.
-Support to scan the resource files in manifest.

Known Issues
=====================
1.Still can't compile the .resx files.
2.Program using ActiveX components would generate
run time error.

*/
