Skip to content

More cleaning up Blazor.Build package #17157

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

Merged
merged 13 commits into from
Nov 22, 2019
Merged
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
1 change: 1 addition & 0 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$(RepoRoot)src\Installers\**\*.*proj;
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*proj;
$(RepoRoot)src\Components\Blazor\Build\testassets\**\*.*proj;
$(RepoRoot)src\Components\Blazor\Templates\src\content\**\*.*proj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.csproj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.fsproj;
Expand Down

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions src/Components/Blazor/Build/src/Cli/Program.cs

This file was deleted.

70 changes: 0 additions & 70 deletions src/Components/Blazor/Build/src/Core/BootJsonWriter.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,37 +1,71 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<TargetFrameworks>$(DefaultNetCoreTargetFramework);net46</TargetFrameworks>
<TargetName>Microsoft.AspNetCore.Blazor.Build.Tasks</TargetName>
Copy link
Member

@SteveSandersonMS SteveSandersonMS Nov 18, 2019

Choose a reason for hiding this comment

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

Is it OK that the assembly name and project/dir name don't match? I mean, I understand it works technically, but this might confuse people as it doesn't match our normal conventions. Could we rename the dir and project to Microsoft.AspNetCore.Blazor.Build.Tasks?

Update: never mind, I realise TargetName is not the assembly name now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do something similar with the Razor.SDK. We want to keep the package name Microsoft.AspNetCore.Blazor.Build, but by convention most task assemblies are named 'Something.Tasks`. The task assembly is generally not referenced by any code so it might not be incredibly confusing. Let me know if you feel strongly and we can figure out other options to organize this.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with whatever here

<AssemblyName>Microsoft.AspNetCore.Blazor.Build</AssemblyName>
<Description>Build mechanism for ASP.NET Core Blazor applications.</Description>
<OutputType>Exe</OutputType>
<IsShippingPackage>true</IsShippingPackage>
<HasReferenceAssembly>false</HasReferenceAssembly>
<GenerateDependencyFile>false</GenerateDependencyFile>
</PropertyGroup>

<!-- Pack settings -->
<PropertyGroup>
<!-- Producing this package requires building with NodeJS enabled. -->
<IsPackable Condition="'$(BuildNodeJS)' == 'false'">false</IsPackable>
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);Publish</GenerateNuspecDependsOn>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Follow up before this goes in: make sure the packaging looks correct.

<NoPackageAnalysis>true</NoPackageAnalysis>
<NuspecFile>Microsoft.AspNetCore.Blazor.Build.nuspec</NuspecFile>
</PropertyGroup>

<ItemGroup>
<NuspecProperty Include="configuration=$(Configuration)" />
<NuspecProperty Include="publishDir=$(PublishDir)" />
<NuspecProperty Include="taskskDir=$(OutputPath)tools" />
<NuspecProperty Include="componentsversion=$(ComponentsPackageVersion)" />
<NuspecProperty Include="razorversion=$(MicrosoftAspNetCoreRazorDesignPackageVersion)" />
<NuspecProperty Include="blazormonoversion=$(MicrosoftAspNetCoreBlazorMonoPackageVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Condition="'$(BuildNodeJS)' != 'false' and '$(BuildingInsideVisualStudio)' != 'true'" Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssembly="false" />
<Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
<Reference Include="System.Reflection.Metadata" />
</ItemGroup>
<!-- Add a project dependency without reference output assemblies to enforce build order -->
<!-- Applying workaround for https://github.com/microsoft/msbuild/issues/2661 and https://github.com/dotnet/sdk/issues/952 -->
<ProjectReference
Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj"
ReferenceOutputAssemblies="false"
SkipGetTargetFrameworkProperties="true"
UndefineProperties="TargetFramework"
Private="false"
Condition="'$(BuildNodeJS)' != 'false' and '$(BuildingInsideVisualStudio)' != 'true'" />

<ItemGroup>
<Compile Include="..\..\..\Shared\src\JsonSerializerOptionsProvider.cs" />
<Reference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" />
<Reference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="Runtime" />
<Reference Include="System.Reflection.Metadata" Condition="'$(TargetFramework)' == 'net46'" />
</ItemGroup>

<Target Name="CopyBuildTask" BeforeTargets="Build" Condition="'$(DotNetBuildFromSource)' != 'true' AND '$(IsInnerBuild)' != 'true'">
<!--
The task produced by this project is referenced within this solution. When building, Visual Studio will lock up the assembly.
Any attempts to overwrite the binary with a newer version will fail. This is particularly grating if a developer "Rebuilds" the project
after an initial build since that would always attempt to overwrite the tasks dll

This target attempts to make this solution more usable at the cost of a more onerous inner-loop build of the Blazor.Build tasks.
We'll copy the tasks to a location other that than the build output and use that in the Blazor.Build.targets. In the most common
case where these tasks aren't being worked on, everything should work great. However, if you're attemping to modify these tasks,
you will need to manaully stop MSBuild.exe processes
-->

<ItemGroup>
<_NetCoreFilesToCopy Include="$(OutputPath)$(DefaultNetCoreTargetFramework)\*" TargetPath="netcoreapp\" />
<_DesktopFilesToCopy Include="$(OutputPath)net46\*" TargetPath="netfx\" />
<_AllFilesToCopy Include="@(_NetCoreFilesToCopy);@(_DesktopFilesToCopy)" />
</ItemGroup>

<Error Text="No files found in $(OutputPath)$(DefaultNetCoreTargetFramework)" Condition="@(_NetCoreFilesToCopy->Count()) == 0" />
<Error Text="No files found in $(OutputPath)net46" Condition="@(_DesktopFilesToCopy->Count()) == 0" />

<Copy SourceFiles="@(_AllFilesToCopy)" DestinationFiles="@(_AllFilesToCopy->'$(OutputPath)tools\%(TargetPath)%(FileName)%(Extension)')" SkipUnchangedFiles="true" Retries="1" ContinueOnError="true">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<file src="..\..\..\THIRD-PARTY-NOTICES.txt" />
<file src="build\**" target="build" />
<file src="targets\**" target="targets" />
<file src="$publishdir$**\*" target="tools/" />
<file src="..\..\..\Web.JS\dist\$configuration$\blazor.*.js" target="tools/blazor" />
<file src="$taskskDir$\*" target="tools/" />
<file src="..\..\..\Web.JS\dist\$configuration$\blazor.webassembly.js" target="tools/blazor" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project>
<!--
Importing this file is equivalent to having:
<PackageDependency Include="Microsoft.AspNetCore.Blazor.Build" />
... except it's much more convenient when working in this repo, because it consumes the
Blazor.Build targets/exe directly without needing this project to be packed into a .nupkg.

This is only intended for use by other projects in this repo.
-->

<PropertyGroup>
<ComponentsRoot Condition="'$(ComponentsRoot)'==''">$(MSBuildThisFileDirectory)..\..\..\</ComponentsRoot>
<BlazorJsPath>$(ComponentsRoot)Web.JS\dist\$(Configuration)\blazor.webassembly.js</BlazorJsPath>
<BlazorJsMapPath>$(ComponentsRoot)Web.JS\dist\$(Configuration)\blazor.webassembly.js.map</BlazorJsMapPath>
<BlazorToolsDir>$(MSBuildThisFileDirectory)bin\$(Configuration)\tools\</BlazorToolsDir>
</PropertyGroup>

<Target Name="CheckBlazorJSFiles" BeforeTargets="Build">
<Error Text="blazor.webassembly.js file could not be found at $(BlazorJsPath)" Condition="!Exists($(BlazorJsPath))" />
</Target>

<Import Project="$(MSBuildThisFileDirectory)targets/All.props" />
<Import Project="$(MSBuildThisFileDirectory)targets/All.targets" />

</Project>
17 changes: 1 addition & 16 deletions src/Components/Blazor/Build/src/ReferenceFromSource.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<Project>

<!--
Importing this file is equivalent to having:
<PackageDependency Include="Microsoft.AspNetCore.Blazor.Build" />
... except it's much more convenient when working in this repo, because it consumes the
Blazor.Build targets/exe directly without needing this project to be packed into a .nupkg.
This is only intended for use by other projects in this repo.
-->

<PropertyGroup>
<BlazorBuildReferenceFromSource>true</BlazorBuildReferenceFromSource>
<BlazorJsPath>$(RepoRoot)src\Components\Web.JS\dist\$(Configuration)\blazor.*.js.*</BlazorJsPath>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)targets/All.props" />
<Import Project="$(MSBuildThisFileDirectory)targets/All.targets" />
<Import Project="ReferenceBlazorBuildFromSource.props" />

<!--
Debugging support using blazor-devserver serve.
Expand Down
Loading