fixed 404 for libloot

added official to release command
This commit is contained in:
isanae
2020-07-14 15:44:34 -04:00
parent 7f35a40a3b
commit 01734443f6
6 changed files with 248 additions and 128 deletions
+28 -27
View File
@@ -80,33 +80,34 @@ python = true
usvfs = false
[versions]
vs = 16
vs_year = 2019
vs_toolset = 14.2
sdk = 10.0.18362.0
sevenz = 19.00
boost = 1.73.0
boost_vs = 14.2
fmt = 6.2.0
gtest = master
libloot = 0.15.2
libloot_hash = g3baa0e8
lz4 = v1.9.2
nmm = 0.71.2
openssl = 1.1.1g
pyqt = 5.14.2
pyqt_builder = 1.3.2
pyqt_sip = 12.7.2
python = v3.8.2
bzip2 = 1.0.6
sip = 5.2.0
spdlog = v1.5.0
qt = 5.14.2
qt_vs = 2017
zlib = 1.2.11
libbsarch = 0.0.8
usvfs = master
explorerpp = 1.3.5
vs = 16
vs_year = 2019
vs_toolset = 14.2
sdk = 10.0.18362.0
sevenz = 19.00
boost = 1.73.0
boost_vs = 14.2
fmt = 6.2.0
gtest = master
libloot = 0.15.2
libloot_hash = g3baa0e8
libloot_branch = master
lz4 = v1.9.2
nmm = 0.71.2
openssl = 1.1.1g
pyqt = 5.14.2
pyqt_builder = 1.3.2
pyqt_sip = 12.7.2
python = v3.8.2
bzip2 = 1.0.6
sip = 5.2.0
spdlog = v1.5.0
qt = 5.14.2
qt_vs = 2017
zlib = 1.2.11
libbsarch = 0.0.8
usvfs = master
explorerpp = 1.3.5
ss_paper_lad_6788 = 6.0
ss_paper_automata_6788 = 2.2
+182 -94
View File
@@ -9,6 +9,8 @@
namespace mob
{
constexpr bool do_timings = false;
// in main.cpp
void set_sigint_handler();
@@ -514,41 +516,10 @@ int build_command::do_run()
{
try
{
curl_init curl;
run_all_tasks();
{
using namespace std::chrono;
std::ofstream out("timings.txt");
auto write = [&](auto&& inst)
{
for (auto&& t : inst.instrumented_tasks())
{
for (auto&& tp : t.tps)
{
const auto start_ms = static_cast<double>(
duration_cast<milliseconds>(tp.start).count());
const auto end_ms = static_cast<double>(
duration_cast<milliseconds>(tp.end).count());
out
<< inst.instrumentable_name() << "\t"
<< (start_ms / 1000.0) << "\t"
<< (end_ms / 1000.0) << "\t"
<< t.name << "\n";
}
}
};
for (auto&& tk : get_all_tasks())
write(*tk);
write(git_submodule_adder::instance());
}
if (do_timings)
dump_timings();
if (!keep_msbuild_)
terminate_msbuild();
@@ -563,6 +534,39 @@ int build_command::do_run()
}
}
void build_command::dump_timings()
{
using namespace std::chrono;
std::ofstream out("timings.txt");
auto write = [&](auto&& inst)
{
for (auto&& t : inst.instrumented_tasks())
{
for (auto&& tp : t.tps)
{
const auto start_ms = static_cast<double>(
duration_cast<milliseconds>(tp.start).count());
const auto end_ms = static_cast<double>(
duration_cast<milliseconds>(tp.end).count());
out
<< inst.instrumentable_name() << "\t"
<< (start_ms / 1000.0) << "\t"
<< (end_ms / 1000.0) << "\t"
<< t.name << "\n";
}
}
};
for (auto&& tk : get_all_tasks())
write(*tk);
write(git_submodule_adder::instance());
}
void build_command::terminate_msbuild()
{
if (conf::dry())
@@ -800,76 +804,84 @@ clipp::group release_command::do_group()
(clipp::option("-h", "--help") >> help_)
% ("shows this message"),
(
clipp::option("--bin").set(bin_, true) |
clipp::option("--no-bin").set(bin_, false)
) % "sets whether the binary archive is created [default: yes]",
"devbuild" %
(clipp::command("devbuild").set(mode_, modes::devbuild),
(
clipp::option("--bin").set(bin_, true) |
clipp::option("--no-bin").set(bin_, false)
) % "sets whether the binary archive is created [default: yes]",
(
clipp::option("--pdbs").set(pdbs_, true) |
clipp::option("--no-pdbs").set(pdbs_, false)
) % "sets whether the PDBs archive is created [default: yes]",
(
clipp::option("--pdbs").set(pdbs_, true) |
clipp::option("--no-pdbs").set(pdbs_, false)
) % "sets whether the PDBs archive is created [default: yes]",
(
clipp::option("--src").set(src_, true) |
clipp::option("--no-src").set(src_, false)
) % "sets whether the source archive is created [default: yes]",
(
clipp::option("--src").set(src_, true) |
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("--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]",
clipp::option("--version-from-exe").set(version_exe_)
% "retrieves version information from ModOrganizer.exe "
"[default]",
clipp::option("--version-from-rc").set(version_rc_)
% "retrieves version information from modorganizer/src/version.rc",
clipp::option("--version-from-rc").set(version_rc_)
% "retrieves version information from modorganizer/src/version.rc",
(clipp::option("--rc")
& clipp::value("PATH") >> utf8_rc_path_)
% "overrides the path to version.rc",
(clipp::option("--rc")
& clipp::value("PATH") >> utf8_rc_path_)
% "overrides the path to version.rc",
(clipp::option("--version")
& clipp::value("VERSION") >> version_)
% "overrides the version string",
(clipp::option("--version")
& clipp::value("VERSION") >> version_)
% "overrides the version string",
(clipp::option("--output-dir")
& clipp::value("PATH") >> utf8out_)
% "sets the output directory to use instead of `$prefix/releases`",
(clipp::option("--output-dir")
& clipp::value("PATH") >> utf8out_)
% "sets the output directory to use instead of `$prefix/releases`",
(clipp::option("--suffix")
& clipp::value("SUFFIX") >> suffix_)
% "optional suffix to add to the archive filenames",
(clipp::option("--suffix")
& clipp::value("SUFFIX") >> suffix_)
% "optional suffix to add to the archive filenames",
clipp::option("--force").set(force_)
% "ignores file size warnings and existing release directories"
clipp::option("--force").set(force_)
% "ignores file size warnings and existing release directories"
)
|
"official" %
(clipp::command("official").set(mode_, modes::official)
)
);
}
int release_command::do_run()
{
rc_path_ = fs::path(utf8_to_utf16(utf8_rc_path_));
if (rc_path_.empty())
switch (mode_)
{
rc_path_ =
modorganizer::super_path() / "modorganizer" / "src" / "version.rc";
}
case modes::devbuild:
return do_devbuild();
if (version_.empty())
{
if (version_rc_)
version_ = version_from_rc();
else
version_ = version_from_exe();
}
case modes::official:
return do_official();
out_ = fs::path(utf8_to_utf16(utf8out_));
if (out_.empty())
out_ = paths::prefix() / "releases" / version_;
else if (out_.is_relative())
out_ = paths::prefix() / out_;
case modes::none:
default:
u8cerr << "bad release mode " << static_cast<int>(mode_) << "\n";
throw bailed();
}
}
int release_command::do_devbuild()
{
prepare();
u8cout
<< ">> don't forget to update the version number before making a release\n"
@@ -891,19 +903,95 @@ int release_command::do_run()
return 0;
}
int release_command::do_official()
{
set_sigint_handler();
if (fs::exists(paths::prefix()))
{
u8cout
<< "prefix " << path_to_utf8(paths::prefix()) << " already exists\n"
<< "delete? [Y/n] ";
std::wstring s;
std::getline(std::wcin, s);
if (s == L"" || s == L"y" || s == L"Y")
{
build_command::terminate_msbuild();
op::delete_directory(gcx(), paths::prefix());
}
else
{
return 1;
}
}
conf::set_for_task("_override", "task", "enabled", "true");
conf::set_global("transifex", "force", "true");
conf::set_global("transifex", "configure", "true");
conf::set_global("transifex", "pull", "true");
run_all_tasks();
build_command::terminate_msbuild();
prepare();
make_bin();
make_pdbs();
make_src();
make_installer();
return 0;
}
void release_command::prepare()
{
rc_path_ = fs::path(utf8_to_utf16(utf8_rc_path_));
if (rc_path_.empty())
{
rc_path_ =
modorganizer::super_path() / "modorganizer" / "src" / "version.rc";
}
if (version_.empty())
{
if (version_rc_)
version_ = version_from_rc();
else
version_ = version_from_exe();
}
out_ = fs::path(utf8_to_utf16(utf8out_));
if (out_.empty())
out_ = paths::prefix() / "releases" / version_;
else if (out_.is_relative())
out_ = paths::prefix() / out_;
}
std::string release_command::do_doc()
{
return
"Creates three archives in `$prefix/releases`: one from \n"
"`install/bin/*`, one from `install/pdbs/*` and another with the \n"
"sources of projects from modorganizer_super.\n"
"Creates archives for an MO installation, PDBs and sources.\n"
"\n"
"The archive filename is `Mod.Organizer-version-suffix-what.7z`,\n"
"where:\n"
" - `version` is taken from `ModOrganizer.exe`, `version.rc`\n"
" or from --version;\n"
" - `suffix` is the optional `--suffix` argument;\n"
" - `what` is either nothing, `src` or `pdbs`.";
"Commands:\n"
"devbuild\n"
" Can creates three archives in `$prefix/releases/version`: one from\n"
" `install/bin/*`, one from `install/pdbs/*` and another with the\n"
" sources of projects from modorganizer_super.\n"
" \n"
" The archive filename is `Mod.Organizer-version-suffix-what.7z`,\n"
" where:\n"
" - `version` is taken from `ModOrganizer.exe`, `version.rc`\n"
" or from --version;\n"
" - `suffix` is the optional `--suffix` argument;\n"
" - `what` is either nothing, `src` or `pdbs`.\n"
"\n"
"official\n"
" Creates a new full build in the prefix. Requires that directory\n"
" to be empty. Puts the binary archive, source, PDBs and installer\n"
" in `$prefix/releases/version`. Forces all tasks to be enabled,\n"
" including translations and installer. Make sure the transifex API\n"
" key is in the INI or TX_TOKEN is set.";
}
std::string release_command::version_from_exe() const
+18 -1
View File
@@ -120,7 +120,9 @@ class build_command : public command
{
public:
build_command();
meta_t meta() const override;
static void terminate_msbuild();
protected:
void convert_cl_to_conf() override;
@@ -142,7 +144,7 @@ private:
bool keep_msbuild_ = false;
std::optional<bool> revert_ts_;
void terminate_msbuild();
void dump_timings();
};
@@ -181,6 +183,15 @@ protected:
std::string do_doc() override;
private:
enum class modes
{
none = 0,
devbuild,
official
};
modes mode_= modes::none;
bool bin_ = true;
bool src_ = true;
bool pdbs_ = true;
@@ -195,6 +206,12 @@ private:
bool force_ = false;
std::string suffix_;
int do_devbuild();
int do_official();
void prepare();
fs::path make_filename(const std::string& what) const;
void walk_dir(
+1
View File
@@ -235,6 +235,7 @@ void set_sigint_handler()
int run(const std::vector<std::string>& args)
{
font_restorer fr;
curl_init curl;
add_tasks();
+16 -5
View File
@@ -19,6 +19,11 @@ std::string libloot::hash()
return conf::version_by_name("libloot_hash");
}
std::string libloot::branch()
{
return conf::version_by_name("libloot_branch");
}
bool libloot::prebuilt()
{
return false;
@@ -26,7 +31,7 @@ bool libloot::prebuilt()
fs::path libloot::source_path()
{
return paths::build() / dir_name();
return paths::build() / release_name();
}
void libloot::do_clean(clean c)
@@ -70,12 +75,18 @@ void libloot::do_build_and_install()
});
}
std::string libloot::dir_name()
std::string libloot::release_name()
{
// libloot-0.15.1-0-gf725dd7_0.15.1-win64.7z, yeah
// the naming convention is `libloot-version-commit_branch-win64.7z`,
// such as:
//
// libloot-0.14.6-0-g8fed4b0_dev-win64.7z
// libloot-0.15.1-0-gf725dd7_0.15.1-win64.7z
// libloot-0.15.2-0-g3baa0e8_master-win64.7z
return
"libloot-" + version() + "-" + "0-" +
hash() + "_" + version() + "-" +
hash() + "_" + branch() + "-" +
"win64";
}
@@ -83,7 +94,7 @@ url libloot::source_url()
{
return
"https://github.com/loot/libloot/releases/download/" +
version() + "/" + dir_name() + ".7z";
version() + "/" + release_name() + ".7z";
}
} // namespace
+3 -1
View File
@@ -238,6 +238,8 @@ public:
static std::string version();
static std::string hash();
static std::string branch();
static bool prebuilt();
static fs::path source_path();
@@ -247,7 +249,7 @@ protected:
void do_build_and_install() override;
private:
static std::string dir_name();
static std::string release_name();
static url source_url();
};