-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
517a1cb
More cleaning up Blazor.Build package
pranavkm 5ff734d
Cross-compile the tasks dll
pranavkm c1cc586
Fixup build failures
pranavkm 589e693
Fixup file casing
pranavkm 9fb10c6
Use configuration
pranavkm a47d0cf
Use the same toolset that the rest of the projects use
pranavkm 561cc63
Make builds work when rid is specified
pranavkm a80370a
More fixups!
pranavkm 845f671
Workaround SDK issue
pranavkm 755ebac
Turn off more features
pranavkm 1924d9b
Fixup casing
pranavkm c861818
Add some logging
pranavkm 80b3ef5
Build ordering
pranavkm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
src/Components/Blazor/Build/src/Cli/Commands/ResolveRuntimeDependenciesCommand.cs
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
src/Components/Blazor/Build/src/Cli/Commands/WriteBootJsonCommand.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
56 changes: 45 additions & 11 deletions
56
src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
pranavkm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Target> | ||
|
||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Components/Blazor/Build/src/ReferenceBlazorBuildFromSource.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
pranavkm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 toMicrosoft.AspNetCore.Blazor.Build.Tasks
?Update: never mind, I realise
TargetName
is not the assembly name now.There was a problem hiding this comment.
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.There was a problem hiding this comment.
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