clean things up

This commit is contained in:
Bryan Thornbury 2015-10-30 14:48:09 -07:00
parent 8d4afc5617
commit 822f8100a9
3 changed files with 25 additions and 27 deletions

View file

@ -119,21 +119,21 @@ cp $DIR/dotnet-restore.sh $STAGE2_DIR/dotnet-restore
chmod a+x $STAGE2_DIR/dotnet-restore chmod a+x $STAGE2_DIR/dotnet-restore
# Smoke-test the output # Smoke-test the output
# export PATH=$STAGE2_DIR:$START_PATH export PATH=$STAGE2_DIR:$START_PATH
# rm "$REPOROOT/test/TestApp/project.lock.json" rm "$REPOROOT/test/TestApp/project.lock.json"
# dotnet restore "$REPOROOT/test/TestApp" --runtime "$RID" dotnet restore "$REPOROOT/test/TestApp" --runtime "$RID"
# dotnet publish "$REPOROOT/test/TestApp" --framework "$TFM" --runtime "$RID" --output "$REPOROOT/artifacts/$RID/smoketest" dotnet publish "$REPOROOT/test/TestApp" --framework "$TFM" --runtime "$RID" --output "$REPOROOT/artifacts/$RID/smoketest"
# OUTPUT=$($REPOROOT/artifacts/$RID/smoketest/TestApp) OUTPUT=$($REPOROOT/artifacts/$RID/smoketest/TestApp)
# [ "$OUTPUT" == "This is a test app" ] || (echo "Smoke test failed!" && exit 1) [ "$OUTPUT" == "This is a test app" ] || (echo "Smoke test failed!" && exit 1)
# # Check that a compiler error is reported # Check that a compiler error is reported
# set +e set +e
# dotnet compile "$REPOROOT/test/compile/failing/SimpleCompilerError" --framework "$TFM" 2>/dev/null >/dev/null dotnet compile "$REPOROOT/test/compile/failing/SimpleCompilerError" --framework "$TFM" 2>/dev/null >/dev/null
# rc=$? rc=$?
# if [ $rc == 0 ]; then if [ $rc == 0 ]; then
# echo "Compiler failure test failed! The compiler did not fail to compile!" echo "Compiler failure test failed! The compiler did not fail to compile!"
# exit 1 exit 1
# fi fi
# set -e set -e

View file

@ -16,10 +16,10 @@ namespace Microsoft.DotNet.Cli.Utils
public static readonly string BinDirectoryName = "bin"; public static readonly string BinDirectoryName = "bin";
public static readonly string ObjDirectoryName = "obj"; public static readonly string ObjDirectoryName = "obj";
public static readonly string DynlibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".dll" : public static readonly string DynamicLibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".dll" :
RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib" : ".so"; RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib" : ".so";
public static readonly string StaticlibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".lib" : ".a" ; public static readonly string StaticLibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".lib" : ".a" ;
public static readonly string ClrPathEnvironmentVariable = "DOTNET_CLR_PATH"; public static readonly string ClrPathEnvironmentVariable = "DOTNET_CLR_PATH";
} }

View file

@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Tools.Compiler
var configuration = app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue); var configuration = app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue);
var noProjectDependencies = app.Option("--no-project-dependencies", "Skips building project references.", CommandOptionType.NoValue); var noProjectDependencies = app.Option("--no-project-dependencies", "Skips building project references.", CommandOptionType.NoValue);
var project = app.Argument("<PROJECT>", "The project to compile, defaults to the current directory. Can be a path to a project.json or a project directory"); var project = app.Argument("<PROJECT>", "The project to compile, defaults to the current directory. Can be a path to a project.json or a project directory");
var native = app.Option("-n|--native <NATIVE_TYPE>", "Compiles source to native machine code.", CommandOptionType.SingleValue); var native = app.Option("-n|--native <NATIVE_TYPE>", "Compiles source to native machine code.", CommandOptionType.NoValue);
app.OnExecute(() => app.OnExecute(() =>
{ {
@ -43,7 +43,6 @@ namespace Microsoft.DotNet.Tools.Compiler
var buildProjectReferences = !noProjectDependencies.HasValue(); var buildProjectReferences = !noProjectDependencies.HasValue();
var isNative = native.HasValue(); var isNative = native.HasValue();
// Load project contexts for each framework and compile them // Load project contexts for each framework and compile them
bool success = true; bool success = true;
if (framework.HasValue()) if (framework.HasValue())
@ -88,8 +87,11 @@ namespace Microsoft.DotNet.Tools.Compiler
} }
} }
private static bool CompileNative(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences, string nativeOptionValue){ private static bool CompileNative(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences, string nativeOptionValue)
string outputPath = GetOutputPath(context, configuration, outputOptionValue); {
string outputPath = Path.Combine(GetOutputPath(context, configuration, outputOptionValue), "native");
string outputName = Path.Combine(outputPath, Constants.ExeSuffix);
var compilationOptions = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration); var compilationOptions = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration);
var managedBinaryPath = Path.Combine(outputPath, context.ProjectFile.Name + (compilationOptions.EmitEntryPoint.GetValueOrDefault() ? ".exe" : ".dll")); var managedBinaryPath = Path.Combine(outputPath, context.ProjectFile.Name + (compilationOptions.EmitEntryPoint.GetValueOrDefault() ? ".exe" : ".dll"));
@ -100,7 +102,6 @@ namespace Microsoft.DotNet.Tools.Compiler
.Execute(); .Execute();
return result.ExitCode == 0; return result.ExitCode == 0;
} }
private static bool Compile(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences) private static bool Compile(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences)
@ -246,8 +247,7 @@ namespace Microsoft.DotNet.Tools.Compiler
private static string GetOutputPath(ProjectContext context, string configuration, string outputOptionValue) private static string GetOutputPath(ProjectContext context, string configuration, string outputOptionValue)
{ {
var outputPath = string.Empty;
var outputPath = String.Empty;
if (string.IsNullOrEmpty(outputOptionValue)) if (string.IsNullOrEmpty(outputOptionValue))
{ {
@ -269,8 +269,6 @@ namespace Microsoft.DotNet.Tools.Compiler
Constants.ObjDirectoryName, Constants.ObjDirectoryName,
configuration, configuration,
context.TargetFramework.GetTwoDigitShortFolderName()); context.TargetFramework.GetTwoDigitShortFolderName());
} }
private static string GetIntermediateOutputPath(ProjectContext context, string configuration, string outputOptionValue) private static string GetIntermediateOutputPath(ProjectContext context, string configuration, string outputOptionValue)