32 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
34 #define BASE_LOG(s) program_wide_logger::get().log(s, ALWAYS_PRINT)
54 virtual ~vsts_version_fixer() {}
56 virtual int execute();
60 void remove_confusing_files();
64 typedef bool spider_method(
const directory ¤t);
73 bool spider_directory(
directory start, spider_method to_invoke);
79 bool perform_version_stamping(
const filename &start_name);
82 void whack_in_subdirs(
const directory &start,
96 bool vsts_version_fixer::spider_directory(
directory start,
97 spider_method to_invoke)
101 using namespace basis;
106 bool ret = to_invoke(start);
107 if (!ret)
return false;
113 for (
int dir_indy = 0; dir_indy < dirs.
length(); dir_indy++) {
114 const astring ¤t_dir = dirs[dir_indy];
116 if (current_dir.
equal_to(
".svn"))
continue;
117 if (current_dir.
equal_to(
"CVS"))
continue;
118 directory new_dir(start.path() +
"/" + current_dir, start.pattern().observe());
119 bool ret = spider_directory(new_dir, to_invoke);
120 if (!ret)
return false;
128 #define static_class_name() "vsts_version_fixer"
137 using namespace basis;
141 for (
int file_indy = 0; file_indy <
files.length(); file_indy++) {
160 for (
int dir_indy = 0; dir_indy < dirs.
length(); dir_indy++) {
161 const astring ¤t_dir = dirs[dir_indy];
169 launch_process::run(
"rm",
astring(
"-rf ") + goner.
raw(), launch_process::AWAIT_APP_EXIT, kid);
177 #undef static_class_name
181 void vsts_version_fixer::whack_in_subdirs(
const directory &start,
185 using namespace basis;
196 LOG(
astring(
"spidering of ") + start.
path() +
" failed for some reason.");
202 #define static_class_name() "vsts_version_fixer"
209 using namespace basis;
213 for (
int file_indy = 0; file_indy <
files.length(); file_indy++) {
219 if (current_file.
ends(
"version.ini")
220 && !current_file.
iequals(
"core_version.ini") ) {
223 astring versions_directory = environment::get(
"FEISTY_MEOW_GENERATED_STORE");
225 versions_directory +=
"/versions";
227 version_ini::one_stop_version_stamp(current.
path() +
"/" + current_file,
234 #undef static_class_name
238 bool vsts_version_fixer::perform_version_stamping(
const filename &start_name)
240 FUNCDEF(
"perform_version_stamping");
247 void vsts_version_fixer::remove_confusing_files()
249 using namespace basis;
257 source_dir_whacks +=
"obj";
258 source_dir_whacks +=
"Debug";
259 source_dir_whacks +=
"Release";
260 source_dir_whacks +=
"bin";
261 source_dir_whacks +=
"temp_build";
262 directory repo_source(environment::get(
"FEISTY_MEOW_APEX") +
"/source");
263 whack_in_subdirs(repo_source, source_file_whacks, source_dir_whacks);
264 directory libra_src(environment::get(
"FEISTY_MEOW_APEX") +
"/libraries");
265 whack_in_subdirs(libra_src, source_file_whacks, source_dir_whacks);
266 directory produ_src(environment::get(
"FEISTY_MEOW_APEX") +
"/products");
267 whack_in_subdirs(produ_src, source_file_whacks, source_dir_whacks);
281 int vsts_version_fixer::execute()
284 using namespace basis;
285 log(time_stamp::notarize(
true) +
"vsts_version_fixer started.", ALWAYS_PRINT);
287 remove_confusing_files();
289 astring repo_dir = environment::get(
"FEISTY_MEOW_APEX");
293 astring parmfile = environment::get(
"BUILD_PARAMETER_FILE");
296 LOG(
astring(
"found parm variable ") + parmfile);
302 LOG(
"cannot locate the build configuration file.");
308 filename repo_source = repo_dir +
"/../../libraries";
309 if (!repo_source.
exists()) {
310 repo_source = repo_dir +
"/source";
311 if (!repo_source.
exists()) {
312 LOG(
"cannot locate the main library source location.");
316 LOG(
astring(
"chose source dir as ") + repo_source);
317 perform_version_stamping(repo_source);
319 filename repo_apps = repo_dir +
"/../../products";
321 perform_version_stamping(repo_apps);
323 log(time_stamp::notarize(
true) +
"vsts_version_fixer finished.", ALWAYS_PRINT);
327 #ifdef __BUILD_STATIC_APPLICATION__
The application_shell is a base object for console programs.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
bool t() const
t() is a shortcut for the string being "true", as in non-empty.
bool ends(const astring &maybe_suffix) const
returns true if this string ends with "maybe_suffix".
bool iequals(const astring &that) const
returns true if this is case-insensitively equal to "that".
bool equal_to(const char *that) const
returns true if "that" is equal to this.
bool iends(const astring &maybe_suffix) const
Implements a scanner that finds all filenames in the directory specified.
const structures::string_array & directories() const
these are the directory names from the folder.
const structures::string_array & files() const
returns the list of files that we found in this directory.
const basis::astring & path() const
returns the directory that we manage.
Provides operations commonly needed on file names.
bool exists() const
returns true if the file exists.
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
bool unlink() const
actually removes the file, if possible.
An array of strings with some additional helpful methods.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
unsigned int un_int
Abbreviated name for unsigned integers.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
A dynamic container class that holds any kind of object via pointers.
basis::astring global_build_ini
string_array global_dir_whacks
string_array global_file_whacks
bool stamping_spider(const directory ¤t)
bool whacking_spider(const directory ¤t)
Aids in achievement of platform independence.