From 0904bdb92075fb712047324b427ac08d66606dfa Mon Sep 17 00:00:00 2001 From: Pure Krome Date: Thu, 13 Sep 2018 13:54:55 +1000 Subject: [PATCH 1/2] Reference class from .NET Core 2.1 instead of a copy. --- .../Tasks/Base/BackgroundTask.cs | 81 ------------------- .../Tasks/GracePeriodManagerTask.cs | 2 +- 2 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 src/Services/Ordering/Ordering.BackgroundTasks/Tasks/Base/BackgroundTask.cs diff --git a/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/Base/BackgroundTask.cs b/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/Base/BackgroundTask.cs deleted file mode 100644 index 6611fc3ab..000000000 --- a/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/Base/BackgroundTask.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Microsoft.Extensions.Hosting; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Ordering.BackgroundTasks.Tasks.Base -{ - // Copyright(c) .NET Foundation.All rights reserved. - // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - /// - /// Base class for implementing a long running . - /// IMPORTANT: This base class is implemented in .NET Core 2.1 - Since this microservice is still in .NET Core 2.0, we're using the class within the project - /// When .NET Core 2.1 is released, this class should be removed and you should use the use implemented by the framework - /// https://github.com/aspnet/Hosting/blob/712c992ca827576c05923e6a134ca0bec87af4df/src/Microsoft.Extensions.Hosting.Abstractions/BackgroundService.cs - /// - /// - public abstract class BackgroundService : IHostedService, IDisposable - { - private Task _executingTask; - - private readonly CancellationTokenSource _stoppingCts = new CancellationTokenSource(); - - /// - /// This method is called when the starts. The implementation should return a task that represents - /// the lifetime of the long running operation(s) being performed. - /// - /// Triggered when is called. - /// A that represents the long running operations. - protected abstract Task ExecuteAsync(CancellationToken stoppingToken); - - /// - /// Triggered when the application host is ready to start the service. - /// - /// Indicates that the start process has been aborted. - public virtual Task StartAsync(CancellationToken cancellationToken) - { - // Store the task we're executing - _executingTask = ExecuteAsync(_stoppingCts.Token); - - // If the task is completed then return it, this will bubble cancellation and failure to the caller - if (_executingTask.IsCompleted) - { - return _executingTask; - } - - // Otherwise it's running - return Task.CompletedTask; - } - - /// - /// Triggered when the application host is performing a graceful shutdown. - /// - /// Indicates that the shutdown process should no longer be graceful. - public virtual async Task StopAsync(CancellationToken cancellationToken) - { - // Stop called without start - if (_executingTask == null) - { - return; - } - - try - { - // Signal cancellation to the executing method - _stoppingCts.Cancel(); - } - finally - { - // Wait until the task completes or the stop token triggers - await Task.WhenAny(_executingTask, Task.Delay(Timeout.Infinite, cancellationToken)); - } - - } - - public virtual void Dispose() - { - _stoppingCts.Cancel(); - } - } -} diff --git a/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/GracePeriodManagerTask.cs b/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/GracePeriodManagerTask.cs index c89b8cbf3..fbf92f978 100644 --- a/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/GracePeriodManagerTask.cs +++ b/src/Services/Ordering/Ordering.BackgroundTasks/Tasks/GracePeriodManagerTask.cs @@ -1,10 +1,10 @@ using Dapper; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Ordering.BackgroundTasks.Configuration; using Ordering.BackgroundTasks.IntegrationEvents; -using Ordering.BackgroundTasks.Tasks.Base; using System; using System.Collections.Generic; using System.Data.SqlClient; From 43c15802c183274d4cc3bd06812a05a285b1a229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Thu, 20 Sep 2018 12:27:49 +0200 Subject: [PATCH 2/2] Fixed bug #729 Removed bower in web MVC app --- src/Web/WebMVC/.bowerrc | 3 --- src/Web/WebMVC/Dockerfile | 8 -------- src/Web/WebMVC/WebMVC.csproj | 1 + src/Web/WebMVC/bower.json | 10 ---------- src/Web/WebMVC/libman.json | 19 +++++++++++++++++++ 5 files changed, 20 insertions(+), 21 deletions(-) delete mode 100644 src/Web/WebMVC/.bowerrc delete mode 100644 src/Web/WebMVC/bower.json create mode 100644 src/Web/WebMVC/libman.json diff --git a/src/Web/WebMVC/.bowerrc b/src/Web/WebMVC/.bowerrc deleted file mode 100644 index 6406626ab..000000000 --- a/src/Web/WebMVC/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "wwwroot/lib" -} diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index 9847ad772..11315ae0c 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -6,15 +6,7 @@ EXPOSE 80 FROM microsoft/dotnet:2.1-sdk as dotnet-build WORKDIR /src -FROM ${NODE_IMAGE} as node-build -WORKDIR /web -COPY src/Web/WebMVC . -RUN npm install -g bower@1.8.4 -RUN bower install --allow-root - FROM dotnet-build as build -WORKDIR /src/src/Web/WebMVC/wwwroot -COPY --from=node-build /web/wwwroot . WORKDIR /src COPY . . WORKDIR /src/src/Web/WebMVC diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 1426517d3..5bd9b5f81 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -28,6 +28,7 @@ + diff --git a/src/Web/WebMVC/bower.json b/src/Web/WebMVC/bower.json deleted file mode 100644 index f6d44b1c0..000000000 --- a/src/Web/WebMVC/bower.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "asp.net", - "private": true, - "dependencies": { - "bootstrap": "v3.3.7", - "jquery": "2.2.0", - "jquery-validation": "1.14.0", - "jquery-validation-unobtrusive": "3.2.6" - } -} diff --git a/src/Web/WebMVC/libman.json b/src/Web/WebMVC/libman.json new file mode 100644 index 000000000..127c2bcaf --- /dev/null +++ b/src/Web/WebMVC/libman.json @@ -0,0 +1,19 @@ +{ + "version": "1.0", + "defaultProvider": "cdnjs", + "libraries": [ + { + "library": "jquery@3.3.1", + "destination": "wwwroot/lib/jquery/" + }, + { + "provider": "unpkg", + "library": "bootstrap@3.3.7", + "destination": "wwwroot/lib/bootstrap/" + }, + { + "library": "jquery-validation-unobtrusive@3.2.10", + "destination": "wwwroot/lib/jquery-validation-unobtrusive/" + } + ] +} \ No newline at end of file