Changeset 19467 for release-kits
- Timestamp:
- 2009-05-14T12:03:27+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/shared/windows/wirk.cpp
r19452 r19467 4 4 #include <iostream> 5 5 #include <string> 6 #include <sstream> 7 8 #ifndef XXX 9 #define XXX 2 10 #endif 6 11 7 12 using namespace std; … … 20 25 void show_help() { 21 26 22 cout << "Wirk XXX - Windows Release Kit for GreenstoneXXX"<< endl;27 cout << "Wirk" << XXX << " - Windows Release Kit for Greenstone" << XXX << endl; 23 28 cout << "Helps you to create releases from the Repository" << endl << endl; 24 29 25 cout << "usage: wirk XXX[args]" << endl;30 cout << "usage: wirk" << XXX << " [args]" << endl; 26 31 cout << " -sim" << endl; 27 32 cout << " simulation only, don't actually do anything" << endl << endl; … … 39 44 cout << " execute only the target with the given address, including subtargets" << endl << endl; 40 45 41 cout << " -cp" << endl;42 cout << " show the classpath being used by wirkXXX" << endl << endl;43 44 46 } 45 47 46 48 47 49 int main(int argc, char** argv ) { 48 49 string classpath, command;50 50 51 51 //some checks 52 52 bool ok = true; 53 53 if ( getenv( "JAVA_HOME" ) == NULL ) { 54 cerr << "Please set JAVA_HOME before running wirk XXX"<< endl;54 cerr << "Please set JAVA_HOME before running wirk" << XXX << endl; 55 55 ok = false; 56 56 } 57 if ( getenv( "WIRKXXX_HOME" ) == NULL ) { 58 cerr << "Please set WIRKXXX_HOME before running wirkXXX" << endl; 57 58 stringstream out; 59 out << "WIRK" << XXX << "_HOME"; 60 string wirk_home_var; 61 wirk_home_var = out.str(); 62 63 if ( getenv( wirk_home_var.c_str() ) == NULL ) { 64 cerr << "Please set " << wirk_home_var << " before running wirk" << XXX << endl; 59 65 ok = false; 60 66 } … … 65 71 //load environment variables 66 72 string JAVA_HOME = getenv( "JAVA_HOME" ); 67 string WIRK XXX_HOME = getenv( "WIRKXXX_HOME");68 putenv( ("ANT_HOME=" + WIRK XXX_HOME + "\\core\\ant").c_str() );73 string WIRK_HOME = getenv( wirk_home_var.c_str() ); 74 putenv( ("ANT_HOME=" + WIRK_HOME + "\\core\\ant").c_str() ); 69 75 70 76 //get the pwd … … 77 83 78 84 //create the command 79 command = WIRKXXX_HOME + "\\core\\ant\\bin\\ant.bat -f \"" + WIRKXXX_HOME + "\\ant-scripts\\build.xml\" -addressing \"-Dwirk3.home=" + WIRKXXX_HOME + "\""; 85 stringstream command; 86 command << WIRK_HOME << "\\core\\ant\\bin\\ant.bat -f \"" << WIRK_HOME << "\\ant-scripts\\build.xml\" -addressing \"-Dwirk" << XXX << ".home=" << WIRK_HOME << "\""; 80 87 81 88 //pass on the arguments 82 89 string a; 83 90 bool simMode = false; 84 for ( int i= 0; i < argc; i++ ) {91 for ( int i=1; i < argc; i++ ) { 85 92 a = argv[i]; 86 93 … … 88 95 show_help(); 89 96 return 0; 90 } else if ( a.compare("-cp") == 0 || a.compare("--cp") == 0 ) {91 cout << classpath;92 return 0;93 97 } else if ( a.compare("-sim") == 0) { 94 command = command + " " +a;98 command << " " << a; 95 99 simMode = true; 96 100 } else { 97 command = command + " " +a;101 command << " " << a; 98 102 } 99 103 … … 101 105 102 106 //set the basedir in the command 103 command = command + " \"-Dbasedir=" + pwd +"\"";107 command << " \"-Dbasedir=" << pwd << "\""; 104 108 105 109 cout 106 110 << "O-----------------------------------------O" << endl 107 111 << "| |" << endl 108 << "| WiRK XXX|" << endl109 << "| Windows Release Kit for Greenstone XXX|" << endl112 << "| WiRK" << XXX << " |" << endl 113 << "| Windows Release Kit for Greenstone" << XXX << " |" << endl 110 114 << "| |" << endl 111 115 << "O-----------------------------------------O" << endl 112 116 ; 113 117 118 string final_command = command.str(); 114 119 cout << "pwd: " << pwd << endl; 115 cout << "command: " << command << endl;120 cout << "command: " << final_command << endl; 116 121 117 system( command.c_str() );122 system( final_command.c_str() ); 118 123 119 124 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.