Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NonInteractive to nuget restore #95

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/generator._js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ function ScriptGenerator(repositoryRoot, projectType, projectPath, solutionPath,
projectType = projectType.toUpperCase();

if (!scriptType) {
// use posh by default
// If no script type is passed, use the default one
if (projectType === ProjectType.wap || projectType === ProjectType.website || projectType === ProjectType.python) {
// For .NET the default script type is batch
scriptType = ScriptType.batch;
scriptType = ScriptType.posh;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't sound related to the PR. Also, the comment above needs adjustment, as it says default is batch.

I'm a bit worried about switching to posh for everyone, as I'm not sure it's been well tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a side effect, I am pushing this to my repo for testing purpose, it will get reverted, and once I smash everything, it will be a NOOP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok

} else {
// Otherwise the default depends on the os
scriptType = isWindows ? ScriptType.batch : ScriptType.bash;
scriptType = isWindows ? ScriptType.posh : ScriptType.bash;
}
} else {
scriptType = scriptType.toUpperCase();
Expand Down
61 changes: 31 additions & 30 deletions lib/generator.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions lib/templates/deploy.batch.aspnet.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
mkdir "%DEPLOYMENT_TEMP%"
)

IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined
6 changes: 3 additions & 3 deletions lib/templates/deploy.batch.aspnet.wap.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ echo Handling .NET Web Application deployment.

:: 1. Restore NuGet packages
IF /I "{SolutionPath}" NEQ "" (
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\{SolutionPath}"
call :ExecuteCmd %NUGETRESTORE% "%DEPLOYMENT_SOURCE%\{SolutionPath}"
IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call :ExecuteCmd "%MSBUILD_PATH%" {MSBuildArguments}
call :ExecuteCmd "%MSBUILD_DIR%\MSBuild.exe" {MSBuildArguments}
) ELSE (
call :ExecuteCmd "%MSBUILD_PATH%" {MSBuildArgumentsForInPlace}
call :ExecuteCmd "%MSBUILD_DIR%\MSBuild.exe" {MSBuildArgumentsForInPlace}
)

IF !ERRORLEVEL! NEQ 0 goto error
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/deploy.batch.aspnet.website.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
echo Handling .NET Web Site deployment.

:: 1. Build to the repository path
call :ExecuteCmd "%MSBUILD_PATH%" {MSBuildArguments}
call :ExecuteCmd "%MSBUILD_DIR%\MSBuild.exe" {MSBuildArguments}
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. KuduSync
Expand Down
4 changes: 2 additions & 2 deletions lib/templates/deploy.batch.dotnetconsole.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ echo Handling .NET Console Application deployment.

:: 1. Restore NuGet packages
IF /I "{SolutionPath}" NEQ "" (
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\{SolutionPath}" -MSBuildPath "%MSBUILD_15_DIR%"
call :ExecuteCmd %NUGETRESTORE% "%DEPLOYMENT_SOURCE%\{SolutionPath}"
IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
call :ExecuteCmd "%MSBUILD_15_DIR%\MSBuild.exe" {MSBuildArguments}
call :ExecuteCmd "%MSBUILD_DIR%\MSBuild.exe" {MSBuildArguments}
IF !ERRORLEVEL! NEQ 0 goto error

:: 3. Run web job deploy script
Expand Down
5 changes: 3 additions & 2 deletions lib/templates/deploy.batch.functionmsbuild.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
:: Deployment
:: ----------
echo Handling function App deployment with Msbuild.
:: only works with msbuild15

:: 1. Restore nuget packages
call :ExecuteCmd nuget.exe restore "%DEPLOYMENT_SOURCE%\{RestoreArguments}" -MSBuildPath "%MSBUILD_15_DIR%"
call :ExecuteCmd %NUGETRESTORE% "%DEPLOYMENT_SOURCE%\{RestoreArguments}"
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. Build and publish
call :ExecuteCmd "%MSBUILD_15_DIR%\MSBuild.exe" "%DEPLOYMENT_SOURCE%\{ProjectPath}" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
call :ExecuteCmd "%MSBUILD_DIR%\MSBuild.exe" "%DEPLOYMENT_SOURCE%\{ProjectPath}" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 3. KuduSync
Expand Down
17 changes: 17 additions & 0 deletions lib/templates/deploy.batch.prefix.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ IF %ERRORLEVEL% NEQ 0 (
setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts
:: select msbuild version
IF NOT DEFINED MSBUILD_VERSION GOTO useMsbuild15
IF %MSBUILD_VERSION% == "15" GOTO useMsbuild15
IF %MSBUILD_VERSION% == "14" GOTO useMsbuild14
:: defined an invalid version
GOTO error

:useMsbuild15
SET MSBUILD_DIR=%MSBUILD_15_DIR%
GOTO nugetRestore

:useMsbuild14
SET MSBUILD_DIR=%MSBUILD_14_DIR%
GOTO nugetRestore

:nugetRestore
SET NUGETRESTORE=nuget restore -NonInteractive -MSBuildPath "%MSBUILD_DIR%"

IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
Expand Down
5 changes: 0 additions & 5 deletions lib/templates/deploy.posh.aspnet.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

$DEPLOYMENT_TEMP = $env:DEPLOYMENT_TEMP
$MSBUILD_PATH = $env:MSBUILD_PATH

if ($DEPLOYMENT_TEMP -eq $null) {
$DEPLOYMENT_TEMP = "$env:temp\___deployTemp$env:random"
Expand All @@ -13,7 +12,3 @@ if ($CLEAN_LOCAL_DEPLOYMENT_TEMP -eq $true) {
}
mkdir "$DEPLOYMENT_TEMP"
}

if ($MSBUILD_PATH -eq $null) {
$MSBUILD_PATH = "${env:ProgramFiles(x86)}\MSBuild\14.0\Bin\MSBuild.exe"
}
6 changes: 3 additions & 3 deletions lib/templates/deploy.posh.aspnet.wap.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ echo "Handling .NET Web Application deployment."

# 1. Restore NuGet packages
if (Test-Path "{SolutionPath}") {
nuget restore "$DEPLOYMENT_SOURCE\{SolutionPath}"
$NUGETRESTORE "$DEPLOYMENT_SOURCE\{SolutionPath}"
exitWithMessageOnError "NuGet restore failed"
}

# 2. Build to the temporary path
if ($env:IN_PLACE_DEPLOYMENT -ne "1") {
& "$MSBUILD_PATH" {MSBuildArguments}
& "$MSBUILD_DIR\MSBuild.exe" {MSBuildArguments}
} else {
& "$MSBUILD_PATH" {MSBuildArgumentsForInPlace}
& "$MSBUILD_DIR\MSBuild.exe" {MSBuildArgumentsForInPlace}
}

exitWithMessageOnError "MSBuild failed"
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/deploy.posh.aspnet.website.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
echo "Handling .NET Web Site deployment."

# 1. Build to the repository path
& "$MSBUILD_PATH" {MSBuildArguments}
& "$MSBUILD_DIR\MSBuild.exe" {MSBuildArguments}
exitWithMessageOnError "MSBuild failed"

# 2. KuduSync
Expand Down
4 changes: 2 additions & 2 deletions lib/templates/deploy.posh.dotnetconsole.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ echo "Handling .NET Console Application deployment."

# 1. Restore NuGet packages
if (Test-Path "{SolutionPath}") {
nuget restore "$DEPLOYMENT_SOURCE\{SolutionPath}"
$NUGETRESTORE "$DEPLOYMENT_SOURCE\{SolutionPath}"
exitWithMessageOnError "NuGet restore failed"
}

# 2. Build to the temporary path
& "$MSBUILD_PATH" {MSBuildArguments}
& "$MSBUILD_DIR\MSBuild.exe" {MSBuildArguments}
exitWithMessageOnError "MSBuild failed"

# 3. Run web job deploy script
Expand Down
8 changes: 8 additions & 0 deletions lib/templates/deploy.posh.prefix.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ $DEPLOYMENT_TARGET = $env:DEPLOYMENT_TARGET

$NEXT_MANIFEST_PATH = $env:NEXT_MANIFEST_PATH
$PREVIOUS_MANIFEST_PATH = $env:PREVIOUS_MANIFEST_PATH
if ($env:MSBUILD_VERSION -eq $null -Or $env:MSBUILD_VERSION -eq "15") {
$MSBUILD_DIR = $env:MSBUILD_15_DIR
} ElseIf ($env:MSBUILD_VERSION -eq "14") {
$MSBUILD_DIR = $env:MSBUILD_14_DIR
} Else {
exitWithMessageOnError "MSBUILD_VERSION is invalid, it needs to be either 14 or 15"
}
$NUGETRESTORE = "nuget restore -NonInteractive -MSBuildPath `"$MSBUILD_DIR`""

if ($DEPLOYMENT_SOURCE -eq $null) {
$DEPLOYMENT_SOURCE = $SCRIPT_DIR
Expand Down