Skip to content

Commit

Permalink
Merge branch 'rel/1.0.0-preview4' into merge_preview4
Browse files Browse the repository at this point in the history
* rel/1.0.0-preview4:
  Adding MigrateWebSdkRule to the DefaultMigrationRuleSet (dotnet#4963)
  MSBuild to 15.1.458 (dotnet#4950)
  Update web template for Web SDK 154 (dotnet#4948)
  Adding a SdkNugetVersion property when invoking dotnet pack on test packages so that test packages can reference exact packages. We need that because of NuGet/Home#4063. Without it, pack creates the nuspec with a version like 1.0.0-version-, instead of 1.0.0-version-<version_used_in_build>, which leads to problems when restoring the tool. Like, it ends up restoring to the closest version of the package (oldest), instead of the latest.
  remove unused directories from bundled sdks
  fix mstest package version, aligned to c#
  align f# web template
  align f# xunit template
  align f# mstest template
  align f# lib template
  align f# console proj
  bundle fsharp sdk, only Sdk directory is required
  Add more xlf files for new strings
  Updating the preview4 channel to rel-1.0.0-preview4
  • Loading branch information
livarcocc committed Dec 8, 2016
2 parents 355b623 + 8cec61c commit fd70498
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<SdkNugetVersion Condition=" '$(SdkNugetVersion)' == ''">1.0.0-preview5-*</SdkNugetVersion>
</PropertyGroup>

<ItemGroup>
<Compile Include="**\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
<Compile Include="..\..\..\src\dotnet\CommandLine\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
Expand All @@ -34,7 +38,7 @@
<Version>4.0.0-rc2</Version>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.Cli.Utils">
<Version>1.0.0-preview5-*</Version>
<Version>$(SdkNugetVersion)</Version>
</PackageReference>
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions build/Microsoft.DotNet.Cli.BundledSdks.proj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<Copy SourceFiles="@(SdkContent)"
DestinationFiles="@(SdkContent->'$(SdkLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />

<!-- Remove unused directories for FSharp.NET.Sdk, just Sdk directory is needed -->
<RemoveDir Condition=" '$([System.IO.Path]::GetFileName($(SdkLayoutDirectory)))' == 'FSharp.NET.Sdk' " Directories="$(SdkLayoutDirectory)/build;$(SdkLayoutDirectory)/buildCrossTargeting" />

<Message Text="Copied Sdk $(SdkPackageName) from $(SdkNuPkgPath) to $(SdkLayoutDirectory)."
Importance="High" />
</Target>
Expand Down
1 change: 1 addition & 0 deletions build/Microsoft.DotNet.Cli.BundledSdks.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<BundledSdk Include="Microsoft.NET.Sdk.Web" Version="$(CLI_WEBSDK_Version)" />
<BundledSdk Include="Microsoft.NET.Sdk.Publish" Version="$(CLI_WEBSDK_Version)" />
<BundledSdk Include="Microsoft.NET.Sdk.Web.ProjectSystem" Version="$(CLI_WEBSDK_Version)" />
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.0-beta-040011" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions build/Microsoft.DotNet.Cli.DependencyVersions.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CLI_MSBuild_Version>15.1.0-preview-000454-01</CLI_MSBuild_Version>
<CLI_MSBuild_Version>15.1.0-preview-000458-02</CLI_MSBuild_Version>
<CLI_NETSDK_Version>1.0.0-alpha-20161104-2</CLI_NETSDK_Version>
<CLI_WEBSDK_Version>1.0.0-alpha-20161203-1-150</CLI_WEBSDK_Version>
<CLI_WEBSDK_Version>1.0.0-alpha-20161205-1-154</CLI_WEBSDK_Version>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion build/Microsoft.DotNet.Cli.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,13 @@
<DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs>
</PropertyGroup>

<!-- https://github.com/NuGet/Home/issues/4063 -->
<DotNetPack NoBuild="True"
Output="$(TestPackagesDir)"
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(Stage0Directory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)"
MsbuildArgs="$(DotNetPackMsbuildArgs)" />
MsbuildArgs="$(DotNetPackMsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
</Target>

<Target Name="BuildTestAssetPackageProjects"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ internal class DefaultMigrationRuleSet : IMigrationRule
new MigrateAssemblyInfoRule(),
new RemoveDefaultsFromProjectRule(),
new CleanOutputProjectRule(),
new SaveOutputProjectRule()
new SaveOutputProjectRule(),
new MigrateWebSdkRule()
};

public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migra

var compilerOptions = projectContext.ProjectFile.GetCompilerOptions(null, null);

var project = migrationRuleInputs.DefaultProjectContext.ProjectFile;
var projectType = project.GetProjectType();

// If we're in a configuration, we need to be careful not to overwrite values from BuildOptions
// without a configuration
if (_configurationBuildOptions == null)
Expand All @@ -213,7 +216,9 @@ public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migra
propertyGroup,
itemGroup,
_transformApplicator,
migrationSettings.ProjectDirectory);
migrationSettings.ProjectDirectory,
projectType,
csproj);
}
else
{
Expand All @@ -223,7 +228,9 @@ public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migra
propertyGroup,
itemGroup,
_transformApplicator,
migrationSettings.ProjectDirectory);
migrationSettings.ProjectDirectory,
projectType,
csproj);
}

var transformOutput = GenerateRuntimeConfigurationFilesTransform.Transform(
Expand All @@ -237,7 +244,9 @@ private void PerformConfigurationPropertyAndItemMappings(
ProjectPropertyGroupElement propertyGroup,
ProjectItemGroupElement itemGroup,
ITransformApplicator transformApplicator,
string projectDirectory)
string projectDirectory,
ProjectType projectType,
ProjectRootElement csproj)
{
foreach (var transform in _propertyTransforms)
{
Expand All @@ -253,7 +262,13 @@ private void PerformConfigurationPropertyAndItemMappings(
foreach (var includeContextTransformExecute in _includeContextTransformExecutes)
{
var nonConfigurationOutput = includeContextTransformExecute(compilerOptions, projectDirectory);
var configurationOutput = includeContextTransformExecute(configurationCompilerOptions, projectDirectory);
var configurationOutput =
includeContextTransformExecute(configurationCompilerOptions, projectDirectory);

configurationOutput = RemoveDefaultCompileAndEmbeddedResourceForWebProjects(
configurationOutput,
projectType,
csproj);

transformApplicator.Execute(configurationOutput, itemGroup, mergeExisting: true);
}
Expand Down Expand Up @@ -293,7 +308,9 @@ private void PerformPropertyAndItemMappings(
ProjectPropertyGroupElement propertyGroup,
ProjectItemGroupElement itemGroup,
ITransformApplicator transformApplicator,
string projectDirectory)
string projectDirectory,
ProjectType projectType,
ProjectRootElement csproj)
{
foreach (var transform in _propertyTransforms)
{
Expand All @@ -302,13 +319,40 @@ private void PerformPropertyAndItemMappings(

foreach (var includeContextTransformExecute in _includeContextTransformExecutes)
{
var transform = includeContextTransformExecute(compilerOptions, projectDirectory);

transform = RemoveDefaultCompileAndEmbeddedResourceForWebProjects(
transform,
projectType,
csproj);

transformApplicator.Execute(
includeContextTransformExecute(compilerOptions, projectDirectory),
transform,
itemGroup,
mergeExisting: true);
}
}

private IEnumerable<ProjectItemElement> RemoveDefaultCompileAndEmbeddedResourceForWebProjects(
IEnumerable<ProjectItemElement> transform,
ProjectType projectType,
ProjectRootElement csproj)
{
if(projectType == ProjectType.Web)
{
var itemsToRemove = transform.Where(p =>
p != null &&
p.Include.Contains("**\\*") &&
(p.ItemType == "Compile" || p.ItemType == "EmbeddedResource"));

CleanExistingItems(csproj, new [] {"Compile", "EmbeddedResource"});

transform = transform.Where(p => !itemsToRemove.Contains(p));
}

return transform;
}

private void CleanExistingProperties(ProjectRootElement csproj)
{
var existingPropertiesToRemove = new [] {"OutputType", "TargetExt"};
Expand All @@ -324,6 +368,19 @@ private void CleanExistingProperties(ProjectRootElement csproj)
}
}

private void CleanExistingItems(ProjectRootElement csproj, IEnumerable<string> itemsToRemove)
{
foreach (var itemName in itemsToRemove)
{
var items = csproj.Items.Where(i => i.ItemType == itemName);

foreach (var item in items)
{
item.Parent.RemoveChild(item);
}
}
}

private IncludeContext GetCompileIncludeContext(CommonCompilerOptions compilerOptions, string projectDirectory)
{
// Defaults from src/Microsoft.DotNet.ProjectModel/ProjectReader.cs #L596
Expand Down
14 changes: 0 additions & 14 deletions src/dotnet/commands/dotnet-new/CSharp_Web/$projectName$.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;jspm_packages\**;bower_components\**;**\*.user;**\*.*proj</GlobalExclude>
</PropertyGroup>

<ItemGroup>
<None Include="**\*" />
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<Content Include="wwwroot\**" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.cshtml" Exclude="wwwroot\**\*.cshtml" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.config" Exclude="wwwroot\**\*.config" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.json" Exclude="wwwroot\**\*.json" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -15,10 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
<PackageReference Include="Microsoft.NET.Sdk" Version="1.0.0-alpha-20161104-2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-alpha-*">
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand All @@ -29,6 +25,4 @@
</DotNetCliToolReference>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />

</Project>
10 changes: 2 additions & 8 deletions src/dotnet/commands/dotnet-new/FSharp_Lib/$projectName$.fsproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
Expand All @@ -14,10 +13,7 @@
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6" />
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
<PackageReference Include="Microsoft.NET.Sdk" Version="1.0.0-alpha-20161104-2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-alpha-*">
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand All @@ -28,6 +24,4 @@
</DotNetCliToolReference>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -14,13 +13,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
<PackageReference Include="Microsoft.NET.Sdk" Version="1.0.0-alpha-20161104-2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161109-01" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.5-preview" />
<PackageReference Include="MSTest.TestFramework" Version="1.0.6-preview" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-alpha-*">
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand All @@ -31,5 +27,4 @@
</DotNetCliToolReference>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
</Project>
</Project>
18 changes: 11 additions & 7 deletions src/dotnet/commands/dotnet-new/FSharp_Web/$projectName$.fsproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Project ToolsVersion="15.0" Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk.Web">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -11,20 +10,26 @@
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;jspm_packages\**;bower_components\**;**\*.user;**\*.*proj</GlobalExclude>
</PropertyGroup>

<ItemGroup>
<None Include="**\*" />
<Compile Include="Controllers\*.fs" />
<Compile Include="Startup.fs" />
<Compile Include="Program.fs" />
<EmbeddedResource Include="**\*.resx" />
<Content Include="wwwroot\**" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.cshtml" Exclude="wwwroot\**\*.cshtml" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.config" Exclude="wwwroot\**\*.config" CopyToPublishDirectory="PreserveNewest" />
<Content Include="**\*.json" Exclude="wwwroot\**\*.json" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.NET.Sdk.Web" Version="1.0.0-alpha-20161117-1-119">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-alpha-*">
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.0" />
Expand All @@ -49,5 +54,4 @@
</DotNetCliToolReference>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -13,14 +12,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.NET.Sdk" Version="1.0.0-alpha-20161104-2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-alpha-*">
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand All @@ -31,6 +27,4 @@
</DotNetCliToolReference>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />

</Project>
Loading

0 comments on commit fd70498

Please sign in to comment.