From 75b8249e6e139cdd2eab983c2e5a586c95492385 Mon Sep 17 00:00:00 2001 From: moozzyk Date: Fri, 24 Feb 2017 14:38:20 -0800 Subject: [PATCH] MSBuildifying gulpified node - Creating an MSBuild project for the TS client - Adding project references to the TS client project from projects that need the client - (ensures the correct targets dependency graph and prevents building the client multiple times and related races) - Removing gulp tasks from individual projects (allows containing npm only in the TS client source and node tests) - Using incremental compilation to build the TS client only when inputs change (prevents building the client multiple times or when not needed at all) - Removing `npm install` from all the projects (takes up to 10 seconds even if there is nothing to restore) - npm packages will still be installed when running full build (if needed) or need to be installed manually --- SignalR.sln | 9 +++++- build/repo.targets | 4 --- package.json | 3 +- samples/ChatSample/ChatSample.csproj | 16 ++++------ samples/SocketsSample/SocketsSample.csproj | 16 ++++------ ...rosoft.AspNetCore.SignalR.Client.TS.csproj | 32 +++++++++++++++++++ .../gulpfile.js | 11 ------- ...soft.AspNetCore.SignalR.Test.Server.csproj | 25 +++++---------- 8 files changed, 62 insertions(+), 54 deletions(-) create mode 100644 src/Microsoft.AspNetCore.SignalR.Client.TS/Microsoft.AspNetCore.SignalR.Client.TS.csproj diff --git a/SignalR.sln b/SignalR.sln index 04e2e7cc18..dff6189146 100644 --- a/SignalR.sln +++ b/SignalR.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26208.0 +VisualStudioVersion = 15.0.26222.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DA69F624-5398-4884-87E4-B816698CDE65}" EndProject @@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Socket EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Sockets.Common.Tests", "test\Microsoft.AspNetCore.Sockets.Common.Tests\Microsoft.AspNetCore.Sockets.Common.Tests.csproj", "{B0D32729-48AA-4841-B52A-2A61B60EED61}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SignalR.Client.TS", "src\Microsoft.AspNetCore.SignalR.Client.TS\Microsoft.AspNetCore.SignalR.Client.TS.csproj", "{333526A4-633B-491A-AC45-CC62A0012D1C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -157,6 +159,10 @@ Global {B0D32729-48AA-4841-B52A-2A61B60EED61}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0D32729-48AA-4841-B52A-2A61B60EED61}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0D32729-48AA-4841-B52A-2A61B60EED61}.Release|Any CPU.Build.0 = Release|Any CPU + {333526A4-633B-491A-AC45-CC62A0012D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {333526A4-633B-491A-AC45-CC62A0012D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {333526A4-633B-491A-AC45-CC62A0012D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {333526A4-633B-491A-AC45-CC62A0012D1C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -185,5 +191,6 @@ Global {455B68D2-C5B6-4BF4-A685-964B07AFAAF8} = {6A35B453-52EC-48AF-89CA-D4A69800F131} {F3EFFD9F-DD85-48A2-9B11-83A133ECC099} = {DA69F624-5398-4884-87E4-B816698CDE65} {B0D32729-48AA-4841-B52A-2A61B60EED61} = {6A35B453-52EC-48AF-89CA-D4A69800F131} + {333526A4-633B-491A-AC45-CC62A0012D1C} = {DA69F624-5398-4884-87E4-B816698CDE65} EndGlobalSection EndGlobal diff --git a/build/repo.targets b/build/repo.targets index 9053e7ccc9..27006f18d3 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -1,8 +1,4 @@ - - - - diff --git a/package.json b/package.json index 061535d7bb..3f6b2d20fa 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "gulp-typescript": "^3.1.3", "jasmine": "^2.5.2", "typescript": "^2.0.10", - "vinyl-source-stream": "^1.1.0", - "yargs": "^6.4.0" + "vinyl-source-stream": "^1.1.0" } } diff --git a/samples/ChatSample/ChatSample.csproj b/samples/ChatSample/ChatSample.csproj index f79a506835..b12a934219 100644 --- a/samples/ChatSample/ChatSample.csproj +++ b/samples/ChatSample/ChatSample.csproj @@ -12,6 +12,7 @@ + @@ -36,16 +37,13 @@ - + - - ..\..\dist\browser\signalr-client.js - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/ - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/signalr-client.js - - - - + + + + diff --git a/samples/SocketsSample/SocketsSample.csproj b/samples/SocketsSample/SocketsSample.csproj index b39a13e21a..41d5720908 100644 --- a/samples/SocketsSample/SocketsSample.csproj +++ b/samples/SocketsSample/SocketsSample.csproj @@ -11,21 +11,17 @@ + + - - - ..\..\dist\browser\signalr-client.js - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/ - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/signalr-client.js - - - - + + - + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.SignalR.Client.TS/Microsoft.AspNetCore.SignalR.Client.TS.csproj b/src/Microsoft.AspNetCore.SignalR.Client.TS/Microsoft.AspNetCore.SignalR.Client.TS.csproj new file mode 100644 index 0000000000..05f039824c --- /dev/null +++ b/src/Microsoft.AspNetCore.SignalR.Client.TS/Microsoft.AspNetCore.SignalR.Client.TS.csproj @@ -0,0 +1,32 @@ + + + + + + netstandard1.0 + false + + + + $(MSBuildThisFileDirectory)..\..\dist\ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.AspNetCore.SignalR.Client.TS/gulpfile.js b/src/Microsoft.AspNetCore.SignalR.Client.TS/gulpfile.js index d886f419f3..e77311aac7 100644 --- a/src/Microsoft.AspNetCore.SignalR.Client.TS/gulpfile.js +++ b/src/Microsoft.AspNetCore.SignalR.Client.TS/gulpfile.js @@ -3,7 +3,6 @@ const browserify = require('browserify'); const ts = require('gulp-typescript'); const source = require('vinyl-source-stream'); const del = require('del'); -const argv = require('yargs').argv; const tsProject = ts.createProject('./tsconfig.json'); const clientOutDir = tsProject.options.outDir; @@ -27,14 +26,4 @@ gulp.task('browserify-client', ['compile-ts-client'], () => { gulp.task('build-ts-client', ['clean', 'compile-ts-client', 'browserify-client']); -gulp.task('bundle-client', ['build-ts-client'], () => { - if (!argv.bundleOutDir) { - console.log('Use \'--bundleOutDir\' option to specify the target file for the bundled client.'); - } - else { - return gulp.src(clientOutDir + '/../browser/signalr-client.js') - .pipe(gulp.dest(argv.bundleOutDir)); - } -}); - gulp.task('default', ['build-ts-client']); \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj b/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj index 1036e5990b..2e11c8a38c 100644 --- a/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj +++ b/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj @@ -3,11 +3,12 @@ - netcoreapp1.1;net46 + netcoreapp1.1 + @@ -15,26 +16,16 @@ - - - - - + + - - + + - - - - ..\..\dist\browser\signalr-client.js - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/ - $(MSBuildProjectDirectory)/wwwroot/lib/signalr-client/signalr-client.js - - - +