Some small tweaks to make development easier
- Added scripts directory to path when using dotnet tool - Added dotnet-compile and dotnet-restore
This commit is contained in:
parent
0ce00feacc
commit
550dd7f062
7 changed files with 49 additions and 12 deletions
|
@ -11,4 +11,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
# work around restore timeouts on Mono
|
# work around restore timeouts on Mono
|
||||||
[ -z "$MONO_THREADS_PER_CPU" ] && export MONO_THREADS_PER_CPU=50
|
[ -z "$MONO_THREADS_PER_CPU" ] && export MONO_THREADS_PER_CPU=50
|
||||||
|
|
||||||
|
# Makes development easier
|
||||||
|
export PATH=$PATH:$DIR
|
||||||
|
|
||||||
exec "dnx" -p "$DIR/../src/Microsoft.DotNet.Cli" run "$@"
|
exec "dnx" -p "$DIR/../src/Microsoft.DotNet.Cli" run "$@"
|
1
scripts/dotnet-compile
Executable file
1
scripts/dotnet-compile
Executable file
|
@ -0,0 +1 @@
|
||||||
|
exec "dnu" "build" "$@"
|
8
scripts/dotnet-compile.cmd
Normal file
8
scripts/dotnet-compile.cmd
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
@Echo OFF
|
||||||
|
SETLOCAL
|
||||||
|
SET ERRORLEVEL=
|
||||||
|
|
||||||
|
dnu build %*
|
||||||
|
|
||||||
|
exit /b %ERRORLEVEL%
|
||||||
|
ENDLOCAL
|
1
scripts/dotnet-restore
Executable file
1
scripts/dotnet-restore
Executable file
|
@ -0,0 +1 @@
|
||||||
|
exec "dnu" "restore" "$@"
|
8
scripts/dotnet-restore.cmd
Normal file
8
scripts/dotnet-restore.cmd
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
@Echo OFF
|
||||||
|
SETLOCAL
|
||||||
|
SET ERRORLEVEL=
|
||||||
|
|
||||||
|
dnu restore %*
|
||||||
|
|
||||||
|
exit /b %ERRORLEVEL%
|
||||||
|
ENDLOCAL
|
|
@ -2,6 +2,9 @@
|
||||||
SETLOCAL
|
SETLOCAL
|
||||||
SET ERRORLEVEL=
|
SET ERRORLEVEL=
|
||||||
|
|
||||||
|
REM makes testing easier for now
|
||||||
|
set PATH=%PATH%;%~dp0
|
||||||
|
|
||||||
dnx %DOTNET_OPTIONS% -p %~dp0..\src\Microsoft.DotNet.Cli run %*
|
dnx %DOTNET_OPTIONS% -p %~dp0..\src\Microsoft.DotNet.Cli run %*
|
||||||
|
|
||||||
exit /b %ERRORLEVEL%
|
exit /b %ERRORLEVEL%
|
||||||
|
|
|
@ -26,12 +26,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
{
|
{
|
||||||
c.Description = "Produce assemblies for the project in given directory";
|
c.Description = "Produce assemblies for the project in given directory";
|
||||||
|
|
||||||
c.OnExecute(() =>
|
c.OnExecute(() => Exec("dotnet-compile", c.RemainingArguments));
|
||||||
{
|
|
||||||
// Temporary!
|
|
||||||
return Exec("dnu", new[] { "build" });
|
|
||||||
// Exec("dotnet-compile", c.RemainingArguments);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.Command("restore", c =>
|
app.Command("restore", c =>
|
||||||
|
@ -55,33 +50,51 @@ namespace Microsoft.DotNet.Cli
|
||||||
c.OnExecute(() => Exec("dotnet-publish", c.RemainingArguments));
|
c.OnExecute(() => Exec("dotnet-publish", c.RemainingArguments));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: Handle unknown commands
|
||||||
|
|
||||||
app.OnExecute(() =>
|
app.OnExecute(() =>
|
||||||
{
|
{
|
||||||
app.ShowHelp();
|
app.ShowHelp();
|
||||||
return 2;
|
return 2;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try
|
||||||
return app.Execute(args);
|
{
|
||||||
|
return app.Execute(args);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Exec(string executable, IList<string> remainingArguments)
|
private static int Exec(string executable, IList<string> args)
|
||||||
{
|
{
|
||||||
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
||||||
if (!string.IsNullOrEmpty(comSpec))
|
if (!string.IsNullOrEmpty(comSpec))
|
||||||
{
|
{
|
||||||
remainingArguments =
|
args =
|
||||||
new[] { "/C", "\"", executable }
|
new[] { "/C", "\"", executable }
|
||||||
.Concat(remainingArguments)
|
.Concat(args)
|
||||||
.Concat(new[] { "\"" })
|
.Concat(new[] { "\"" })
|
||||||
.ToArray();
|
.ToArray();
|
||||||
executable = comSpec;
|
executable = comSpec;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Temporary, we're doing this so that redirecting the output works
|
||||||
|
args = new[] { "bash", "-c", "\"", executable }
|
||||||
|
.Concat(args.Select(argument => argument.Replace("\"", "\\\"")))
|
||||||
|
.Concat(new[] { "\"" })
|
||||||
|
.ToArray();
|
||||||
|
executable = "/usr/bin/env";
|
||||||
|
}
|
||||||
|
|
||||||
var psi = new ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = executable,
|
FileName = executable,
|
||||||
Arguments = string.Join(" ", remainingArguments),
|
Arguments = string.Join(" ", args),
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue