made installer a super task

verboser ini command
release command copies installer, now uses a directory per version
This commit is contained in:
isanae
2020-07-14 14:16:41 -04:00
parent 6e869bb692
commit 7f35a40a3b
5 changed files with 56 additions and 19 deletions
+31 -12
View File
@@ -653,7 +653,7 @@ command::meta_t release_command::meta() const
return
{
"release",
"creates a release or a devbuild"
"creates a release"
};
}
@@ -728,6 +728,17 @@ void release_command::make_src()
files, modorganizer::super_path(), out);
}
void release_command::make_installer()
{
const auto file = "Mod.Organizer-" + version_ + ".exe";
const auto src = paths::install_installer() / file;
const auto dest = out_;
u8cout << "copying installer " << file << "\n";
op::copy_file_to_dir_if_better(gcx(), src, dest);
}
void release_command::walk_dir(
const fs::path& dir, std::vector<fs::path>& files,
const std::vector<std::regex>& ignore_re, std::size_t& total_size)
@@ -804,6 +815,11 @@ clipp::group release_command::do_group()
clipp::option("--no-src").set(src_, false)
) % "sets whether the source archive is created [default: yes]",
(
clipp::option("--inst").set(installer_, true) |
clipp::option("--no-inst").set(installer_, false)
) % "sets whether the installer is copied [default: no]",
clipp::option("--version-from-exe").set(version_exe_)
% "retrieves version information from ModOrganizer.exe "
"[default]",
@@ -828,19 +844,12 @@ clipp::group release_command::do_group()
% "optional suffix to add to the archive filenames",
clipp::option("--force").set(force_)
% "ignores file size warnings which could indicate bad paths or "
"unexpected files being pulled into the archives"
% "ignores file size warnings and existing release directories"
);
}
int release_command::do_run()
{
out_ = fs::path(utf8_to_utf16(utf8out_));
if (out_.empty())
out_ = paths::prefix() / "releases";
else if (out_.is_relative())
out_ = paths::prefix() / out_;
rc_path_ = fs::path(utf8_to_utf16(utf8_rc_path_));
if (rc_path_.empty())
{
@@ -856,9 +865,16 @@ int release_command::do_run()
version_ = version_from_exe();
}
u8cout <<
">> don't forget to update the version number before making a "
"release\n";
out_ = fs::path(utf8_to_utf16(utf8out_));
if (out_.empty())
out_ = paths::prefix() / "releases" / version_;
else if (out_.is_relative())
out_ = paths::prefix() / out_;
u8cout
<< ">> don't forget to update the version number before making a release\n"
<< "\n"
<< "creating release for " << version_ << "\n";
if (bin_)
make_bin();
@@ -869,6 +885,9 @@ int release_command::do_run()
if (src_)
make_src();
if (installer_)
make_installer();
return 0;
}
+3 -1
View File
@@ -173,6 +173,7 @@ public:
void make_bin();
void make_pdbs();
void make_src();
void make_installer();
protected:
clipp::group do_group() override;
@@ -183,6 +184,7 @@ private:
bool bin_ = true;
bool src_ = true;
bool pdbs_ = true;
bool installer_ = false;
std::string utf8out_;
fs::path out_;
std::string version_;
@@ -190,7 +192,7 @@ private:
bool version_rc_ = false;
std::string utf8_rc_path_;
fs::path rc_path_;
bool force_;
bool force_ = false;
std::string suffix_;
fs::path make_filename(const std::string& what) const;
+15 -6
View File
@@ -382,7 +382,7 @@ fs::path mob_exe_path()
gcx().bail_out(context::conf, "can't get module filename");
}
fs::path find_root()
fs::path find_root(bool verbose=false)
{
gcx().trace(context::conf, "looking for root directory");
@@ -392,6 +392,9 @@ fs::path find_root()
if (!fs::exists(third_party))
{
if (verbose)
u8cout << "no third-party here\n";
auto p = mob_exe_dir;
if (p.filename().u8string() == u8"x64")
@@ -400,7 +403,10 @@ fs::path find_root()
if (p.filename().u8string() == u8"Debug" ||
p.filename().u8string() == u8"Release")
{
// mob_exe_dir is in the build folder
if (verbose)
u8cout << "this is mob's build directory, looking up\n";
// mob_exe_dir is in the build directory
third_party = mob_exe_dir / ".." / ".." / ".." / "third-party";
}
}
@@ -906,12 +912,15 @@ std::vector<fs::path> find_inis(
if (auto_detect)
{
if (verbose)
u8cout << "root is " << path_to_utf8(find_root()) << "\n";
{
const auto r = find_root(verbose);
u8cout << "root is " << path_to_utf8(r) << "\n";
}
master = find_in_root(master_ini_filename());
if (verbose)
u8cout << "found master " << master_ini_filename() << "\n";
u8cout << "found master " << path_to_utf8(master) << "\n";
v.push_back({"master", master});
}
@@ -921,7 +930,7 @@ std::vector<fs::path> find_inis(
if (auto e=this_env::get_opt("MOBINI"))
{
if (verbose)
u8cout << "found env MOBINI: " << *e << "\n";
u8cout << "found env MOBINI: '" << *e << "'\n";
for (auto&& i : split(*e, ";"))
{
@@ -987,7 +996,7 @@ std::vector<fs::path> find_inis(
for (std::size_t i=0; i<v.size(); ++i)
{
u8cout
<< (i + 1) << ") "
<< " " << (i + 1) << ") "
<< path_to_utf8(v[i].second) << " (" << v[i].first << ")\n";
}
}
+5
View File
@@ -14,6 +14,11 @@ bool installer::prebuilt()
return false;
}
bool installer::is_super() const
{
return true;
}
std::string installer::version()
{
return {};
+2
View File
@@ -170,6 +170,8 @@ public:
static std::string version();
static fs::path source_path();
bool is_super() const;
protected:
void do_clean(clean c) override;
void do_fetch() override;