Help message for dotnet

This commit is contained in:
Senthil 2016-05-11 20:58:01 -07:00 committed by schellap
parent 876a67348d
commit 547b97a195
7 changed files with 71 additions and 5 deletions

View file

@ -174,6 +174,7 @@ namespace Microsoft.DotNet.Cli.Build
var arch = IsWinx86 ? "x86" : "x64";
var baseSupportedRid = $"win7-{arch}";
var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={hostVersion.LatestHostPolicyVersion}";
var cmakeHostFxrVer = $"-DCLI_CMAKE_HOST_FXR_VER:STRING={hostVersion.LatestHostFxrVersion}";
var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}";
var cmakeCommitHash = $"-DCLI_CMAKE_COMMIT_HASH:STRING={commitHash}";
@ -181,6 +182,7 @@ namespace Microsoft.DotNet.Cli.Build
corehostSrcDir,
archMacro,
ridMacro,
cmakeHostFxrVer,
cmakeHostPolicyVer,
cmakeBaseRid,
cmakeCommitHash,
@ -214,6 +216,8 @@ namespace Microsoft.DotNet.Cli.Build
ExecIn(cmakeOut, Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost", "build.sh"),
"--arch",
"x64",
"--fxrver",
hostVersion.LatestHostFxrVersion,
"--policyver",
hostVersion.LatestHostPolicyVersion,
"--rid",

View file

@ -27,11 +27,12 @@ init_distro_name_and_rid()
usage()
{
echo "Usage: $0 --arch <Architecture> --rid <Runtime Identifier> --policyver <HostPolicy library version> --commithash <Git commit hash> [--xcompiler <Cross C++ Compiler>]"
echo "Usage: $0 --arch <Architecture> --rid <Runtime Identifier> --fxrver <HostFxr library version> --policyver <HostPolicy library version> --commithash <Git commit hash> [--xcompiler <Cross C++ Compiler>]"
echo ""
echo "Options:"
echo " --arch <Architecture> Target Architecture (amd64, x86, arm)"
echo " --rid <Runtime Identifier> Target Runtime Identifier"
echo " --fxrver <HostFxr version> Version of the hostfxr library"
echo " --policyver <HostPolicy version> Version of the hostpolicy library"
echo " --commithash <Git commit hash> Current commit hash of the repo at build time"
echo " --xcompiler <Cross C++ Compiler> Cross Compiler when the target is arm"
@ -53,6 +54,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
__build_arch=
__runtime_id=
__policy_ver=
__fxr_ver=
__CrossBuild=0
__commit_hash=
@ -71,6 +73,10 @@ while [ "$1" != "" ]; do
shift
__runtime_id=$1
;;
--fxrver)
shift
__fxr_ver=$1
;;
--policyver)
shift
__policy_ver=$1
@ -133,9 +139,9 @@ __base_rid=$__rid_plat-$__build_arch_lowcase
echo "Building Corehost from $DIR to $(pwd)"
set -x # turn on trace
if [ $__CrossBuild == 1 ]; then
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCMAKE_CXX_COMPILER="$__CrossCompiler" -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash -DCMAKE_CXX_COMPILER="$__CrossCompiler"
else
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash
fi
set +x # turn off trace
make

View file

@ -15,6 +15,8 @@
#include "deps_format.h"
static const pal::char_t* s_dotnet_sdk_download_url = _X("http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409");
/**
* When the framework is not found, display detailed error message
* about available frameworks and installation of new framework.
@ -556,7 +558,29 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, pal::stri
int muxer_usage()
{
trace::error(_X("Usage: dotnet [--help | app.dll]"));
trace::println();
trace::println(_X("Microsoft .NET Core Shared Framework Host"));
trace::println();
trace::println(_X(" Version : %s"), _STRINGIFY(HOST_FXR_PKG_VER));
trace::println(_X(" Build : %s"), _STRINGIFY(REPO_COMMIT_HASH));
trace::println();
trace::println(_X("Usage: dotnet [common-options] [[options] path-to-application]"));
trace::println();
trace::println(_X("Common Options:"));
trace::println(_X(" --help Display .NET Core Shared Framework Host help."));
trace::println(_X(" --version Display .NET Core Shared Framework Host version."));
trace::println();
trace::println(_X("Options:"));
trace::println(_X(" --additionalprobingpath <path> Path containing probing policy and assemblies to probe for."));
trace::println();
trace::println(_X("Path to Application:"));
trace::println(_X(" The path to a .NET Core managed application, dll or exe file to execute."));
trace::println();
trace::println(_X("If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment."));
trace::println();
trace::println(_X("To get started on developing applications for .NET Core, install .NET SDK from:"));
trace::println(_X(" %s"), s_dotnet_sdk_download_url);
return StatusCode::InvalidArgFailure;
}
@ -778,7 +802,16 @@ int fx_muxer_t::execute(const int argc, const pal::char_t* argv[])
pal::string_t sdk_dotnet;
if (!resolve_sdk_dotnet_path(own_dir, &sdk_dotnet))
{
trace::error(_X("Did not find a suitable dotnet SDK at '%s'. Install dotnet SDK from https://github.com/dotnet/cli"), own_dir.c_str());
assert(argc > 1);
if (pal::strcasecmp(_X("--help"), argv[1]) == 0 ||
pal::strcasecmp(_X("--version"), argv[1]) == 0 ||
pal::strcasecmp(_X("-h"), argv[1]) == 0 ||
pal::strcasecmp(_X("-v"), argv[1]) == 0)
{
return muxer_usage();
}
trace::error(_X("Did you mean to run dotnet SDK commands? Please install dotnet SDK from: "));
trace::error(_X(" %s"), s_dotnet_sdk_download_url);
return StatusCode::LibHostSdkFindFailure;
}
append_path(&sdk_dotnet, _X("dotnet.dll"));

View file

@ -70,6 +70,12 @@ else()
add_definitions(-DHOST_POLICY_PKG_VER="${CLI_CMAKE_HOST_POLICY_VER}")
endif()
if("${CLI_CMAKE_HOST_FXR_VER}" STREQUAL "")
message(FATAL_ERROR "Host FXR version is not specified")
else()
add_definitions(-DHOST_FXR_PKG_VER="${CLI_CMAKE_HOST_FXR_VER}")
endif()
if("${CLI_CMAKE_PKG_RID}" STREQUAL "")
message(FATAL_ERROR "A minimum supported package rid is not specified (ex: win7-x86 or ubuntu.14.04-x64, osx.10.10-x64, rhel.7-x64)")
else()

View file

@ -116,6 +116,7 @@ namespace pal
inline size_t strlen(const char_t* str) { return ::wcslen(str); }
inline void err_vprintf(const char_t* format, va_list vl) { ::vfwprintf(stderr, format, vl); ::fputws(_X("\r\n"), stderr); }
inline void out_vprintf(const char_t* format, va_list vl) { ::vfwprintf(stdout, format, vl); ::fputws(_X("\r\n"), stdout); }
bool utf8_palstring(const std::string& str, pal::string_t* out);
bool pal_clrstring(const pal::string_t& str, std::vector<char>* out);
@ -158,6 +159,7 @@ namespace pal
inline size_t strlen(const char_t* str) { return ::strlen(str); }
inline void err_vprintf(const char_t* format, va_list vl) { ::vfprintf(stderr, format, vl); ::fputc('\n', stderr); }
inline void out_vprintf(const char_t* format, va_list vl) { ::vfprintf(stdout, format, vl); ::fputc('\n', stdout); }
inline bool utf8_palstring(const std::string& str, pal::string_t* out) { out->assign(str); return true; }
inline bool pal_clrstring(const pal::string_t& str, std::vector<char>* out) { out->assign(str.begin(), str.end()); out->push_back('\0'); return true; }
inline bool clr_palstring(const char* cstr, pal::string_t* out) { out->assign(cstr); return true; }

View file

@ -66,6 +66,19 @@ void trace::error(const pal::char_t* format, ...)
va_end(args);
}
void trace::println(const pal::char_t* format, ...)
{
va_list args;
va_start(args, format);
pal::out_vprintf(format, args);
va_end(args);
}
void trace::println()
{
println(_X(""));
}
void trace::warning(const pal::char_t* format, ...)
{
if (g_enabled)

View file

@ -15,6 +15,8 @@ namespace trace
void info(const pal::char_t* format, ...);
void warning(const pal::char_t* format, ...);
void error(const pal::char_t* format, ...);
void println(const pal::char_t* format, ...);
void println();
};
#endif // TRACE_H