package up DNX in the tar.gz

includes a smoke test for verifying that the output can be used to build
also includes a checked-in CoreCLR in order to work around CoreCLR issue
This commit is contained in:
Andrew Stanton-Nurse 2015-10-21 15:21:14 -07:00
parent 94bafb17a3
commit 1d76b2846c
45 changed files with 347 additions and 179 deletions

View file

@ -1,4 +1,3 @@
@echo off
setlocal EnableDelayedExpansion
where dnvm
@ -10,8 +9,10 @@ if %ERRORLEVEL% neq 0 (
)
:continue
echo *** Building dotnet ***
call %~dp0scripts/bootstrap.cmd
if %errorlevel% neq 0 exit /b %errorlevel%
echo *** Packaging dotnet ***
call %~dp0scripts/package.cmd
if %errorlevel% neq 0 exit /b %errorlevel%

View file

@ -2,6 +2,8 @@
#
# $1 is passed to package to enable deb or pkg packaging
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@ -11,5 +13,4 @@ done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
$DIR/scripts/bootstrap.sh
$DIR/scripts/package.sh $1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ext/CoreCLR/osx.10.10-x64/corerun Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -11,10 +11,12 @@ set REPOROOT=%CD%
popd
set RID=win7-x64
set TFM=dnxcore50
set DNX_DIR=%REPOROOT%\artifacts\%RID%\dnx
set STAGE0_DIR=%REPOROOT%\artifacts\%RID%\stage0
set STAGE1_DIR=%REPOROOT%\artifacts\%RID%\stage1
set STAGE2_DIR=%REPOROOT%\artifacts\%RID%\stage2
set START_PATH=%PATH%
where dnvm >nul 2>nul
if %errorlevel% == 0 goto have_dnvm
@ -29,6 +31,10 @@ set DNX_GLOBAL_HOME=%DNX_DIR%
echo Installing and use-ing the latest CoreCLR x64 DNX ...
call dnvm install -nonative -u latest -r coreclr -arch x64 -alias dotnet_bootstrap
pushd "%DNX_DIR%"
cd "runtimes\dnx-*"
set DNX_ROOT=%CD%\bin
popd
if errorlevel 1 goto fail
call dnvm use dotnet_bootstrap -r coreclr -arch x64
@ -50,57 +56,83 @@ call %~dp0dnvm2 upgrade
if errorlevel 1 goto fail
echo Building stage1 dotnet.exe ...
dotnet-publish --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
dotnet-publish --framework %TFM% --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
if errorlevel 1 goto fail
echo Building stage1 dotnet-compile.exe ...
dotnet-publish --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
dotnet-publish --framework %TFM% --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
if errorlevel 1 goto fail
echo Building stage1 dotnet-compile-csc.exe ...
dotnet-publish --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
dotnet-publish --framework %TFM% --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
if errorlevel 1 goto fail
echo Building stage1 dotnet-publish.exe ...
dotnet-publish --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
dotnet-publish --framework %TFM% --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
if errorlevel 1 goto fail
echo Building stage1 dotnet-publish.exe ...
dotnet-publish --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
dotnet-publish --framework %TFM% --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
if errorlevel 1 goto fail
echo Re-building dotnet tools with the bootstrapped version
REM This should move into a proper build script of some kind once we are bootstrapped
set PATH=%STAGE1_DIR%;%PATH%
set PATH=%STAGE1_DIR%;%START_PATH%
if exist %STAGE2_DIR% rd /s /q %STAGE2_DIR%
echo Building stage2 dotnet.exe ...
dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
dotnet publish --framework %TFM% --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
if errorlevel 1 goto fail
echo Building stage2 dotnet-compile.exe ...
dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
dotnet publish --framework %TFM% --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
if errorlevel 1 goto fail
echo Building stage2 dotnet-compile-csc.exe ...
dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
dotnet publish --framework %TFM% --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
if errorlevel 1 goto fail
echo Building stage2 dotnet-publish.exe ...
dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
dotnet publish --framework %TFM% --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
if errorlevel 1 goto fail
echo Building stage2 dotnet-publish.exe ...
dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
dotnet publish --framework %TFM% --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
if errorlevel 1 goto fail
REM Copy DNX in to stage2
xcopy /s /q %DNX_ROOT% %STAGE2_DIR%\dnx\
REM Clean up some things we don't need
rd /s /q %STAGE2_DIR%\dnx\lib\Microsoft.Dnx.DesignTimeHost
rd /s /q %STAGE2_DIR%\dnx\lib\Microsoft.Dnx.Project
del %STAGE2_DIR%\dnx\dnu.cmd
REM Copy and CHMOD the dotnet-restore script
copy %~dp0dotnet-restore.cmd %STAGE2_DIR%\dotnet-restore.cmd
# Smoke-test the output
set PATH=%STAGE2_DIR%;%START_PATH%
del "%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"
"%REPOROOT%/artifacts/%RID%/smoketest/TestApp"
if errorlevel 1 goto fail
REM Check that a compiler error is reported
dotnet compile "%REPOROOT%\test\compile\failing\SimpleCompilerError" --framework "%TFM%"
if %errorlevel% == 0 goto fail
echo Bootstrapped dotnet to %STAGE2_DIR%
goto end
:fail
echo Bootstrapping failed...
echo Bootstrapping failed
exit /B 1
:end
exit /B 0

View file

@ -1,5 +1,12 @@
#!/usr/bin/env bash
set -e
[ -z "$CONFIGURATION" ] && CONFIGURATION=Debug
# TODO: Replace this with a dotnet generation
TFM=dnxcore50
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@ -9,6 +16,8 @@ done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/.." && pwd )"
START_PATH=$PATH
echo "Bootstrapping dotnet.exe using DNX"
if [ -z "$RID" ]; then
@ -37,71 +46,92 @@ echo "Installing stage0"
# Use a sub-shell to ensure the DNVM gets cleaned up
mkdir -p $STAGE0_DIR
$DIR/install-stage0.sh $STAGE0_DIR $DIR/dnvm2.sh
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
export PATH=$STAGE0_DIR/bin:$PATH
export DOTNET_CLR_HOSTS_PATH=$REPOROOT/ext/CLRHost/$RID
echo "Installing and use-ing the latest CoreCLR x64 DNX ..."
mkdir -p $DNX_DIR
if ! type dnx > /dev/null 2>&1; then
echo "Installing and use-ing the latest CoreCLR x64 DNX ..."
mkdir -p $DNX_DIR
export DNX_HOME=$DNX_DIR
export DNX_USER_HOME=$DNX_DIR
export DNX_GLOBAL_HOME=$DNX_DIR
export DNX_HOME=$DNX_DIR
export DNX_USER_HOME=$DNX_DIR
export DNX_GLOBAL_HOME=$DNX_DIR
if ! type dnvm > /dev/null 2>&1; then
curl -o $DNX_DIR/dnvm.sh https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh
source $DNX_DIR/dnvm.sh
fi
dnvm install latest -u -r coreclr
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
# Make sure we got a DNX
if ! type dnx > /dev/null 2>&1; then
echo "DNX is required to bootstrap stage1" 1>&2
exit 1
fi
if ! type dnvm > /dev/null 2>&1; then
curl -o $DNX_DIR/dnvm.sh https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh
source $DNX_DIR/dnvm.sh
fi
dnvm install latest -u -r coreclr
# Make sure we got a DNX
if ! type dnx > /dev/null 2>&1; then
echo "DNX is required to bootstrap stage1" 1>&2
exit 1
fi
DNX_ROOT=$(dirname $(which dnx))
echo "Running 'dnu restore' to restore packages"
dnu restore "$REPOROOT" --runtime osx.10.10-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.11-x64
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
# Clean up stage1
[ -d "$STAGE1_DIR" ] && rm -Rf "$STAGE1_DIR"
echo "Building basic dotnet tools using Stage 0"
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE1_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Cli"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE1_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE1_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE1_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE1_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
# Update stage1 with the checked-in CoreCLR
cp $REPOROOT/ext/CoreCLR/$RID/* $STAGE1_DIR
# Add stage1 to the path and use it to build stage2
export PATH=$STAGE1_DIR:$PATH
export PATH=$STAGE1_DIR:$START_PATH
# Make corerun explicitly executable
chmod a+x $STAGE1_DIR/corerun
echo "Building stage2 dotnet using stage1 ..."
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE2_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Cli"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE2_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE2_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE2_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
dotnet publish --framework "$TFM" --runtime $RID --output "$STAGE2_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
# Make Stage 2 Folder Accessible
chmod -R a+r $REPOROOT
chmod -R a+r $REPOROOT
# Copy DNX in to stage2
cp -R $DNX_ROOT $STAGE2_DIR/dnx
# Clean up some things we don't need
rm -Rf $STAGE2_DIR/dnx/lib/Microsoft.Dnx.DesignTimeHost
rm -Rf $STAGE2_DIR/dnx/lib/Microsoft.Dnx.Project
rm $STAGE2_DIR/dnx/dnu
# Copy and CHMOD the dotnet-restore script
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
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)
# Check that a compiler error is reported
set +e
dotnet compile "$REPOROOT/test/compile/failing/SimpleCompilerError" --framework "$TFM"
rc=$?
if [ $rc == 0 ]; then
echo "Compiler failure test failed! The compiler did not fail to compile!"
exit 1
fi
set -e

View file

@ -1,6 +1,23 @@
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Some things depend on HOME and it may not be set. We should fix those things, but until then, we just patch a value in
if [ -z "$HOME" ]; then
export HOME=$SCRIPT_DIR/../artifacts/home
[ ! -d "$HOME" ] || rm -Rf $HOME
mkdir -p $HOME
fi
# Set the build number using CI build number
BASE_VERSION=0.0.2-alpha1
if [ ! -z "$BUILD_NUMBER" ]; then
export DOTNET_BUILD_VERSION="$BASE_VERSION-$(printf "%05d" $BUILD_NUMBER)"
echo "Building version $DOTNET_BUILD_VERSION"
fi
if [[ "$(uname)" == "Linux" ]]; then
# Set Docker Container name to be unique
container_name=""
@ -16,7 +33,3 @@ if [[ "$(uname)" == "Linux" ]]; then
else
$SCRIPT_DIR/../build.sh $@
fi
ret_code=$?
exit $ret_code

View file

@ -26,5 +26,3 @@ docker run --rm --sig-proxy=true \
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
-e DOTNET_BUILD_VERSION=$DOTNET_BUILD_VERSION \
$DOTNET_BUILD_CONTAINER_TAG $BUILD_COMMAND $1

View file

@ -0,0 +1,8 @@
@Echo OFF
SETLOCAL
SET ERRORLEVEL=
"%~dp0dnx\dnx" "%~dp0dnx\lib\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll" restore %*
exit /b %ERRORLEVEL%
ENDLOCAL

15
scripts/dotnet-restore.sh Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# dotnet-restore script to be copied across to the final package
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# work around restore timeouts on Mono
[ -z "$MONO_THREADS_PER_CPU" ] && export MONO_THREADS_PER_CPU=50
exec "$DIR/dnx/dnx" "$DIR/dnx/lib/Microsoft.Dnx.Tooling/Microsoft.Dnx.Tooling.dll" "restore" "$@"

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -142,7 +142,7 @@ namespace Microsoft.DotNet.Cli.Utils
var message = $"< {FormatProcessInfo(_process.StartInfo)} exited with {exitCode} in {sw.ElapsedMilliseconds} ms.";
if (exitCode == 0)
{
Reporter.Output.WriteLine(message.Green().Bold());
Reporter.Output.WriteLine(message.Green());
}
else
{

View file

@ -16,7 +16,6 @@ namespace Microsoft.DotNet.Cli.Utils
public static readonly string BinDirectoryName = "bin";
public static readonly string ObjDirectoryName = "obj";
public static readonly string HostsPathEnvironmentVariable = "DOTNET_CLR_HOSTS_PATH";
public static readonly string CSCPathEnvironmentVariable = "DOTNET_CSC_PATH";
public static readonly string ClrPathEnvironmentVariable = "DOTNET_CLR_PATH";
}
}

View file

@ -4,10 +4,10 @@
"shared": "**/*.cs",
"dependencies": {
"System.Console": "4.0.0-beta-23419",
"System.IO.FileSystem": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-beta-23419"
"System.Console": "4.0.0-beta-23420",
"System.IO.FileSystem": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-beta-23420"
},
"frameworks": {
"dnxcore50": { }

View file

@ -8,12 +8,12 @@
"dotnet": "Microsoft.DotNet.Cli"
},
"dependencies": {
"Microsoft.NETCore.Runtime": "1.0.1-beta-23419",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23420",
"System.Console": "4.0.0-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.Console": "4.0.0-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"Microsoft.DotNet.Cli.Utils": {
"type": "build",
"version": "1.0.0-*"
@ -26,4 +26,4 @@
"frameworks": {
"dnxcore50": { }
}
}
}

View file

@ -8,14 +8,14 @@
"dotnet-compile-csc": "Microsoft.DotNet.Tools.Compiler.Csc"
},
"dependencies": {
"Microsoft.NETCore.TestHost": "1.0.0-beta-23419",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23419",
"Microsoft.NETCore.TestHost": "1.0.0-beta-23420",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23420",
"System.Console": "4.0.0-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.IO.FileSystem": "4.0.1-beta-23419",
"System.Console": "4.0.0-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"System.IO.FileSystem": "4.0.1-beta-23420",
"Microsoft.Extensions.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": {
"type": "build",

View file

@ -84,8 +84,6 @@ namespace Microsoft.DotNet.Tools.Compiler
var diagnostics = new List<DiagnosticMessage>();
bool success = true;
// Collect dependency diagnostics
diagnostics.AddRange(context.LibraryManager.GetAllDiagnostics());
@ -145,16 +143,19 @@ namespace Microsoft.DotNet.Tools.Compiler
configuration,
context.TargetFramework.GetTwoDigitShortFolderName());
if (!Directory.Exists(outputPath))
if (Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
Directory.Delete(outputPath, recursive: true);
}
if (!Directory.Exists(intermediateOutputPath))
if (Directory.Exists(intermediateOutputPath))
{
Directory.CreateDirectory(intermediateOutputPath);
Directory.Delete(intermediateOutputPath, recursive: true);
}
Directory.CreateDirectory(outputPath);
Directory.CreateDirectory(intermediateOutputPath);
// Get compilation options
var compilationOptions = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration);
var outputName = Path.Combine(outputPath, context.ProjectFile.Name + (compilationOptions.EmitEntryPoint.GetValueOrDefault() ? ".exe" : ".dll"));
@ -227,18 +228,17 @@ namespace Microsoft.DotNet.Tools.Compiler
foreach (var diag in diagnostics)
{
success &= diag.Severity != DiagnosticMessageSeverity.Error;
PrintDiagnostic(diag);
}
success &= result.ExitCode == 0;
PrintSummary(diagnostics);
var success = result.ExitCode == 0;
PrintSummary(success, diagnostics);
return success;
}
private static void PrintSummary(List<DiagnosticMessage> diagnostics)
private static void PrintSummary(bool success, List<DiagnosticMessage> diagnostics)
{
Reporter.Output.Writer.WriteLine();

View file

@ -8,14 +8,13 @@
"dotnet-compile": "Microsoft.DotNet.Tools.Compiler"
},
"dependencies": {
"Microsoft.NETCore.TestHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23413",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23420",
"System.Console": "4.0.0-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.IO.FileSystem": "4.0.1-beta-23419",
"System.Console": "4.0.0-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"System.IO.FileSystem": "4.0.1-beta-23420",
"Microsoft.Extensions.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": {
"type": "build",

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.ProjectModel;
@ -11,6 +12,8 @@ namespace Microsoft.DotNet.Tools.Publish
{
public class Program
{
public static readonly IEnumerable<string> CoreCLRFileNames = GetCoreCLRFileNames();
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
@ -113,7 +116,7 @@ namespace Microsoft.DotNet.Tools.Publish
}
// Compile the project (and transitively, all it's dependencies)
var result = Command.Create("dotnet-compile", $"--framework {context.TargetFramework.DotNetFrameworkName} \"{context.ProjectFile.ProjectDirectory}\"")
var result = Command.Create("dotnet-compile", $"--framework \"{context.TargetFramework.DotNetFrameworkName}\" --configuration \"{configuration}\" \"{context.ProjectFile.ProjectDirectory}\"")
.ForwardStdErr()
.ForwardStdOut()
.Execute();
@ -138,7 +141,6 @@ namespace Microsoft.DotNet.Tools.Publish
PublishFiles(export.NativeLibraries, outputPath);
}
// Publishing for windows, TODO(anurse): Publish for Mac/Linux/etc.
int exitCode;
if (context.RuntimeIdentifier.StartsWith("win"))
{
@ -155,30 +157,9 @@ namespace Microsoft.DotNet.Tools.Publish
private static int PublishForUnix(ProjectContext context, string outputPath)
{
// Locate Hosts
string hostsPath = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable);
if (string.IsNullOrEmpty(hostsPath))
{
hostsPath = AppContext.BaseDirectory;
}
var coreConsole = Path.Combine(hostsPath, Constants.CoreConsoleName);
if (!File.Exists(coreConsole))
{
Reporter.Error.WriteLine($"Unable to locate {Constants.CoreConsoleName} in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold());
return 1;
}
var coreRun = Path.Combine(hostsPath, Constants.CoreRunName);
if (!File.Exists(coreRun))
{
Reporter.Error.WriteLine($"Unable to locate {Constants.CoreRunName} in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold());
return 1;
}
// TEMPORARILY bring CoreConsole and CoreRun along for the ride on it's own (without renaming)
File.Copy(coreConsole, Path.Combine(outputPath, Constants.CoreConsoleName), overwrite: true);
File.Copy(coreRun, Path.Combine(outputPath, Constants.CoreRunName), overwrite: true);
CopyCoreCLR(outputPath);
var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName);
var coreRun = Path.Combine(outputPath, Constants.CoreRunName);
// Use the 'command' field to generate the name
var outputExe = Path.Combine(outputPath, context.ProjectFile.Name);
@ -211,30 +192,10 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
{
return 0;
}
// Locate Hosts
string hostsPath = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable);
if (string.IsNullOrEmpty(hostsPath))
{
hostsPath = AppContext.BaseDirectory;
}
var coreConsole = Path.Combine(hostsPath, Constants.CoreConsoleName);
if (!File.Exists(coreConsole))
{
Reporter.Error.WriteLine($"Unable to locate {Constants.CoreConsoleName} in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold());
return 1;
}
var coreRun = Path.Combine(hostsPath, Constants.CoreRunName);
if (!File.Exists(coreRun))
{
Reporter.Error.WriteLine($"Unable to locate {Constants.CoreRunName} in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold());
return 1;
}
// TEMPORARILY bring CoreConsole and CoreRun along for the ride on it's own (without renaming)
File.Copy(coreConsole, Path.Combine(outputPath, Constants.CoreConsoleName), overwrite: true);
File.Copy(coreRun, Path.Combine(outputPath, Constants.CoreRunName), overwrite: true);
CopyCoreCLR(outputPath);
var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName);
var coreRun = Path.Combine(outputPath, Constants.CoreRunName);
var outputExe = Path.Combine(outputPath, context.ProjectFile.Name + Constants.ExeSuffix);
@ -246,6 +207,17 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
return 0;
}
private static void CopyCoreCLR(string outputPath)
{
// TEMPORARILY bring checked-in CoreCLR stuff along for the ride.
var clrPath = AppContext.BaseDirectory;
foreach(var file in CoreCLRFileNames)
{
File.Copy(Path.Combine(clrPath, file), Path.Combine(outputPath, file), overwrite: true);
}
}
private static void CopyContents(ProjectContext context, string outputPath)
{
var sourceFiles = context.ProjectFile.Files.GetFilesForBundling();
@ -317,5 +289,32 @@ exec ""$DIR/corerun"" ""$DIR/{context.ProjectFile.Name}.exe"" $*
File.Copy(file, Path.Combine(outputPath, Path.GetFileName(file)), overwrite: true);
}
}
private static IEnumerable<string> GetCoreCLRFileNames()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
yield return "coreclr.dll";
yield return "CoreConsole.exe";
yield return "CoreRun.exe";
yield return "mscorlib.ni.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
yield return "libcoreclr.dylib";
yield return "coreconsole";
yield return "corerun";
yield return "mscorlib.dll";
yield return "System.Globalization.Native.dylib";
}
else
{
yield return "libcoreclr.so";
yield return "coreconsole";
yield return "corerun";
yield return "mscorlib.dll";
yield return "System.Globalization.Native.so";
}
}
}
}

View file

@ -8,12 +8,12 @@
"dotnet-publish": "Microsoft.DotNet.Tools.Publish"
},
"dependencies": {
"Microsoft.NETCore.Runtime": "1.0.1-beta-23419",
"System.Console": "4.0.0-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.IO.FileSystem": "4.0.1-beta-23419",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23420",
"System.Console": "4.0.0-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"System.IO.FileSystem": "4.0.1-beta-23420",
"Microsoft.Extensions.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": {
"type": "build",
@ -23,7 +23,7 @@
"type": "build",
"version": "1.0.0-rc1-15838"
},
"System.AppContext": "4.0.1-beta-23419"
"System.AppContext": "4.0.1-beta-23420"
},
"frameworks": {
"dnxcore50": { }

View file

@ -8,13 +8,13 @@
"resgen": "Microsoft.DotNet.Tools.Resgen"
},
"dependencies": {
"Microsoft.NETCore.TestHost": "1.0.0-beta-23419",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23419",
"System.Console": "4.0.0-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Diagnostics.Process": "4.1.0-beta-23419",
"System.IO.FileSystem": "4.0.1-beta-23419",
"Microsoft.NETCore.TestHost": "1.0.0-beta-23420",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23420",
"System.Console": "4.0.0-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420",
"System.IO.FileSystem": "4.0.1-beta-23420",
"Microsoft.DotNet.Cli.Utils": {
"type": "build",
"version": "1.0.0-*"
@ -23,8 +23,8 @@
"type": "build",
"version": "1.0.0-rc1-15838"
},
"System.Xml.XDocument": "4.0.11-beta-23419",
"System.Resources.ReaderWriter": "4.0.0-beta-23419"
"System.Xml.XDocument": "4.0.11-beta-23420",
"System.Resources.ReaderWriter": "4.0.0-beta-23420"
},
"frameworks": {
"dnxcore50": { }

View file

@ -2,18 +2,18 @@
"version": "1.0.0-*",
"description": "Types to model a .NET Project",
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23419",
"System.Collections": "4.0.11-beta-23419",
"System.Linq": "4.0.1-beta-23419",
"System.Threading.Thread": "4.0.0-beta-23419",
"System.Runtime.Loader": "4.0.0-beta-23419",
"System.Dynamic.Runtime": "4.0.11-beta-23419",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-beta-23419",
"Microsoft.CSharp": "4.0.1-beta-23420",
"System.Collections": "4.0.11-beta-23420",
"System.Linq": "4.0.1-beta-23420",
"System.Threading.Thread": "4.0.0-beta-23420",
"System.Runtime.Loader": "4.0.0-beta-23420",
"System.Dynamic.Runtime": "4.0.11-beta-23420",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-beta-23420",
"System.Security.Cryptography.Algorithms": "4.0.0-beta-23420",
"NuGet.Packaging": "3.2.0",
"System.Security.Cryptography.Algorithms": "4.0.0-beta-23401",
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-beta-23419",
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-beta8-*",
"Microsoft.Extensions.JsonParser.Sources": {
"type": "build",
"version": "1.0.0-rc1-15792"

40
src/clrhost/tpafile.h Normal file
View file

@ -0,0 +1,40 @@
#ifndef TPAFILE_H
#define TPAFILE_H
#include <vector>
#include "pal.h"
struct tpaentry_t
{
pal::string_t asset_type;
pal::string_t library_name;
pal::string_t library_version;
pal::string_t library_hash;
pal::string_t relative_path;
pal::string_t absolute_path;
pal::string_t asset_name;
};
class tpafile
{
public:
static std::pair<bool, tpafile> load(pal::string_t path);
inline const std::vector<tpaentry_t>& entries() { return m_entries; }
inline bool present() { return m_present; }
void add_from(const pal::string_t& dir);
void write_tpa_list(pal::string_t& output);
void write_native_paths(std::string& output);
void set_package_paths(std::vector<pal::string_t> search_paths) { m_package_search_paths = search_paths; }
private:
tpafile(bool present, std::vector<tpaentry_t> entries) : m_present(present), m_entries(entries) {}
bool m_present;
std::vector<tpaentry_t> m_entries;
std::vector<pal::string_t> m_package_search_paths;
};
#endif // TPAFILE_H

View file

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
namespace TestApp
{

View file

@ -5,9 +5,11 @@
},
"dependencies": {
"Microsoft.NETCore.ConsoleHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.0-*",
"System.Console": "4.0.0-beta-23109"
"Microsoft.NETCore.Runtime": "1.0.1-*",
"System.IO": "4.0.10-beta-23420",
"System.Console": "4.0.0-beta-23420",
"System.Runtime": "4.0.20-beta-23420",
"System.Diagnostics.Process": "4.1.0-beta-23420"
},
"frameworks": {

View file

@ -0,0 +1,12 @@
using System;
namespace TestApp
{
public class Program
{
public static void Main(string[] args)
{
this will not compile!
}
}
}

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.ConsoleHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.1-*",
"System.Console": "4.0.0-beta-23109"
},
"frameworks": {
"dnxcore50": { }
}
}