Merge pull request #347 from dotnet/anurse/157-publish-tidy-up
avoid dropping deps file when publishing
This commit is contained in:
commit
9fb5da0aee
6 changed files with 61 additions and 15 deletions
|
@ -82,6 +82,3 @@ $BinariesForCoreHost | ForEach-Object {
|
|||
mv $OutputDir\bin\$_.exe $OutputDir\bin\$_.dll
|
||||
cp $OutputDir\bin\corehost.exe $OutputDir\bin\$_.exe
|
||||
}
|
||||
|
||||
# remove any deps files that got brought along (they aren't needed because we have an app-local runtime and dependencies)
|
||||
del $OutputDir\bin\*.deps
|
||||
|
|
|
@ -84,9 +84,6 @@ do
|
|||
mv $OUTPUT_DIR/bin/${binary}.exe $OUTPUT_DIR/bin/${binary}.dll
|
||||
done
|
||||
|
||||
# remove any deps files that got brought along (they aren't needed because we have an app-local runtime and dependencies)
|
||||
rm $OUTPUT_DIR/bin/*.deps
|
||||
|
||||
cd $OUTPUT_DIR
|
||||
|
||||
# Fix up permissions. Sometimes they get dropped with the wrong info
|
||||
|
|
14
scripts/dev-dotnet.ps1
Normal file
14
scripts/dev-dotnet.ps1
Normal file
|
@ -0,0 +1,14 @@
|
|||
$oldPath = $env:PATH
|
||||
try {
|
||||
# Put the stage2 output on the front of the path
|
||||
$stage2 = "$PSScriptRoot\..\artifacts\win7-x64\stage2\bin"
|
||||
if (Test-Path $stage2) {
|
||||
$env:PATH="$stage2;$env:PATH"
|
||||
} else {
|
||||
Write-Host "You don't have a dev build in the 'artifacts\win7-x64\stage2' folder!"
|
||||
}
|
||||
|
||||
dotnet @args
|
||||
} finally {
|
||||
$env:PATH = $oldPath
|
||||
}
|
26
scripts/dev-dotnet.sh
Executable file
26
scripts/dev-dotnet.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
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 )"
|
||||
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 )"
|
||||
REPOROOT="$( cd -P "$DIR/.." && pwd )"
|
||||
|
||||
source "$DIR/_common.sh"
|
||||
|
||||
if [ -d "$STAGE2_DIR" ]; then
|
||||
PATH=$STAGE2_DIR/bin:$PATH
|
||||
dotnet "$@"
|
||||
else
|
||||
echo "You don't have a dev build!" 1>&2
|
||||
exit 1
|
||||
fi
|
|
@ -35,6 +35,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
var framework = app.Option("-f|--framework <FRAMEWORK>", "Compile a specific framework", CommandOptionType.MultipleValue);
|
||||
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 noHost = app.Option("--no-host", "Set this to skip publishing a runtime host when building for CoreCLR", 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");
|
||||
|
||||
// Native Args
|
||||
|
@ -72,7 +73,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
ProjectContext.CreateContextForEachFramework(path);
|
||||
foreach (var context in contexts)
|
||||
{
|
||||
success &= Compile(context, configValue, outputValue, intermediateOutput.Value(), buildProjectReferences);
|
||||
success &= Compile(context, configValue, outputValue, intermediateOutput.Value(), buildProjectReferences, noHost.HasValue());
|
||||
if (isNative && success)
|
||||
{
|
||||
success &= CompileNative(context, configValue, outputValue, buildProjectReferences, intermediateValue, archValue, ilcArgsValue, ilcPathValue, ilcSdkPathValue, isCppMode);
|
||||
|
@ -192,7 +193,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
private static bool Compile(ProjectContext context, string configuration, string outputOptionValue, string intermediateOutputValue, bool buildProjectReferences)
|
||||
private static bool Compile(ProjectContext context, string configuration, string outputOptionValue, string intermediateOutputValue, bool buildProjectReferences, bool noHost)
|
||||
{
|
||||
// Set up Output Paths
|
||||
string outputPath = GetOutputPath(context, configuration, outputOptionValue);
|
||||
|
@ -225,7 +226,14 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
foreach (var projectDependency in Sort(projects))
|
||||
{
|
||||
// Skip compiling project dependencies since we've already figured out the build order
|
||||
var compileResult = Command.Create("dotnet-compile", $"--framework {projectDependency.Framework} --configuration {configuration} --output \"{outputPath}\" --temp-output \"{intermediateOutputPath}\" --no-project-dependencies \"{projectDependency.Project.ProjectDirectory}\"")
|
||||
var compileResult = Command.Create("dotnet-compile",
|
||||
$"--framework {projectDependency.Framework} " +
|
||||
$"--configuration {configuration} " +
|
||||
$"--output \"{outputPath}\" " +
|
||||
$"--temp-output \"{intermediateOutputPath}\" " +
|
||||
"--no-project-dependencies " +
|
||||
(noHost ? "--no-host " : string.Empty) +
|
||||
$"\"{projectDependency.Project.ProjectDirectory}\"")
|
||||
.ForwardStdOut()
|
||||
.ForwardStdErr()
|
||||
.Execute();
|
||||
|
@ -239,10 +247,10 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
projects.Clear();
|
||||
}
|
||||
|
||||
return CompileProject(context, configuration, outputPath, intermediateOutputPath, dependencies);
|
||||
return CompileProject(context, configuration, outputPath, intermediateOutputPath, dependencies, noHost);
|
||||
}
|
||||
|
||||
private static bool CompileProject(ProjectContext context, string configuration, string outputPath, string intermediateOutputPath, List<LibraryExport> dependencies)
|
||||
private static bool CompileProject(ProjectContext context, string configuration, string outputPath, string intermediateOutputPath, List<LibraryExport> dependencies, bool noHost)
|
||||
{
|
||||
Reporter.Output.WriteLine($"Compiling {context.RootProject.Identity.Name.Yellow()} for {context.TargetFramework.DotNetFrameworkName.Yellow()}");
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
@ -372,7 +380,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
|
||||
var success = result.ExitCode == 0;
|
||||
|
||||
if (success && compilationOptions.EmitEntryPoint.GetValueOrDefault())
|
||||
if (success && !noHost && compilationOptions.EmitEntryPoint.GetValueOrDefault())
|
||||
{
|
||||
var runtimeContext = ProjectContext.Create(context.ProjectDirectory, context.TargetFramework, new[] { RuntimeIdentifier.Current });
|
||||
MakeRunnable(runtimeContext,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
using System;
|
||||
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.DotNet.ProjectModel;
|
||||
|
@ -112,7 +110,12 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
}
|
||||
|
||||
// Compile the project (and transitively, all it's dependencies)
|
||||
var result = Command.Create("dotnet-compile", $"--framework \"{context.TargetFramework.DotNetFrameworkName}\" --output \"{outputPath}\" --configuration \"{configuration}\" \"{context.ProjectFile.ProjectDirectory}\"")
|
||||
var result = Command.Create("dotnet-compile",
|
||||
$"--framework \"{context.TargetFramework.DotNetFrameworkName}\" " +
|
||||
$"--output \"{outputPath}\" " +
|
||||
$"--configuration \"{configuration}\" " +
|
||||
"--no-host " +
|
||||
$"\"{context.ProjectFile.ProjectDirectory}\"")
|
||||
.ForwardStdErr()
|
||||
.ForwardStdOut()
|
||||
.Execute();
|
||||
|
@ -168,6 +171,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
|
||||
// Copy the host
|
||||
File.Copy(hostPath, outputExe, overwrite: true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue