1313 */
1414
1515include ('./build-functions.php ' );
16+ include ('./build-properties.php ' );
1617
17- $ DOCUMENTATION_DIR = "documentation/ " ;
18- $ SOURCE_DIR = "src/main/javascript " ;
19- $ RESOURCES_DIR = "src/main/resources/ " ;
20- $ OUTPUT_DIR = "dist/ " ;
21- $ OUTPUT_RESOURCES = "resources/ " ;
22- $ OUTPUT_DOCUMENTATION = "docs/ " ;
23- $ OUTPUT_FILE = "esapi.js " ;
24- $ OUTPUT_FILE_COMPRESSED = "esapi-compressed.js " ;
25-
26- $ JDK_HOME = "/home/cschmidt/jdk1.6.0_14/ " ;
27- $ YUI_COMPRESSOR_JAR = "lib/yuicompressor-2.4.2.jar " ;
28- $ TMP_DIR = "tmp/ " ;
18+ $ build_start = microtime_float ();
2919
3020rmdirr ($ OUTPUT_DIR );
3121if ( !is_dir ($ TMP_DIR ) ) mkdir ($ TMP_DIR , 0700 );
3222mkdir ($ OUTPUT_DIR , 0700 );
3323
3424echo ("Building Uncompressed File: $ OUTPUT_DIR $ OUTPUT_FILE \n\r" );
35-
25+ $ time_start = microtime_float ();
3626$ fpOut = fopen ( $ OUTPUT_DIR .$ OUTPUT_FILE , "w " );
3727
28+ fwrite ( $ fpOut , $ LICENSE_TEXT );
29+
3830$ src = get_files ( $ SOURCE_DIR );
3931foreach ( $ src as $ i =>$ fn ) {
4032 echo ("- Reading $ fn \n" );
4335 while (!feof ($ fp )) {
4436 $ contents .= fgets ($ fp );
4537 }
38+ $ contents = substr ( $ contents , strpos ( $ contents , "*/ " ) + 2 );
4639 fwrite ( $ fpOut , $ contents );
4740 fclose ($ fp );
4841}
4942
50- echo ("Finished building $ OUTPUT_DIR $ OUTPUT_FILE ( " .filesize ($ fpOut )." bytes): Took " );
43+ echo ("Finished building $ OUTPUT_DIR $ OUTPUT_FILE ( " .filesize ($ OUTPUT_DIR . $ OUTPUT_FILE )." bytes): Took " .( microtime_float () - $ time_start ). " s \n\n " );
5144fclose ($ fpOut );
5245
5346echo ("Building Compressed File: $ OUTPUT_DIR $ OUTPUT_FILE_COMPRESSED \n\r" );
47+ $ time_start = microtime_float ();
5448
5549Minify_YUICompressor::$ jarFile = $ YUI_COMPRESSOR_JAR ;
5650Minify_YUICompressor::$ tempDir = $ TMP_DIR ;
6963fwrite ( $ fp , $ compressed );
7064fclose ($ fp );
7165
66+ echo ("Finished building $ OUTPUT_DIR $ OUTPUT_FILE_COMPRESSED ( " .filesize ($ OUTPUT_DIR .$ OUTPUT_FILE_COMPRESSED )." bytes): Took " .( microtime_float () - $ time_start )."s \n\n" );
67+
7268mkdir ($ OUTPUT_DIR .'resources ' );
7369echo ("Copying Resources to $ OUTPUT_DIR $ OUTPUT_RESOURCES \n" );
7470
7571$ dir = dir ($ RESOURCES_DIR );
76- while (false !== $ entry = $ dir ->read ()) {
77- // Skip pointers
78- if ($ entry == '. ' || $ entry == '.. ' || $ entry == '.svn ' ) {
79- continue ;
80- }
81- echo ("- Copying $ entry to $ OUTPUT_DIR . $ OUTPUT_RESOURCES . $ entry \n" );
82- copy ( $ RESOURCES_DIR .$ entry , $ OUTPUT_DIR .$ OUTPUT_RESOURCES .$ entry );
83- }
84- $ dir ->close ();
72+ copydir ($ RESOURCES_DIR ,$ OUTPUT_DIR .$ OUTPUT_RESOURCES );
8573
8674mkdir ($ OUTPUT_DIR .$ OUTPUT_DOCUMENTATION );
87- $ dir = dir ($ DOCUMENTATION_DIR );
88- while (false !== $ entry = $ dir ->read ()) {
89- // Skip pointers
90- if ($ entry == '. ' || $ entry == '.. ' || $ entry == '.svn ' ) {
91- continue ;
92- }
93- echo ("- Copying $ entry to $ OUTPUT_DIR . $ OUTPUT_DOCUMENTATION . $ entry \n" );
94- copy ( $ RESOURCES_DIR .$ entry , $ OUTPUT_DIR .$ OUTPUT_DOCUMENTATION .$ entry );
95- }
96- $ dir ->close ();
75+ copydir ($ DOCUMENTATION_DIR ,$ OUTPUT_DIR .$ OUTPUT_DOCUMENTATION );
9776
98- echo ("Cleaning Up \n" );
77+ echo ("\n Cleaning Up\n \n" );
9978rmdir ($ TMP_DIR );
10079
80+ echo ("Build complete took " .(microtime_float ()-$ build_start )."s \n\n\r" );
10181?>
0 commit comments