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

View file

@ -16,10 +16,10 @@ namespace Microsoft.DotNet.Cli.Utils
public static readonly string BinDirectoryName = "bin";
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";
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";
}

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 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 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(() =>
{
@ -43,7 +43,6 @@ namespace Microsoft.DotNet.Tools.Compiler
var buildProjectReferences = !noProjectDependencies.HasValue();
var isNative = native.HasValue();
// Load project contexts for each framework and compile them
bool success = true;
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){
string outputPath = GetOutputPath(context, configuration, outputOptionValue);
private static bool CompileNative(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences, string nativeOptionValue)
{
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 managedBinaryPath = Path.Combine(outputPath, context.ProjectFile.Name + (compilationOptions.EmitEntryPoint.GetValueOrDefault() ? ".exe" : ".dll"));
@ -100,7 +102,6 @@ namespace Microsoft.DotNet.Tools.Compiler
.Execute();
return result.ExitCode == 0;
}
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)
{
var outputPath = String.Empty;
var outputPath = string.Empty;
if (string.IsNullOrEmpty(outputOptionValue))
{
@ -269,8 +269,6 @@ namespace Microsoft.DotNet.Tools.Compiler
Constants.ObjDirectoryName,
configuration,
context.TargetFramework.GetTwoDigitShortFolderName());
}
private static string GetIntermediateOutputPath(ProjectContext context, string configuration, string outputOptionValue)