Author SHA1 Message Date
Mikaël Capelle c9f527b1c8 Remove option to use USVFS prebuilt. 2024-06-02 16:34:25 +02:00
3 changed files with 12 additions and 158 deletions
-1
View File
@@ -89,7 +89,6 @@ lz4 = true
openssl = true openssl = true
pyqt = true pyqt = true
python = true python = true
usvfs = false
[versions] [versions]
vs = 17 vs = 17
-11
View File
@@ -646,21 +646,10 @@ namespace mob::tasks {
void do_build_and_install() override; void do_build_and_install() override;
private: private:
void fetch_prebuilt();
void fetch_from_source(); void fetch_from_source();
void build_and_install_prebuilt();
void build_and_install_from_source(); void build_and_install_from_source();
void download_from_appveyor(arch a);
void copy_prebuilt(arch a);
msbuild create_msbuild_tool(arch a, msbuild::ops o = msbuild::build) const; msbuild create_msbuild_tool(arch a, msbuild::ops o = msbuild::build) const;
std::vector<std::shared_ptr<downloader>>
create_appveyor_downloaders(arch a,
downloader::ops o = downloader::download) const;
std::string prebuilt_directory_name(arch a) const;
}; };
class zlib : public basic_task<zlib> { class zlib : public basic_task<zlib> {
+12 -146
View File
@@ -22,7 +22,7 @@ namespace mob::tasks {
bool usvfs::prebuilt() bool usvfs::prebuilt()
{ {
return conf().prebuilt().get<bool>("usvfs"); return false;
} }
fs::path usvfs::source_path() fs::path usvfs::source_path()
@@ -32,68 +32,29 @@ namespace mob::tasks {
void usvfs::do_clean(clean c) void usvfs::do_clean(clean c)
{ {
if (prebuilt()) { // delete the whole directory
if (is_set(c, clean::redownload)) { if (is_set(c, clean::reclone)) {
// the `downloader` class knows how to delete its own files, so git_wrap::delete_directory(cx(), source_path());
// create the same downloaders and ask them to clean
const auto x86_dls = // nothing more to do
create_appveyor_downloaders(arch::x86, downloader::clean); return;
const auto x64_dls =
create_appveyor_downloaders(arch::x64, downloader::clean);
for (auto dl : x86_dls)
run_tool(*dl);
for (auto dl : x64_dls)
run_tool(*dl);
}
} }
else {
// delete the whole directory
if (is_set(c, clean::reclone)) {
git_wrap::delete_directory(cx(), source_path());
// nothing more to do if (is_set(c, clean::rebuild)) {
return; // msbuild clean
} run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
if (is_set(c, clean::rebuild)) {
// msbuild clean
run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
}
} }
} }
void usvfs::do_fetch() void usvfs::do_fetch()
{ {
if (prebuilt()) fetch_from_source();
fetch_prebuilt();
else
fetch_from_source();
} }
void usvfs::do_build_and_install() void usvfs::do_build_and_install()
{ {
if (prebuilt()) build_and_install_from_source();
build_and_install_prebuilt();
else
build_and_install_from_source();
}
void usvfs::fetch_prebuilt()
{
fetch_from_source();
download_from_appveyor(arch::x64);
download_from_appveyor(arch::x86);
}
void usvfs::build_and_install_prebuilt()
{
copy_prebuilt(arch::x86);
copy_prebuilt(arch::x64);
} }
void usvfs::fetch_from_source() void usvfs::fetch_from_source()
@@ -110,41 +71,6 @@ namespace mob::tasks {
run_tool(create_msbuild_tool(arch::x64)); run_tool(create_msbuild_tool(arch::x64));
} }
void usvfs::download_from_appveyor(arch a)
{
// create all downloaders, run them in parallel
parallel_functions v;
for (auto dl : create_appveyor_downloaders(a))
v.emplace_back("usvfs", [this, dl] {
run_tool(*dl);
});
parallel(v);
}
void usvfs::copy_prebuilt(arch a)
{
const auto path = conf().path();
const auto src = path.build() / prebuilt_directory_name(a);
// dlls and exes to install/bin/
op::copy_glob_to_dir_if_better(cx(), src / "*.dll", path.install_bin(),
op::copy_files);
op::copy_glob_to_dir_if_better(cx(), src / "*.exe", path.install_bin(),
op::copy_files);
// pdbs
op::copy_glob_to_dir_if_better(cx(), src / "*.pdb", path.install_pdbs(),
op::copy_files);
// libs
op::copy_glob_to_dir_if_better(cx(), src / "*.lib", path.install_libs(),
op::copy_files);
}
msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o) const msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o) const
{ {
// usvfs doesn't use "Win32" for 32-bit, it uses "x86" // usvfs doesn't use "Win32" for 32-bit, it uses "x86"
@@ -171,64 +97,4 @@ namespace mob::tasks {
.set("BOOST_PATH", path_to_utf8(boost::source_path())))); .set("BOOST_PATH", path_to_utf8(boost::source_path()))));
} }
std::vector<std::shared_ptr<downloader>>
usvfs::create_appveyor_downloaders(arch a, downloader::ops o) const
{
std::string arch_s;
switch (a) {
case arch::x86:
arch_s = "x86";
break;
case arch::x64:
arch_s = "x64";
break;
case arch::dont_care:
default:
cx().bail_out(context::generic, "bad arch");
}
// returns an appveyor downloader for the given filename that outputs into
// build/usvfs_bin[_32]/
auto make_dl = [&](std::string filename) {
const auto u = make_appveyor_artifact_url(a, "usvfs", filename);
const std::string dir = prebuilt_directory_name(a);
auto dl = std::make_shared<downloader>(o);
dl->url(u);
dl->file(conf().path().build() / dir / u.filename());
return dl;
};
std::vector<std::shared_ptr<downloader>> v;
// five downloaders for the pdbs, dlls, libs and exes
v.push_back(make_dl("lib/usvfs_" + arch_s + ".pdb"));
v.push_back(make_dl("lib/usvfs_" + arch_s + ".dll"));
v.push_back(make_dl("lib/usvfs_" + arch_s + ".lib"));
v.push_back(make_dl("bin/usvfs_proxy_" + arch_s + ".exe"));
v.push_back(make_dl("bin/usvfs_proxy_" + arch_s + ".pdb"));
return v;
}
std::string usvfs::prebuilt_directory_name(arch a) const
{
switch (a) {
case arch::x86:
return "usvfs_bin_32";
case arch::x64:
return "usvfs_bin";
case arch::dont_care:
default:
cx().bail_out(context::generic, "bad arch");
}
}
} // namespace mob::tasks } // namespace mob::tasks