Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/2.1.4xx'
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayrkn committed Jun 14, 2018
2 parents 8534ae9 + 1ed3109 commit 4487ccf
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build.sh
Expand Up @@ -11,7 +11,7 @@ done
REPOROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

source "$REPOROOT/scripts/common/_prettyprint.sh"
export DOTNET_VERSION=2.1.300-preview2-008248
export DOTNET_VERSION=2.1.300
if [ -n "$DotNetCoreSdkDir" ]
then
export DOTNET_VERSION=$( ${DotNetCoreSdkDir}/dotnet --version )
Expand All @@ -33,7 +33,7 @@ then
[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR

DOTNET_INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
curl -sSL "$DOTNET_INSTALL_SCRIPT_URL" | bash /dev/stdin --verbose --version 2.1.300-preview2-008248
curl -sSL "$DOTNET_INSTALL_SCRIPT_URL" | bash /dev/stdin --verbose --version 2.1.300

curl --retry 10 -s -SL -f --create-dirs -o $DOTNET_INSTALL_DIR/buildtools.tar.gz https://aspnetcore.blob.core.windows.net/buildtools/netfx/4.6.1/netfx.4.6.1.tar.gz
[ -d "$DOTNET_INSTALL_DIR/buildtools/net461" ] || mkdir -p $DOTNET_INSTALL_DIR/buildtools/net461
Expand Down
2 changes: 1 addition & 1 deletion build/WebSdkEnv.cmd
Expand Up @@ -13,7 +13,7 @@ if not defined DOTNET_INSTALL_DIR (
)

if not defined DOTNET_VERSION (
set DOTNET_VERSION=2.1.300-preview2-008248
set DOTNET_VERSION=2.1.300
)

if not defined FeedTasksPackage (
Expand Down
2 changes: 1 addition & 1 deletion dotnet-install_2.0.ps1
Expand Up @@ -62,7 +62,7 @@
[cmdletbinding()]
param(
[string]$Channel="master",
[string]$Version="2.1.300-preview2-008248",
[string]$Version="2.1.300",
[string]$InstallDir="<auto>",
[string]$Architecture="<auto>",
[switch]$SharedRuntime,
Expand Down
Expand Up @@ -23,14 +23,7 @@ public override bool Execute()
bool isRunCommandFilePresent = File.Exists(Path.Combine(ProjectDirectory, RunCommandFile));
if (!isRunCommandFilePresent)
{
string appName = Path.GetFileName(TargetPath);

string command = $"dotnet {appName}";
if (UseAppHost || string.Equals(Path.GetExtension(TargetPath), ".exe", StringComparison.OrdinalIgnoreCase))
{
command = Path.ChangeExtension(appName, !string.IsNullOrWhiteSpace(ExecutableExtension) ? ExecutableExtension : null);
}

string command = WebJobsCommandGenerator.RunCommand(TargetPath, UseAppHost, ExecutableExtension);
File.WriteAllText(Path.Combine(WebJobsDirectory, RunCommandFile), command);
}

Expand Down
@@ -0,0 +1,21 @@
using System;
using System.IO;

namespace Microsoft.NET.Sdk.Publish.Tasks
{
public static class WebJobsCommandGenerator
{
public static string RunCommand(string targetPath, bool useAppHost, string executableExtension)
{
string appName = Path.GetFileName(targetPath);

string command = $"dotnet {appName}";
if (useAppHost || string.Equals(Path.GetExtension(targetPath), ".exe", StringComparison.OrdinalIgnoreCase))
{
command = Path.ChangeExtension(appName, !string.IsNullOrWhiteSpace(executableExtension) ? executableExtension : null);
}

return $"{command} %*";
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.NET.Sdk.Publish.Tasks;
using Xunit;


namespace Microsoft.Net.Sdk.Publish.Tasks.Tests
{
public class WebJobsCommandGeneratorTests
{
[Theory]
[InlineData("c:\\test\\WebApplication1.dll", false, ".exe", "dotnet WebApplication1.dll %*")]

[InlineData("c:\\test\\WebApplication1.dll", true, ".exe", "WebApplication1.exe %*")]
[InlineData("c:\\test\\WebApplication1.dll", true, "", "WebApplication1 %*")]

[InlineData("c:\\test\\WebApplication1.exe", true, ".exe", "WebApplication1.exe %*")]
[InlineData("c:\\test\\WebApplication1.exe", false, ".exe", "WebApplication1.exe %*")]

[InlineData("c:\\test\\WebApplication1.dll", true, ".sh", "WebApplication1.sh %*")]
[InlineData("c:\\test\\WebApplication1.dll", false, ".sh", "dotnet WebApplication1.dll %*")]
public void WebJobsCommandGenerator_Generates_Correct_RunCmd(string targetPath, bool useAppHost, string executableExtension, string expected)
{
// Arrange

// Test
string generatedRunCommand = WebJobsCommandGenerator.RunCommand(targetPath, useAppHost, executableExtension);

// Assert
Assert.Equal(expected, generatedRunCommand);
}
}
}

0 comments on commit 4487ccf

Please sign in to comment.