Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

React to kpm subcommand renaming #352

Closed
wants to merge 1 commit into from
Closed
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
39 changes: 22 additions & 17 deletions src/MusicStore.Spa/MusicStore.Spa.kproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>93891170-a8d5-46fd-a291-40f90cf258c2</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>1575</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>93891170-a8d5-46fd-a291-40f90cf258c2</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>1575</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
</VisualStudio>
</ProjectExtensions>
</Project>
2 changes: 1 addition & 1 deletion src/MusicStore.Spa/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"node_modules",
"grunt"
],
"packExclude": [
"bundleExclude": [
"bower.json",
"package.json",
"gruntfile.js",
Expand Down
2 changes: 1 addition & 1 deletion src/MusicStore/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"**/*.cs",
"../../test/E2ETests/compiler/shared/**/*.cs" // This code is for testing only.
],
"packExclude": "*.cmd",
"bundleExclude": "*.cmd",
"webroot": "wwwroot",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-*",
Expand Down
38 changes: 19 additions & 19 deletions test/E2ETests/Common/DeploymentUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public static Process StartApplication(StartParameters startParameters, string i
}
else
{
// Cannot override with environment in case of IIS. Pack and write a Microsoft.AspNet.Hosting.ini file.
startParameters.PackApplicationBeforeStart = true;
// Cannot override with environment in case of IIS. Bundle and write a Microsoft.AspNet.Hosting.ini file.
startParameters.BundleApplicationBeforeStart = true;
}
}

Expand All @@ -91,14 +91,14 @@ public static Process StartApplication(StartParameters startParameters, string i
//Tweak the %PATH% to the point to the right KREFLAVOR
startParameters.Kre = SwitchPathToKreFlavor(startParameters.KreFlavor, startParameters.KreArchitecture, logger);

//Reason to do pack here instead of in a common place is use the right KRE to do the packing. Previous line switches to use the right KRE.
if (startParameters.PackApplicationBeforeStart)
//Reason to do bundle here instead of in a common place is use the right KRE to do the bundling. Previous line switches to use the right KRE.
if (startParameters.BundleApplicationBeforeStart)
{
if (startParameters.ServerType == ServerType.IISNativeModule ||
startParameters.ServerType == ServerType.IIS)
{
// Pack to IIS root\application folder.
KpmPack(startParameters, logger, Path.Combine(Environment.GetEnvironmentVariable("SystemDrive") + @"\", @"inetpub\wwwroot"));
// Bundle to IIS root\application folder.
KpmBundle(startParameters, logger, Path.Combine(Environment.GetEnvironmentVariable("SystemDrive") + @"\", @"inetpub\wwwroot"));

// Drop a Microsoft.AspNet.Hosting.ini with ASPNET_ENV information.
logger.WriteInformation("Creating Microsoft.AspNet.Hosting.ini file with ASPNET_ENV.");
Expand Down Expand Up @@ -136,7 +136,7 @@ public static Process StartApplication(StartParameters startParameters, string i
}
else
{
KpmPack(startParameters, logger);
KpmBundle(startParameters, logger);
}
}

Expand Down Expand Up @@ -172,11 +172,11 @@ private static Process StartMonoHost(StartParameters startParameters, ILogger lo
throw new Exception("KRE not detected on the machine.");
}

if (startParameters.PackApplicationBeforeStart)
if (startParameters.BundleApplicationBeforeStart)
{
// We use full path to KRE to pack.
// We use full path to KRE to bundle.
startParameters.Kre = new DirectoryInfo(kreBin).Parent.FullName;
KpmPack(startParameters, logger);
KpmBundle(startParameters, logger);
}

//Mono does not have a way to pass in a --appbase switch. So it will be an environment variable.
Expand Down Expand Up @@ -307,11 +307,11 @@ private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture
return kreName;
}

private static void KpmPack(StartParameters startParameters, ILogger logger, string packRoot = null)
private static void KpmBundle(StartParameters startParameters, ILogger logger, string bundleRoot = null)
{
startParameters.PackedApplicationRootPath = Path.Combine(packRoot ?? Path.GetTempPath(), Guid.NewGuid().ToString());
startParameters.BundledApplicationRootPath = Path.Combine(bundleRoot ?? Path.GetTempPath(), Guid.NewGuid().ToString());

var parameters = string.Format("pack {0} -o {1} --runtime {2}", startParameters.ApplicationPath, startParameters.PackedApplicationRootPath, startParameters.Kre);
var parameters = string.Format("bundle {0} -o {1} --runtime {2}", startParameters.ApplicationPath, startParameters.BundledApplicationRootPath, startParameters.Kre);
logger.WriteInformation("Executing command kpm {0}", parameters);

var startInfo = new ProcessStartInfo
Expand All @@ -329,10 +329,10 @@ private static void KpmPack(StartParameters startParameters, ILogger logger, str
(startParameters.ServerType == ServerType.IISExpress ||
startParameters.ServerType == ServerType.IISNativeModule ||
startParameters.ServerType == ServerType.IIS) ?
Path.Combine(startParameters.PackedApplicationRootPath, "wwwroot") :
Path.Combine(startParameters.PackedApplicationRootPath, "approot", "src", "MusicStore");
Path.Combine(startParameters.BundledApplicationRootPath, "wwwroot") :
Path.Combine(startParameters.BundledApplicationRootPath, "approot", "src", "MusicStore");

logger.WriteInformation("kpm pack finished with exit code : {0}", hostProcess.ExitCode);
logger.WriteInformation("kpm bundle finished with exit code : {0}", hostProcess.ExitCode);
}

//In case of self-host application activation happens immediately unlike iis where activation happens on first request.
Expand Down Expand Up @@ -432,12 +432,12 @@ public static void CleanUpApplication(StartParameters startParameters, Process h
}
}

if (startParameters.PackApplicationBeforeStart)
if (startParameters.BundleApplicationBeforeStart)
{
try
{
//We've originally packed the application in a temp folder. We need to delete it.
Directory.Delete(startParameters.PackedApplicationRootPath, true);
//We've originally bundled the application in a temp folder. We need to delete it.
Directory.Delete(startParameters.BundledApplicationRootPath, true);
}
catch (Exception exception)
{
Expand Down
4 changes: 2 additions & 2 deletions test/E2ETests/Common/StartParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public class StartParameters

public string ApplicationPath { get; set; }

public bool PackApplicationBeforeStart { get; set; }
public bool BundleApplicationBeforeStart { get; set; }

public string PackedApplicationRootPath { get; set; }
public string BundledApplicationRootPath { get; set; }

public string Kre { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions test/E2ETests/PublishAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void Publish_And_Run_Tests(ServerType serverType, KreFlavor kreFlavor, K
ServerType = serverType,
KreFlavor = kreFlavor,
KreArchitecture = architecture,
PackApplicationBeforeStart = true
BundleApplicationBeforeStart = true
};

var testStartTime = DateTime.Now;
Expand Down Expand Up @@ -95,7 +95,7 @@ private void Publish_And_Run_Tests(ServerType serverType, KreFlavor kreFlavor, K
{
if (Directory.GetFiles(_startParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0)
{
throw new Exception("packExclude parameter values are not honored.");
throw new Exception("bundleExclude parameter values are not honored.");
}
}

Expand Down