#define REPLACE(tag, replacement) \
new_version_entry.replace_all(tag, replacement); \
-bool version_ini::write_rc(const version_record &to_write)
+bool version_ini::write_rc(const astring &header_store, const version_record &to_write)
{
+ FUNCDEF("write_rc");
astring new_version_entry(version_rc_template);
// $file_ver -> w, x, y, z for version of the file.
astring root_part = "/";
root_part += _ini->load(VERSION_SECTION, ROOT, "");
- astring rc_filename(astring(_path_name->dirname()) + root_part
+ astring rc_filename(header_store + "/" + root_part
+ "_version.rc");
filename(rc_filename).chmod(filename::ALLOW_BOTH, filename::USER_RIGHTS);
//////////////
-bool version_ini::write_code(const version_record &to_write)
+bool version_ini::write_code(const astring &header_store, const version_record &to_write)
{
+ FUNCDEF("write_code");
astring root_part = _ini->load(VERSION_SECTION, ROOT, "");
astring root = root_part.upper(); // make upper case for naming sake.
astring name = _ini->load(VERSION_SECTION, NAME, "");
// $web_address -> the web site for the company. not actually stored.
REPLACE("$web_address", to_write.web_address);
- astring header_filename(_path_name->dirname().raw() + "/" + root_part
+ astring header_filename(header_store + "/" + root_part
+ astring("_version.h"));
filename(header_filename).chmod(filename::ALLOW_BOTH, filename::USER_RIGHTS);
return to_return;
}
-bool version_ini::write_assembly(const version_record &to_write,
+bool version_ini::write_assembly(const astring &header_store, const version_record &to_write,
bool do_logging)
{
FUNCDEF("write_assembly");
- filename just_dir = _path_name->dirname();
-//LOG(astring("dir is set to: ") + just_dir);
+ filename just_dir = filename(header_store);
+ //_path_name->dirname();
+
+//hmmm: make condit on debug
+LOG(astring("dir is set to: ") + just_dir);
+
directory dir(just_dir);
filename to_patch;
//LOG(astring("dir has: ") + dir.files().text_form());
}
bool version_ini::one_stop_version_stamp(const astring &path,
- const astring &source_version, bool do_logging)
+ const astring &header_store, const astring &source_version, bool do_logging)
{
+ FUNCDEF("one_stop_version_stamp");
astring path_name = path;
if (path_name.equal_to("."))
path_name = application_configuration::current_directory();
version_ini verini(path_name);
verini.set_record(source.get_record(), false);
-// LOG(a_sprintf("The file \"%s\" contains this version information:",
-// path_name.s()));
-// LOG(verini.get_record().text_form());
+//put this in debug brackets
+ LOG(a_sprintf("The file \"%s\" contains this version information:",
+ path_name.s()));
+ LOG(verini.get_record().text_form());
+//...debug to here
- if (!verini.write_rc(verini.get_record())) {
+ if (!verini.write_rc(header_store, verini.get_record())) {
critical_events::alert_message(a_sprintf("Could not write the RC file in \"%s\".",
filename(path_name).basename().raw().s()));
return false;
}
- if (verini.library() && !verini.write_code(verini.get_record())) {
+ if (verini.library() && !verini.write_code(header_store, verini.get_record())) {
critical_events::alert_message(astring("Could not write the C++ header file for "
"the directory \"")
+ filename(path_name).basename() + astring("\".\n"));
return false;
}
- if (!verini.write_assembly(verini.get_record(), do_logging)) {
+ if (!verini.write_assembly(header_store, verini.get_record(), do_logging)) {
critical_events::alert_message(astring("Could not write the Assembly info file for "
"the directory \"")
+ filename(path_name).basename() + astring("\".\n"));
bool ole_auto_registering();
//!< returns true if this version file specifies ole auto registration.
- bool write_rc(const structures::version_record &to_write);
+ bool write_rc(const basis::astring &header_store, const structures::version_record &to_write);
//!< writes out the file 'X_version.rc' for the X library or application.
/*!< the contents will include the information specified in "to_write",
where X is the library name from that record. */
- bool write_code(const structures::version_record &to_write);
+ bool write_code(const basis::astring &header_store, const structures::version_record &to_write);
//!< writes out the header ('X_version.h') with the version information.
/*!< this file is needed for other libraries or application to know this
project's version number. the users can make sure that the header info
agrees with the actual version seen on the file. */
- bool write_assembly(const structures::version_record &to_write, bool do_logging);
+ bool write_assembly(const basis::astring &header_store, const structures::version_record &to_write, bool do_logging);
//!< fixes any assemblies with the info in "to_write".
static bool executable(const basis::astring &path_name);
//!< specialized version ignores cache and gets version directly from file.
static bool one_stop_version_stamp(const basis::astring &path,
- const basis::astring &source_version, bool do_logging);
+ const basis::astring &header_store, const basis::astring &source_version,
+ bool do_logging);
//!< performs version stamping using the ini file in "path".
- /*!< "source_version" supplies the name of the main version file where
+ /*!< the created version files will be written to the "header_store".
+ "source_version" supplies the name of the main version file where
we retrieve the current version numbers. if that is not specified, then
only the version header and RC file are created. if "do_logging" is
true, then version info will be sent to the program-wide logger. */
{
FUNCDEF("execute");
SETUP_CONSOLE_LOGGER; // override the file_logger from app_shell.
- if (application::_global_argc < 2) {
- log(astring("The directory where the 'version.ini' file is located\n"
- "must be specified as the first parameter of this program. Another\n"
- "version file may optionally be specified as the second parameter of\n"
- "the program; the version contained in this file will be used to set\n"
- "the version of the file specified in the first parameter.\n"
- "Additionally, if the environment variable 'DEBUG' exists, then the\n"
- "generated RC file will be marked as a debug build. Otherwise it is\n"
- "marked as a release build. Note that the CLAM system automatically\n"
- "sets this for you.\n\n"), ALWAYS_PRINT);
+ if (application::_global_argc < 3) {
+ log(astring(
+"The directory where the 'version.ini' file is located must be specified as the\n"
+"first parameter of this program. The second parameter must provide the\n"
+"storage location where the version header will be written. Another version\n"
+"file may optionally be specified as the third parameter of the program; the\n"
+"version contained in this file will be used to set the version of the file\n"
+"specified in the first parameter.\n"
+"Additionally, if the environment variable 'DEBUG' exists, then the\n"
+"generated RC file will be marked as a debug build. Otherwise it is\n"
+"marked as a release build. Note that the CLAM system automatically\n"
+"sets this for you.\n\n"), ALWAYS_PRINT);
return 1;
}
astring path_name = application::_global_argv[1];
+ astring storage_name = application::_global_argv[2];
astring source_version_file; // blank by default.
- if (application::_global_argc > 2)
- source_version_file = application::_global_argv[2];
- bool ret = version_ini::one_stop_version_stamp(path_name, source_version_file, true);
+ if (application::_global_argc > 3)
+ source_version_file = application::_global_argv[3];
+ bool ret = version_ini::one_stop_version_stamp(path_name, storage_name, source_version_file, true);
if (!ret) return 1; // failure.
return 0; // success.
}
if (current_file.ends("version.ini")
&& !current_file.iequals("core_version.ini") ) {
//LOG(astring("found ver file: ") + current.path() + "/" + current_file);
+//
+ astring versions_directory = environment::get("FEISTY_MEOW_GENERATED_STORE");
+ // we keep our version files one level below the top of the generated store.
+ versions_directory += "/versions";
+
version_ini::one_stop_version_stamp(current.path() + "/" + current_file,
- global_build_ini, true);
+ versions_directory, global_build_ini, true);
}
}
return true;
if (write_header) {
// we actually want to blast out a new file.
byte_filer build_header(filename, "wb");
- if (!build_header.good())
- non_continuable_error(static_class_name(), func, astring("failed to create "
+ if (!build_header.good()) {
+ continuable_error(static_class_name(), func, astring("could not create "
"build header file in ") + build_header.name());
- build_header.write(new_contents);
- LOG(astring(static_class_name()) + ": wrote config to "
- + build_header.name());
+ return false;
+ } else {
+ build_header.write(new_contents);
+ LOG(astring(static_class_name()) + ": wrote config to "
+ + build_header.name());
+ }
} else {
// nothing has changed.
// LOG(astring(static_class_name()) + ": config already up to date in "
// find our storage area for the build headers. we know a couple build
// configurations by now, but this should really be coming out of a config
// file instead.
- astring genstore_directory = environment::get("FEISTY_MEOW_GENERATED_STORE");
- if (!filename(genstore_directory).good()) {
+ astring versions_directory = environment::get("FEISTY_MEOW_GENERATED_STORE");
+ // we keep our version files one level below the top of the generated store.
+ versions_directory += "/versions";
+ if (!filename(versions_directory).good()) {
non_continuable_error(static_class_name(), func,
astring("failed to locate the library folder storing the generated files."));
}
// these are very specific paths, but they really are where we expect to
// see the headers.
- astring cfg_header_filename = genstore_directory + "/__build_configuration.h";
- astring ver_header_filename = genstore_directory + "/__build_version.h";
+ astring cfg_header_filename = versions_directory + "/__build_configuration.h";
+ astring ver_header_filename = versions_directory + "/__build_version.h";
// open the ini file for reading.
byte_filer ini(fname, "r");
ifneq "$(VERSION_RC_ROOT)" ""
# only redo the version resource if it or version.ini is out of date.
%_version.rc: version.ini $(PARAMETER_FILE)
- $(CATCHER)$(CLAM_BINARIES)/version_stamper$(EXE_END) . $(PARAMETER_FILE)
+ $(CATCHER)$(CLAM_BINARIES)/version_stamper$(EXE_END) . $(FEISTY_MEOW_GENERATED_STORE)/versions $(PARAMETER_FILE)
endif
endif
############################################################################
-# examines the required variables and complains if they're missing.
+# examines the required variables and complains if they are missing.
check_requirements:
$(HIDESH) -c 'if [ -z "$(PROJECT)" ]; then echo the PROJECT variable is not defined!; . $(CLAM_SCRIPTS)/exit_make.sh; fi'
$(HIDESH) -c 'if [ -z "$(TYPE)" ]; then echo the TYPE variable is not defined!; . $(CLAM_SCRIPTS)/exit_make.sh; fi'
+ $(HIDESH) -c 'if [ ! -d $(FEISTY_MEOW_GENERATED_STORE)/versions ]; then mkdir $(FEISTY_MEOW_GENERATED_STORE)/versions; fi'
############################################################################
# "HEADER_SEARCH_PATH" is where the class interface files are to be found.
# we add the generated store folder for the build version file.
-HEADER_SEARCH_PATH = $(FEISTY_MEOW_GENERATED_STORE)
+HEADER_SEARCH_PATH = $(FEISTY_MEOW_GENERATED_STORE)/versions
# "HOOPLE_HEADERS" are locations where the HOOPLE headers can be found.
ifeq "$(HOOPLE_HEADERS)" ""
#hmmm: version check for if we're using old screen? this -L change was a mistake though for the screen project owners on ubuntu.
local boguslog=$HOME/screen_junk_$(date_stringer).log
#maybe they unbroke it in 17.10?
- screen -L$boguslog -S "$screen_name" -d -m nice -n $NICENESS_LEVEL mono "$app_name"
+ screen -L $boguslog -S "$screen_name" -d -m nice -n $NICENESS_LEVEL mono "$app_name"
echo "$(date_stringer ' '): $screen_name started."
# only sleep if we are not at the last process that gets started.