Skip to content
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
7 changes: 3 additions & 4 deletions docs/BuildFromSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The steps you follow next depend on your preferred development environment:

## Visual Studio on Windows

1. This repo has JavaScript dependencies, so you need [Node.js](https://nodejs.org/en/). [Yarn](https://yarnpkg.com/) version 1.x will be installed automatically using `npm`, if you have already installed it with a version >= 2.x then you may have to uninstall it as it is not compatible with the aspnetcore build script.
1. This repo has JavaScript dependencies, so you need [Node.js](https://nodejs.org/en/).

1. Before you open project in Visual Studio, install the required dependencies and set up the repo by running the `restore.cmd` script in the root of the repo:

Expand Down Expand Up @@ -89,7 +89,7 @@ The steps you follow next depend on your preferred development environment:

1. To use Visual Studio Code for developing in this repo, you need [Visual Studio Code installed](https://code.visualstudio.com/) and the ability to [launch `code` from the command line](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line).

1. This repo has JavaScript dependencies, so you need [Node.js](https://nodejs.org/en/). [Yarn](https://yarnpkg.com/) version 1.x will be installed automatically using `npm`, if you have already installed it with a version >= 2.x then you may have to uninstall it as it is not compatible with the aspnetcore build script.
1. This repo has JavaScript dependencies, so you need [Node.js](https://nodejs.org/en/).

1. Before you open anything in Visual Studio Code, run the `restore` script in the root of the repo to install the required .NET dependencies.

Expand Down Expand Up @@ -235,5 +235,4 @@ To support building and testing the projects in the repo, several dependencies m
| [Chrome](https://www.google.com/chrome/) | Required when running tests with Selenium or Playwright in the projects above. When using Playwright, the dependency is automatically installed. | |
| [Java Development Kit (v11 or newer)](https://jdk.java.net/) | Required when building the Java SignalR client. Can be installed using the `./eng/scripts/InstallJdk.ps1` script on Windows. | Ensure that the `JAVA_HOME` directory points to the installation and that the `PATH` has been updated to include the `$(jdkInstallDir)/bin` folder. |
| [Wix](https://wixtoolset.org/releases/) | Required when working with the Windows installers in the [Windows installers project](https://github.com/dotnet/aspnetcore/tree/main/src/Installers/Windows). | |
| [Node.js](https://nodejs.org/en/) | Used for building JavaScript assets in the repo, such as those in Blazor and SignalR. | Required a minimum version of the current NodeJS LTS. |
| [Yarn](https://yarnpkg.com/) | Used for installing JavaScript dependencies in the repo, such as those in Blazor and SignalR. | |
| [Node.js](https://nodejs.org/en/) | Used for building JavaScript assets in the repo, such as those in Blazor and SignalR. | Required a minimum version of the current NodeJS LTS. |
2 changes: 0 additions & 2 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@
<ProjectToBuild Condition=" '$(BuildNodeJS)' == 'true'" Include="@(NodeJsProjects)" Exclude="@(ProjectToExclude)" />
<ProjectToExclude Condition=" '$(BuildNodeJS)' != 'true'" Include="@(NodeJsProjects)" />

<ProjectToExclude Condition=" '$(DotNetBuildFromSource)' == 'true'" Include="@(YarnMSBuildProjects)" />

<JavaProjects Include="$(RepoRoot)src\SignalR\**\*.javaproj"
Exclude="@(ProjectToExclude)" />

Expand Down
17 changes: 17 additions & 0 deletions eng/Npm.Workspace.nodeproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@
<Exec Command="node $(MSBuildThisFileDirectory)scripts\pack-workspace.js $(RepoRoot)package.json $(PackageVersion) $(PackageOutputPath)" />
</Target>

<Target Name="_GetPackageVersionInfo" Returns="@(_NodePackageNameAndVersions)">
<Exec Command="npm run get-version" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" ItemName="_GetNpmVersionOutput" />
</Exec>
<ItemGroup>
<_FilteredNpmVersionOuput Include="@(_GetNpmVersionOutput)" Condition="'%(Identity)' == '' or $([System.String]::Copy('%(Identity)').StartsWith('>')) " />
<_NodePackageNameAndVersions Include="@(_GetNpmVersionOutput)" Exclude="@(_FilteredNpmVersionOuput)">
</_NodePackageNameAndVersions>
<_NodePackageNameAndVersions Condition="$([System.String]::new('%(_NodePackageNameAndVersions.Identity)').Contains(';'))">
<PackageName>$([System.String]::new('%(_NodePackageNameAndVersions.Identity)').Split(';')[0])</PackageName>
<PackageVersion>$([System.String]::new('%(_NodePackageNameAndVersions.Identity)').Split(';')[1])</PackageVersion>
</_NodePackageNameAndVersions>
</ItemGroup>

<Message Text="Computed package version info: %(_NodePackageNameAndVersions.PackageName)=%(_NodePackageNameAndVersions.PackageVersion)" Importance="high" />
</Target>

<!-- Import Directory.Build.targets -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />

Expand Down
22 changes: 15 additions & 7 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@
version string to use as our publish location), non-packed (won't be shipped in the future), and it is _not_ a
C# or F# project. For now at least, C# and F# projects should not be referenced when using desktop msbuild.
-->
<MSBuild Projects="$(RepoRoot)src\SignalR\clients\ts\FunctionalTests\SignalR.Npm.FunctionalTests.nodeproj"
Properties="DisableYarnCheck=true;ExcludeFromBuild=false"
<MSBuild Projects="$(RepoRoot)eng\Npm.Workspace.nodeproj"
Properties="ExcludeFromBuild=false"
Targets="_GetPackageVersionInfo">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedPackageVersionInfo" />
</MSBuild>

<PropertyGroup>
<!-- _GetPackageVersionInfo will return all the versions for all public/shipping packages.
They are all the same, so we just take the last one.
If this changes in the future, we'll have to update this logic.
-->
<_PackageVersion>@(_ResolvedPackageVersionInfo->'%(PackageVersion)')</_PackageVersion>
</PropertyGroup>

Expand Down Expand Up @@ -101,19 +105,23 @@
Name="_WriteProductVersionFile"
Condition=" '$(PublishInstallerBaseVersion)' == 'true'">
<!--
This target is defined in eng/targets/Packaging.targets and Npm.Common.targets and included in every C#, F#,
and npm project. We use Microsoft.JSInterop.JS.nodeproj because it is shipping (we need a stable
This target is defined in eng/targets/Packaging.targets and Npm.Workspace.nodeproj and included in every C#, F#,
and JS project. We use Microsoft.JSInterop.JS.nodeproj because it is shipping (we need a stable
version string to use for productVersion.txt), and because it won't break when the SDK requires a newer
desktop MSBuild than exists on the build machine.
-->
<MSBuild Projects="$(RepoRoot)src\JSInterop\Microsoft.JSInterop.JS\src\Microsoft.JSInterop.JS.nodeproj"
Properties="DisableYarnCheck=true;ExcludeFromBuild=false"
<MSBuild Projects="$(RepoRoot)eng\Npm.Workspace.nodeproj"
Properties="ExcludeFromBuild=false"
Targets="_GetPackageVersionInfo">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProductVersionInfo" />
</MSBuild>

<PropertyGroup>
<_ProductVersion>@(_ResolvedProductVersionInfo->'%(PackageVersion)')</_ProductVersion>
<!-- _GetPackageVersionInfo will return all the versions for all public/shipping packages.
They are all the same, so we just take the last one.
If this changes in the future, we'll have to update this logic.
-->
<_ProductVersion>%(_ResolvedProductVersionInfo.PackageVersion)</_ProductVersion>
</PropertyGroup>

<!-- Generate productVersion.txt containing the value of $(PackageVersion) -->
Expand Down
11 changes: 0 additions & 11 deletions eng/Tools.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
<Project>
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' ">
<!--
This is here to workaround flakiness in the NuGet SDK resolver in MSBuild. Arcade will run a pre-restore for
these packages. This works more consistently than the SDK resolution which uses global.json. Without this
here, we see regular failures with 'error MSB4236: The SDK 'Yarn.MSBuild' specified could not be found.'
Since this project is evaluated before .nodeproj files are loaded, this should cause the package to end up in
the NuGet cache ahead of time. This is not needed in source build.
-->
<PackageReference Include="Yarn.MSBuild" Version="1.22.10" />
</ItemGroup>

<!-- Update the generated files when we restore projects. Skip in desktop msbuild due to VS 16.8 requirements. -->
<Target Name="GenerateDirectoryBuildFiles"
AfterTargets="Restore"
Expand Down
2 changes: 1 addition & 1 deletion eng/helix/helix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
-->
<Target Name="IncludeAspNetRuntime" BeforeTargets="Gather">
<MSBuild Projects="$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj"
Properties="DisableYarnCheck=true;ExcludeFromBuild=false"
Properties="ExcludeFromBuild=false"
Targets="_GetPackageVersionInfo">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProductVersionInfo" />
</MSBuild>
Expand Down
6 changes: 3 additions & 3 deletions eng/scripts/CodeCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ try {
}

#
# Check for unexpected (not from dotnet-public-npm) yarn resolutions in lock files.
# Check for unexpected (not from dotnet-public-npm) npm resolutions in lock files.
#

$registry = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/'
Get-ChildItem src\yarn.lock -Recurse |
Get-ChildItem src\package-lock.json -Recurse |
ForEach-Object FullName |
Where-Object {$_ -NotLike '*\node_modules\*'} |
ForEach-Object {
Expand All @@ -104,7 +104,7 @@ try {
} |
ForEach-Object {
LogError -filePath "${_.Path}" -lineNumber $_.LineNumber `
"Packages in yarn.lock file resolved from wrong registry. All dependencies must be resolved from $registry"
"Packages in package-lock.json file resolved from wrong registry. All dependencies must be resolved from $registry"
}

#
Expand Down
5 changes: 0 additions & 5 deletions eng/targets/CSharp.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@
</Content>
</ItemDefinitionGroup>

<!-- Properties to control how we handle warnings when using the tasks provided by the Yarn MSBuild SDK -->
<PropertyGroup>
<IgnoreYarnWarnings>false</IgnoreYarnWarnings>
<IgnoreYarnWarnings Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</IgnoreYarnWarnings>
</PropertyGroup>
</Project>
1 change: 0 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"xcopy-msbuild": "17.1.0"
},
"msbuild-sdks": {
"Yarn.MSBuild": "1.22.10",
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23619.4",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23619.4"
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"lint": "npm run lint --workspaces --if-present",
"test": "npm run test --workspaces --if-present",
"integration-test": "npm run integration-test --workspaces --if-present",
"coverage": "npm run coverage --workspaces --if-present"
"coverage": "npm run coverage --workspaces --if-present",
"get-version": "npm run get-version --workspaces --if-present"
},
"overrides": {
"got": "^11.8.2",
Expand Down
2 changes: 1 addition & 1 deletion src/Components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To build this specific project from source, follow the instructions [on building

Prior to building `src\Components\Web.JS\`

1. You'll need to install [Node](https://nodejs.org) and [yarn](https://yarnpkg.com) on your machine.
1. You'll need to install [Node](https://nodejs.org) on your machine.

2. You'll need to run the `restore` script locally to install the required dotnet dependencies and setup the repo. The `restore` script is located in the root of the repo.

Expand Down
3 changes: 2 additions & 1 deletion src/JSInterop/Microsoft.JSInterop.JS/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"clean": "npx rimraf ./dist",
"build": "npm run clean && npm run build:esm",
"build:lint": "eslint -c .eslintrc.json --ext .ts ./src",
"build:esm": "npx tsc --project ./tsconfig.json"
"build:esm": "npx tsc --project ./tsconfig.json",
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:esm": "tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
"build:cjs": "tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
"build:browser": "webpack-cli",
"build:uglify": "terser -m -c --ecma 2019 --module --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js"
"build:uglify": "terser -m -c --ecma 2019 --module --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
},
"keywords": [
"signalr",
Expand Down
3 changes: 2 additions & 1 deletion src/SignalR/clients/ts/signalr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:esm": "tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
"build:cjs": "tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
"build:browser": "webpack-cli",
"build:webworker": "webpack-cli --env platform=webworker"
"build:webworker": "webpack-cli --env platform=webworker",
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
},
"keywords": [
"signalr",
Expand Down
2 changes: 1 addition & 1 deletion src/SignalR/docs/JSFunctionalTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Our JavaScript client functional tests are written using [Jasmine](https://jasmi

### Iterating

The `npm test` command will take a while, because it will build the `clients\ts\signalr`, `clients\ts\signalr-protocol-msgpack` and `clients\ts\FunctionalTests` folders as well as `dotnet build` the `clients\ts\FunctionalTests` folder (to build the server-side components). If you are making changes, it's nice to be able to build only the things you need to build. To skip all the optional build steps, you can run `yarn run test:inner` in `clients\ts\FunctionalTests`. This will skip building `clients\ts\signalr` and `clients\signalr-protocol-msgpack` (it will still build the `clients\ts\FunctionalTests` folder). If you make changes to those libraries, you have to manually build those directories.
The `npm test` command will take a while, because it will build the `clients\ts\signalr`, `clients\ts\signalr-protocol-msgpack` and `clients\ts\FunctionalTests` folders as well as `dotnet build` the `clients\ts\FunctionalTests` folder (to build the server-side components). If you are making changes, it's nice to be able to build only the things you need to build. To skip all the optional build steps, you can run `npm run test:inner` in `clients\ts\FunctionalTests`. This will skip building `clients\ts\signalr` and `clients\signalr-protocol-msgpack` (it will still build the `clients\ts\FunctionalTests` folder). If you make changes to those libraries, you have to manually build those directories.

## Running tests from the browser

Expand Down