Skip to content

Improve components infrastructure #12024

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

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 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
4 changes: 4 additions & 0 deletions docs/BuildFromSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Building ASP.NET Core on Windows requires:
```ps1
PS> ./eng/scripts/InstallJdk.ps1
```
* Yarn <https://yarnpkg.com> is required if you are building JS components. For example, this may be required for building Components and SignalR.

### macOS/Linux

Expand All @@ -40,6 +41,7 @@ Building ASP.NET Core on macOS or Linux requires:
* Java Development Kit 11 or newer. Either:
* OpenJDK <https://jdk.java.net/>
* Oracle's JDK <https://www.oracle.com/technetwork/java/javase/downloads/index.html>
* Yarn <https://yarnpkg.com> is required if you are building JS components. For example, this may be required for building Components and SignalR.

## Clone the source code

Expand Down Expand Up @@ -129,6 +131,8 @@ On macOS/Linux:
./build.sh
```

By default, only the C# projects are built. Some sub-areas have additional requirements, such as needing Yarn to be installed, before being able to build successfully.

### Using `dotnet` on command line in this repo

Because we are using pre-release versions of .NET Core, you have to set a handful of environment variables
Expand Down
2 changes: 2 additions & 0 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$(RepoRoot)src\submodules\**\*.*proj;
$(RepoRoot)src\Installers\**\*.*proj;
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*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 Expand Up @@ -103,6 +104,7 @@

<NodeJsProjects Include="
$(RepoRoot)src\SignalR\**\*.npmproj;
$(RepoRoot)src\Components\**\*.npmproj;
$(RepoRoot)src\Middleware\**\*.npmproj;
"
RestoreInParallel="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<ReferenceBlazorBuildLocally>true</ReferenceBlazorBuildLocally>
<ReferenceBlazorBuildLocally Condition="'$(BuildNodeJS)' == 'true'">true</ReferenceBlazorBuildLocally>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Blazor" />
<ProjectReference Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssemblies="false" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReferenceBlazorBuildLocally>true</ReferenceBlazorBuildLocally>
<ReferenceBlazorBuildLocally Condition="'$(BuildNodeJS)' == 'true'">true</ReferenceBlazorBuildLocally>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Blazor" />
<ProjectReference Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssemblies="false" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
<OutputType>exe</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>

<ReferenceBlazorBuildLocally>true</ReferenceBlazorBuildLocally>
<ReferenceBlazorBuildLocally Condition="'$(BuildNodeJS)' == 'true'">true</ReferenceBlazorBuildLocally>
<!-- loader.js is hard-coded to assume it can load .pdbs regardless of Debug/Release configuration -->
<BlazorEnableDebugging>true</BlazorEnableDebugging>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssemblies="false" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReferenceBlazorBuildLocally>true</ReferenceBlazorBuildLocally>
<ReferenceBlazorBuildLocally Condition="'$(BuildNodeJS)' == 'true'">true</ReferenceBlazorBuildLocally>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Blazor" />
<Reference Include="Microsoft.AspNetCore.Blazor.HttpClient" />
<ProjectReference Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssemblies="false" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<Reference Include="Microsoft.Extensions.Caching.Memory" />
<Reference Include="Microsoft.Extensions.FileProviders.Composite" />
<Reference Include="Microsoft.Extensions.FileProviders.Embedded" />

<ProjectReference Include="..\..\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" />
</ItemGroup>

<PropertyGroup>
Expand Down Expand Up @@ -51,17 +53,21 @@
</ItemGroup>

<PropertyGroup>
<!--
We check in the Release / Production build of blazor.*.js, but not the Debug builds. Consequently the former is always available to embed, the latter is only available
if Web.JS was built locally. Use the Debug build when available and building in Debug configuration.
-->
<BlazorServerJSFile>..\..\Web.JS\dist\Release\blazor.server.js</BlazorServerJSFile>
<BlazorServerJSFile Condition="'$(Configuration)' == 'Debug' AND Exists('..\..\Web.JS\dist\Debug\blazor.server.js')">..\..\Web.JS\dist\Debug\blazor.server.js</BlazorServerJSFile>
<BlazorServerJSFile>..\..\Web.JS\dist\$(Configuration)\blazor.server.js</BlazorServerJSFile>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="$(BlazorServerJSFile)" LogicalName="_framework/%(Filename)%(Extension)" />
<EmbeddedResource Include="$(BlazorServerJSFile)" LogicalName="_framework/%(Filename)%(Extension)" Condition="Exists('$(BlazorServerJSFile)')" />
<EmbeddedResource Include="$(BlazorServerJSFile).map" LogicalName="_framework/%(Filename)%(Extension)" Condition="Exists('$(BlazorServerJSFile).map')" />
</ItemGroup>

<Target Name="VerifyBlazorServerJSFileExists" BeforeTargets="PrepareForBuild">
<Warning
Text="Blazor server JS files not found and will not be embedded. Set BuildNodeJS to true or build the Microsoft.AspNetCore.Components.Web.JS.npmproj before building this project."
Condition="!Exists('$(BlazorServerJSFile)')" />
<Error
Text="Blazor server JS files not found and will not be embedded. Set BuildNodeJS to true or build the Microsoft.AspNetCore.Components.Web.JS.npmproj before building this project."
Condition="!Exists('$(BlazorServerJSFile)') and '$(Configuration)' == 'Release'" />
</Target>

</Project>
2 changes: 1 addition & 1 deletion src/Components/Web.JS/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
dist/Debug/
dist/
3 changes: 0 additions & 3 deletions src/Components/Web.JS/dist/.gitattributes

This file was deleted.

15 changes: 0 additions & 15 deletions src/Components/Web.JS/dist/Release/blazor.server.js

This file was deleted.

1 change: 0 additions & 1 deletion src/Components/Web.JS/dist/Release/blazor.webassembly.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>

<ReferenceBlazorBuildLocally>true</ReferenceBlazorBuildLocally>
<ReferenceBlazorBuildLocally Condition="'$(BuildNodeJS)' == 'true'">true</ReferenceBlazorBuildLocally>
<!-- Must be defined before ReferenceFromSource.props is imported -->
<AdditionalRunArguments>--pathbase /subdir</AdditionalRunArguments>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/E2ETesting/E2ETesting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Importance="High"
Text="Prerequisites were not enforced at build time. Running Yarn or the E2E tests might fail as a result. Check /src/Shared/E2ETesting/Readme.md for instructions." />

<Yarn Command="install --mutex network" />
<Yarn Command="install --mutex network" Condition="'$(EnforceE2ETestPrerequisites)' == 'true'"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

WIP, I think this will break some dev workflows. Don't check this in yet.

</Target>

<Target
Expand Down