mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
added nuget
ncc and nmm
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
--- publish.bat Thu Apr 30 00:08:44 2020
|
||||
+++ publish.bat Thu Apr 30 00:08:14 2020
|
||||
@@ -1,6 +1,6 @@
|
||||
set _NMMPATH=%~dp0..\Nexus-Mod-Manager
|
||||
set _NMMCLIPATH=%~dp0
|
||||
-set outputPath=..\..\install\bin
|
||||
+set outputPath=%~1
|
||||
|
||||
mkdir "%outputPath%\NCC"
|
||||
copy "%_NMMPATH%\Stage\Release\AntlrUtil.dll" "%outputPath%\NCC"
|
||||
+7
-2
@@ -78,6 +78,7 @@ static std::map<std::string, std::string> g_conf =
|
||||
{"openssl", "1.1.1d"},
|
||||
{"bzip2", "1.0.6"},
|
||||
{"lz4", "1.9.2"},
|
||||
{"nmm", "0.70.11"},
|
||||
|
||||
{"prefix", R"(C:\dev\projects\mobuild-out)"},
|
||||
};
|
||||
@@ -92,8 +93,10 @@ const std::string& get_conf(const std::string& name)
|
||||
}
|
||||
|
||||
|
||||
bool conf::verbose() { return false; }
|
||||
bool conf::dry() { return false; }
|
||||
bool conf::verbose() { return true; }
|
||||
bool conf::dry() { return false; }
|
||||
std::string conf::mo_org() { return "ModOrganizer2"; }
|
||||
std::string conf::mo_branch() { return "master"; }
|
||||
|
||||
fs::path third_party::sevenz() { return "7z"; }
|
||||
fs::path third_party::jom() { return "jom"; }
|
||||
@@ -103,6 +106,7 @@ fs::path third_party::cmake() { return "cmake"; }
|
||||
fs::path third_party::perl() { return "perl"; }
|
||||
fs::path third_party::devenv() { return "devenv"; }
|
||||
fs::path third_party::msbuild() { return "msbuild"; }
|
||||
fs::path third_party::nuget() { return "nuget"; }
|
||||
|
||||
bool prebuilt::boost() { return false; }
|
||||
|
||||
@@ -123,6 +127,7 @@ const std::string& versions::libloot_hash() { return get_conf("libloot_hash"); }
|
||||
const std::string& versions::openssl() { return get_conf("openssl"); }
|
||||
const std::string& versions::bzip2() { return get_conf("bzip2"); }
|
||||
const std::string& versions::lz4() { return get_conf("lz4"); }
|
||||
const std::string& versions::nmm() { return get_conf("nmm"); }
|
||||
|
||||
fs::path paths::prefix() { return get_conf("prefix"); }
|
||||
fs::path paths::cache() { return prefix() / "downloads"; }
|
||||
|
||||
@@ -7,6 +7,8 @@ struct conf
|
||||
{
|
||||
static bool verbose();
|
||||
static bool dry();
|
||||
static std::string mo_org();
|
||||
static std::string mo_branch();
|
||||
};
|
||||
|
||||
struct third_party
|
||||
@@ -19,6 +21,7 @@ struct third_party
|
||||
static fs::path perl();
|
||||
static fs::path devenv();
|
||||
static fs::path msbuild();
|
||||
static fs::path nuget();
|
||||
};
|
||||
|
||||
struct prebuilt
|
||||
@@ -45,6 +48,7 @@ struct versions
|
||||
static const std::string& openssl();
|
||||
static const std::string& bzip2();
|
||||
static const std::string& lz4();
|
||||
static const std::string& nmm();
|
||||
};
|
||||
|
||||
struct paths
|
||||
|
||||
+11
-1
@@ -53,9 +53,19 @@ int run(int argc, char** argv)
|
||||
add_task<python>();
|
||||
add_task<boost>();
|
||||
add_task<lz4>();
|
||||
add_task<nmm>();
|
||||
add_task<ncc>();
|
||||
|
||||
if (argc > 1)
|
||||
return run_task(argv[1]) ? 0 : 1;
|
||||
{
|
||||
for (int i=1; i<argc; ++i)
|
||||
{
|
||||
if (!run_task(argv[i]))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
run_all_tasks();
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "pch.h"
|
||||
#include "tasks.h"
|
||||
|
||||
namespace builder
|
||||
{
|
||||
|
||||
ncc::ncc()
|
||||
: basic_task("ncc")
|
||||
{
|
||||
}
|
||||
|
||||
fs::path ncc::source_path()
|
||||
{
|
||||
return paths::build() / "NexusClientCli";
|
||||
}
|
||||
|
||||
void ncc::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org(conf::mo_org())
|
||||
.repo("modorganizer-NCC")
|
||||
.branch(conf::mo_branch())
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
void ncc::do_build_and_install()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(source_path() / "NexusClient.sln")
|
||||
.projects({"NexusClientCLI"})
|
||||
.platform("Any CPU"));
|
||||
|
||||
run_tool(process_runner(source_path() / "publish.bat", cmd::noflags)
|
||||
.arg(paths::install_bin()));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "pch.h"
|
||||
#include "tasks.h"
|
||||
|
||||
namespace builder
|
||||
{
|
||||
|
||||
nmm::nmm()
|
||||
: basic_task("nmm")
|
||||
{
|
||||
}
|
||||
|
||||
fs::path nmm::source_path()
|
||||
{
|
||||
return paths::build() / "Nexus-Mod-Manager";
|
||||
}
|
||||
|
||||
void nmm::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("Nexus-Mods")
|
||||
.repo("Nexus-Mod-Manager")
|
||||
.branch(versions::nmm())
|
||||
.output(source_path()));
|
||||
|
||||
run_tool(nuget(source_path() / "NexusClient.sln"));
|
||||
}
|
||||
|
||||
void nmm::do_build_and_install()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(source_path() / "NexusClient.sln")
|
||||
.platform("Any CPU"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -147,6 +147,30 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class ncc : public basic_task<ncc>
|
||||
{
|
||||
public:
|
||||
ncc();
|
||||
static fs::path source_path();
|
||||
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
};
|
||||
|
||||
|
||||
class nmm : public basic_task<nmm>
|
||||
{
|
||||
public:
|
||||
nmm();
|
||||
static fs::path source_path();
|
||||
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
};
|
||||
|
||||
|
||||
class openssl : public basic_task<openssl>
|
||||
{
|
||||
public:
|
||||
|
||||
+32
-3
@@ -272,6 +272,9 @@ git_clone& git_clone::output(const fs::path& dir)
|
||||
|
||||
void git_clone::do_run()
|
||||
{
|
||||
if (org_.empty() || repo_.empty() || where_.empty())
|
||||
bail_out("git_clone missing parameters");
|
||||
|
||||
const fs::path dot_git = where_ / ".git";
|
||||
|
||||
if (!fs::exists(dot_git))
|
||||
@@ -657,7 +660,7 @@ void jom::do_run()
|
||||
|
||||
|
||||
msbuild::msbuild()
|
||||
: basic_process_runner("msbuild")
|
||||
: basic_process_runner("msbuild"), config_("Release"), platform_("x64")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -679,6 +682,18 @@ msbuild& msbuild::parameters(const std::vector<std::string>& params)
|
||||
return *this;
|
||||
}
|
||||
|
||||
msbuild& msbuild::config(const std::string& s)
|
||||
{
|
||||
config_ = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
msbuild& msbuild::platform(const std::string& s)
|
||||
{
|
||||
platform_ = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void msbuild::do_run()
|
||||
{
|
||||
// 14.2 to v142
|
||||
@@ -689,8 +704,8 @@ void msbuild::do_run()
|
||||
.arg("-maxCpuCount")
|
||||
.arg("-property:UseMultiToolTask=true")
|
||||
.arg("-property:EnforceProcessCountAcrossBuilds=true")
|
||||
.arg("-property:Configuration=Release")
|
||||
.arg("-property:Platform=x64")
|
||||
.arg("-property:Configuration=", config_, cmd::quote)
|
||||
.arg("-property:Platform=", platform_, cmd::quote)
|
||||
.arg("-property:PlatformToolset=" + toolset)
|
||||
.arg("-property:WindowsTargetPlatformVersion=" + versions::sdk())
|
||||
.arg("-verbosity:minimal", cmd::quiet)
|
||||
@@ -728,4 +743,18 @@ void devenv_upgrade::do_run()
|
||||
.arg(sln_));
|
||||
}
|
||||
|
||||
|
||||
nuget::nuget(fs::path sln)
|
||||
: basic_process_runner("nuget"), sln_(std::move(sln))
|
||||
{
|
||||
}
|
||||
|
||||
void nuget::do_run()
|
||||
{
|
||||
execute_and_join(cmd(third_party::nuget(), cmd::noflags)
|
||||
.arg("restore")
|
||||
.arg(sln_)
|
||||
.cwd(sln_.parent_path()));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
+17
@@ -261,6 +261,8 @@ public:
|
||||
msbuild& solution(const fs::path& sln);
|
||||
msbuild& projects(const std::vector<std::string>& names);
|
||||
msbuild& parameters(const std::vector<std::string>& params);
|
||||
msbuild& config(const std::string& s);
|
||||
msbuild& platform(const std::string& s);
|
||||
|
||||
protected:
|
||||
void do_run() override;
|
||||
@@ -269,6 +271,8 @@ private:
|
||||
fs::path sln_;
|
||||
std::vector<std::string> projects_;
|
||||
std::vector<std::string> params_;
|
||||
std::string config_;
|
||||
std::string platform_;
|
||||
};
|
||||
|
||||
|
||||
@@ -284,4 +288,17 @@ private:
|
||||
fs::path sln_;
|
||||
};
|
||||
|
||||
|
||||
class nuget : public basic_process_runner
|
||||
{
|
||||
public:
|
||||
nuget(fs::path sln);
|
||||
|
||||
protected:
|
||||
void do_run() override;
|
||||
|
||||
private:
|
||||
fs::path sln_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
+16
-7
@@ -248,24 +248,33 @@ void cmd::add_arg(const std::string& k, const std::string& v, arg_flags f)
|
||||
s_ += " " + k + " " + v;
|
||||
}
|
||||
|
||||
std::string cmd::arg_to_string(const char* s)
|
||||
std::string cmd::arg_to_string(const char* s, bool force_quote)
|
||||
{
|
||||
return s;
|
||||
if (force_quote)
|
||||
return "\"" + std::string(s) + "\"";
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string cmd::arg_to_string(const std::string& s)
|
||||
std::string cmd::arg_to_string(const std::string& s, bool force_quote)
|
||||
{
|
||||
return s;
|
||||
if (force_quote)
|
||||
return "\"" + std::string(s) + "\"";
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string cmd::arg_to_string(const fs::path& p)
|
||||
std::string cmd::arg_to_string(const fs::path& p, bool)
|
||||
{
|
||||
return "\"" + p.string() + "\"";
|
||||
}
|
||||
|
||||
std::string cmd::arg_to_string(const url& u)
|
||||
std::string cmd::arg_to_string(const url& u, bool force_quote)
|
||||
{
|
||||
return u.string();
|
||||
if (force_quote)
|
||||
return "\"" + u.string() + "\"";
|
||||
else
|
||||
return u.string();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-8
@@ -148,7 +148,8 @@ public:
|
||||
{
|
||||
noargflags = 0x00,
|
||||
quiet = 0x01,
|
||||
nospace = 0x02
|
||||
nospace = 0x02,
|
||||
quote = 0x04
|
||||
};
|
||||
|
||||
enum flags
|
||||
@@ -161,7 +162,7 @@ public:
|
||||
cmd(const fs::path& exe, flags f)
|
||||
: exe_(exe.filename().string()), flags_(f)
|
||||
{
|
||||
s_ += arg_to_string(exe);
|
||||
s_ += arg_to_string(exe, false);
|
||||
}
|
||||
|
||||
cmd& name(const std::string& s);
|
||||
@@ -173,14 +174,14 @@ public:
|
||||
template <class T>
|
||||
cmd& arg(const T& value, arg_flags f=noargflags)
|
||||
{
|
||||
add_arg("", arg_to_string(value), f);
|
||||
add_arg("", arg_to_string(value, (f & quote)), f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cmd& arg(const std::string& name, const T& value, arg_flags f=noargflags)
|
||||
{
|
||||
add_arg(name, arg_to_string(value), f);
|
||||
add_arg(name, arg_to_string(value, (f & quote)), f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -195,10 +196,10 @@ private:
|
||||
|
||||
void add_arg(const std::string& k, const std::string& v, arg_flags f);
|
||||
|
||||
std::string arg_to_string(const char* s);
|
||||
std::string arg_to_string(const std::string& s);
|
||||
std::string arg_to_string(const fs::path& p);
|
||||
std::string arg_to_string(const url& u);
|
||||
std::string arg_to_string(const char* s, bool force_quote);
|
||||
std::string arg_to_string(const std::string& s, bool force_quote);
|
||||
std::string arg_to_string(const fs::path& p, bool force_quote);
|
||||
std::string arg_to_string(const url& u, bool force_quote);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -93,6 +93,8 @@
|
||||
<ClCompile Include="..\src\tasks\libffi.cpp" />
|
||||
<ClCompile Include="..\src\tasks\libloot.cpp" />
|
||||
<ClCompile Include="..\src\tasks\lz4.cpp" />
|
||||
<ClCompile Include="..\src\tasks\ncc.cpp" />
|
||||
<ClCompile Include="..\src\tasks\nmm.cpp" />
|
||||
<ClCompile Include="..\src\tasks\openssl.cpp" />
|
||||
<ClCompile Include="..\src\tasks\python.cpp" />
|
||||
<ClCompile Include="..\src\tasks\sevenz.cpp" />
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
<ClCompile Include="..\src\tasks\lz4.cpp">
|
||||
<Filter>src\tasks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tasks\ncc.cpp">
|
||||
<Filter>src\tasks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tasks\nmm.cpp">
|
||||
<Filter>src\tasks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pch.h">
|
||||
|
||||
Reference in New Issue
Block a user