From 9d39e11faa459f2f816b0e8bdb51413d2488d7ee Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 11:11:38 +0300 Subject: [PATCH 01/18] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20submodule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Include/OneScript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Include/OneScript b/src/Include/OneScript index 474406e..6e3d3df 160000 --- a/src/Include/OneScript +++ b/src/Include/OneScript @@ -1 +1 @@ -Subproject commit 474406e7b2b78766d53f53e9f4e4248c23c9b975 +Subproject commit 6e3d3df01d1196c7afac04dd4d17ccade41e11af From c930bd4b792ed4d14e076fd474b71c5eb1d20c55 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 11:12:04 +0300 Subject: [PATCH 02/18] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20?= =?UTF-8?q?=D0=BD=D0=B0=20netcoreapp=203.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript/Identity/IdentityExtensions.cs | 2 +- src/OneScript/Infrastructure/AppStarter.cs | 1 - .../Infrastructure/IApplicationRuntime.cs | 2 ++ .../OscriptApplicationModelProvider.cs | 3 +- .../OscriptViewComponentInvokerFactory.cs | 4 --- .../ScriptedMiddlewareActivator.cs | 23 +++++++++--- .../ScriptedViewComponentFeatureProvider.cs | 10 +++--- .../Infrastructure/OneScriptServicePlugin.cs | 2 +- .../Infrastructure/WebApplicationEngine.cs | 8 ++++- src/OneScript/OneScriptWeb.csproj | 2 +- src/OneScript/Startup.cs | 3 +- src/OneScriptWeb.Tests/AppModelTests.cs | 12 ++----- .../ApplicationStartupTests.cs | 8 ++--- .../HttpRequestResponseTests.cs | 19 +++++++--- .../OneScriptWeb.Tests.csproj | 2 +- .../ViewComponentDiscoveryTest.cs | 35 ++++++++++--------- 16 files changed, 77 insertions(+), 59 deletions(-) diff --git a/src/OneScript/Identity/IdentityExtensions.cs b/src/OneScript/Identity/IdentityExtensions.cs index 8b009c4..e9e4c6c 100644 --- a/src/OneScript/Identity/IdentityExtensions.cs +++ b/src/OneScript/Identity/IdentityExtensions.cs @@ -40,7 +40,7 @@ public static void AddIdentityByConfiguration(this IServiceCollection services, options.AccessDeniedPath = cookieOpts["AccessDeniedPath"] ?? options.AccessDeniedPath; options.ExpireTimeSpan = cookieOpts["ExpireTimeSpan"] == null? options.ExpireTimeSpan : TimeSpan.Parse(cookieOpts["ExpireTimeSpan"]); options.ReturnUrlParameter = cookieOpts["ReturnUrlParameter"] ?? options.ReturnUrlParameter; - options.CookieName = cookieOpts["CookieName"] ?? "OscriptWeb.Identity.Application"; + options.Cookie.Name = cookieOpts["CookieName"] ?? "OscriptWeb.Identity.Application"; cookieOpts.Bind("Cookie", options.Cookie); }); diff --git a/src/OneScript/Infrastructure/AppStarter.cs b/src/OneScript/Infrastructure/AppStarter.cs index 1cc304d..1c71ce1 100644 --- a/src/OneScript/Infrastructure/AppStarter.cs +++ b/src/OneScript/Infrastructure/AppStarter.cs @@ -2,7 +2,6 @@ using System.IO; using System.Linq; using System.Reflection; -using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging; diff --git a/src/OneScript/Infrastructure/IApplicationRuntime.cs b/src/OneScript/Infrastructure/IApplicationRuntime.cs index 4b345a7..f6feae1 100644 --- a/src/OneScript/Infrastructure/IApplicationRuntime.cs +++ b/src/OneScript/Infrastructure/IApplicationRuntime.cs @@ -7,5 +7,7 @@ public interface IApplicationRuntime { ScriptingEngine Engine { get; } RuntimeEnvironment Environment { get; } + + CompilerService GetCompilerService(); } } \ No newline at end of file diff --git a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs index 0668302..cc75128 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc.ActionConstraints; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.Authorization; -using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders.Physical; @@ -254,7 +253,7 @@ public static AuthorizeFilter GetFilter(IAuthorizationPolicyProvider policyProvi private LoadedModule LoadControllerCode(ICodeSource src) { - var compiler = _fw.Engine.GetCompilerService(); + var compiler = _fw.GetCompilerService(); var byteCode = ScriptedController.CompileModule(compiler, src); return _fw.Engine.LoadModuleImage(byteCode); } diff --git a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs index d0380b2..108b434 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.AspNetCore.Mvc.ViewComponents; -using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; -using Microsoft.Extensions.Logging; namespace OneScript.WebHost.Infrastructure.Implementations { diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs index 1c8e390..c7a0661 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs @@ -17,13 +17,17 @@ public class ScriptedMiddlewareActivator private readonly LoadedModule _module; private readonly IApplicationRuntime _runtime; - public ScriptedMiddlewareActivator(RequestDelegate next, IFileProvider scripts, IApplicationRuntime runtime, string scriptName) + public ScriptedMiddlewareActivator( + RequestDelegate next, + IFileProvider scripts, + IApplicationRuntime runtime, + string scriptName) { _next = next; _runtime = runtime; var codeSrc = new FileInfoCodeSource(scripts.GetFileInfo(scriptName)); - var image = ScriptedMiddleware.CompileModule(runtime.Engine.GetCompilerService(), codeSrc); - _module = new LoadedModule(image); + var image = ScriptedMiddleware.CompileModule(_runtime.GetCompilerService(), codeSrc); + _module = _runtime.Engine.LoadModuleImage(image); } public async Task InvokeAsync(HttpContext context) @@ -32,8 +36,17 @@ public async Task InvokeAsync(HttpContext context) var instance = new ScriptedMiddleware(_next, _module); var machine = MachineInstance.Current; engine.Environment.LoadMemory(machine); - engine.InitializeSDO(instance); - await instance.InvokeAsync(context); + try + { + _runtime.DebugCurrentThread(); + engine.InitializeSDO(instance); + await instance.InvokeAsync(context); + } + finally + { + _runtime.StopDebugCurrentThread(); + } + } } } diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs b/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs index a277c55..e7fc3b2 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs @@ -20,7 +20,7 @@ public class ScriptedViewComponentFeatureProvider : IApplicationFeatureProvider< { public ApplicationInstance Application { get; set; } public IFileProvider ScriptsProvider { get; set; } - public ScriptingEngine Engine { get; set; } + public IApplicationRuntime Runtime { get; set; } private TypeInfo[] _discoveredTypes; @@ -29,7 +29,7 @@ public void Configure(IServiceProvider services) // в режиме тестирования app-instance может быть null Application = services.GetService(); ScriptsProvider = services.GetRequiredService(); - Engine = services.GetRequiredService().Engine; + Runtime = services.GetRequiredService(); } public void PopulateFeature(IEnumerable parts, ViewComponentFeature feature) @@ -69,7 +69,7 @@ private void FillFeature(List sources) foreach (var virtualPath in sources) { var code = new FileInfoCodeSource(virtualPath); - var compiler = Engine.GetCompilerService(); + var compiler = Runtime.GetCompilerService(); var img = ScriptedViewComponent.CompileModule(compiler,code); var invokatorExist = img.Methods.Any(x => StringComparer.OrdinalIgnoreCase.Compare(ScriptedViewComponent.InvokeMethodNameRu, x.Signature.Name) == 0 @@ -78,8 +78,8 @@ private void FillFeature(List sources) if(!invokatorExist) continue; - var module = Engine.LoadModuleImage(img); - var baseFileName = System.IO.Path.GetFileNameWithoutExtension(code.SourceDescription); + var module = Runtime.Engine.LoadModuleImage(img); + var baseFileName = Path.GetFileNameWithoutExtension(code.SourceDescription); var builder = new ClassBuilder(); var type = builder.SetModule(module) diff --git a/src/OneScript/Infrastructure/OneScriptServicePlugin.cs b/src/OneScript/Infrastructure/OneScriptServicePlugin.cs index f129d47..70c690a 100644 --- a/src/OneScript/Infrastructure/OneScriptServicePlugin.cs +++ b/src/OneScript/Infrastructure/OneScriptServicePlugin.cs @@ -28,7 +28,7 @@ public static void AddOneScript(this IServiceCollection services) ServiceDescriptor.Transient()); services.TryAddTransient(svc => - new PhysicalFileProvider(svc.GetService().ContentRootPath)); + new PhysicalFileProvider(svc.GetService().ContentRootPath)); services.AddTransient(); InitializeScriptedLayer(services); diff --git a/src/OneScript/Infrastructure/WebApplicationEngine.cs b/src/OneScript/Infrastructure/WebApplicationEngine.cs index 5638870..82bc5e9 100644 --- a/src/OneScript/Infrastructure/WebApplicationEngine.cs +++ b/src/OneScript/Infrastructure/WebApplicationEngine.cs @@ -28,7 +28,13 @@ public WebApplicationEngine() public ScriptingEngine Engine { get; } public RuntimeEnvironment Environment { get; } + public CompilerService GetCompilerService() + { + var compilerSvc = Engine.GetCompilerService(); + compilerSvc.DefinePreprocessorValue("ВебСервер"); + compilerSvc.DefinePreprocessorValue("WebServer"); - + return compilerSvc; + } } } diff --git a/src/OneScript/OneScriptWeb.csproj b/src/OneScript/OneScriptWeb.csproj index 7b442ec..f7159da 100644 --- a/src/OneScript/OneScriptWeb.csproj +++ b/src/OneScript/OneScriptWeb.csproj @@ -1,6 +1,5 @@ - net461;netcoreapp2.2 OneScript.WebHost OneScript.WebHost OneScript.WebHost.Program @@ -9,6 +8,7 @@ false false + netcoreapp3.1 AnyCPU diff --git a/src/OneScript/Startup.cs b/src/OneScript/Startup.cs index e3a31fd..9e97f4b 100644 --- a/src/OneScript/Startup.cs +++ b/src/OneScript/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.ResponseCompression; using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OneScript.WebHost.Application; @@ -78,7 +79,7 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider services) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider services) { if (env.IsDevelopment()) { diff --git a/src/OneScriptWeb.Tests/AppModelTests.cs b/src/OneScriptWeb.Tests/AppModelTests.cs index 1c62664..c1e055c 100644 --- a/src/OneScriptWeb.Tests/AppModelTests.cs +++ b/src/OneScriptWeb.Tests/AppModelTests.cs @@ -3,7 +3,6 @@ using Dazinator.AspNet.Extensions.FileProviders; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -15,9 +14,6 @@ using OneScript.WebHost.Infrastructure; using OneScript.WebHost.Infrastructure.Implementations; using ScriptEngine; -using ScriptEngine.HostedScript; -using ScriptEngine.Machine; -using ScriptEngine.Machine.Reflection; using Xunit; namespace OneScriptWeb.Tests @@ -155,6 +151,7 @@ private static IApplicationRuntime CreateWebEngineMock() webAppMoq.SetupGet(x => x.Engine).Returns(engine); webAppMoq.SetupGet(x => x.Environment).Returns(engine.Environment); + webAppMoq.Setup(x => x.GetCompilerService()).Returns(() => engine.GetCompilerService()); return webAppMoq.Object; } @@ -165,11 +162,8 @@ private static ApplicationModel CreateApplicationModel(IFileProvider scriptsProv services.TryAddSingleton(Mock.Of()); services.TryAddSingleton(Mock.Of>()); services.TryAddSingleton(Mock.Of()); - services.TryAddScoped(x=>new HostingEnvironment() - { - ContentRootPath = "/" - }); - + services.TryAddScoped(x => Mock.Of()); + services.AddSingleton(CreateWebEngineMock()); services.AddOneScript(); diff --git a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs index 3f34150..89702d3 100644 --- a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs +++ b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs @@ -8,12 +8,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -43,7 +41,7 @@ public void CheckThatApplicationInstanceIsCreatedOnMain() cfgBuilder.AddInMemoryCollection(memData); services.TryAddSingleton(cfgBuilder.Build()); services.TryAddSingleton(); - services.AddSingleton(new HostingEnvironment()); + services.AddSingleton(Mock.Of()); services.AddSingleton(Mock.Of>()); services.AddMvcCore(); services.AddOneScript(); @@ -156,7 +154,7 @@ public void CheckThatRoutesAreRegisteredInHandler() Assert.IsType(routeCollection); } - [Fact] + [Fact(Skip = "Сменилось поведение Verify не признает тип FormattedLogValues в качестве It.IsAny")] public void MethodEchoWritesLog() { var services = new ServiceCollection(); @@ -174,7 +172,7 @@ public void MethodEchoWritesLog() var provider = services.BuildServiceProvider(); var starter = provider.GetService(); - var app = starter.CreateApp(); + starter.CreateApp(); loggerMock.Verify(x => x.Log( LogLevel.Information, diff --git a/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs b/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs index b2fc03a..65a3a3f 100644 --- a/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs +++ b/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs @@ -5,7 +5,6 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Xunit; using Moq; using OneScript.WebHost.Application; @@ -55,8 +54,7 @@ public void ResponseHeadersCanBeSetFrom_MapImpl() [Fact] public void ContentTypeIsReflectedInHeadersAfterAssignment() { - var context = new DefaultHttpContext(); - var response = new DefaultHttpResponse(context); + var response = MockRequestClass(); var scriptRequest = new HttpResponseImpl(response); scriptRequest.ContentType = "text/plain"; @@ -68,8 +66,7 @@ public void ContentTypeIsReflectedInHeadersAfterAssignment() [Fact] public void ContentTypeIsReflectedInHeadersAfterSetHeaders() { - var context = new DefaultHttpContext(); - var response = new DefaultHttpResponse(context); + var response = MockRequestClass(); var headers = new MapImpl(); headers.SetIndexedValue(ValueFactory.Create("Content-Type"), ValueFactory.Create("text/plain")); @@ -132,5 +129,17 @@ public void CookiesAreAccessible() Assert.Equal("test", request.Cookies.GetIndexedValue(ValueFactory.Create("test")).AsString()); } + + private HttpResponse MockRequestClass() + { + var mock = new Mock(); + + var dict = new HeaderDictionary(); + mock.SetupGet(x => x.Headers).Returns(dict); + mock.SetupGet(x => x.ContentType).Returns(() => dict["Content-Type"].ToString()); + mock.SetupSet(x => x.ContentType).Callback(x => dict["Content-Type"] = x); + + return mock.Object; + } } } diff --git a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj index af09f6e..7943725 100644 --- a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj +++ b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj @@ -4,7 +4,7 @@ false - net461;netcoreapp2.2 + netcoreapp3.1 diff --git a/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs b/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs index df53085..2dbfd2c 100644 --- a/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs +++ b/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs @@ -1,17 +1,10 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Linq; using System.Reflection; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; using Dazinator.AspNet.Extensions.FileProviders; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Mvc.ApplicationParts; -using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -29,6 +22,17 @@ namespace OneScriptWeb.Tests { public class ViewComponentDiscoveryTest { + private IApplicationRuntime MakeRuntime() + { + var rtMock = new Mock(); + var engine = new ScriptingEngine {Environment = new RuntimeEnvironment()}; + rtMock.SetupGet(x => x.Engine).Returns(engine); + rtMock.SetupGet(x => x.Environment).Returns(engine.Environment); + rtMock.Setup(x => x.GetCompilerService()).Returns(() => engine.GetCompilerService()); + + return rtMock.Object; + } + [Fact] public void CanPopulateViewComponentFeature() { @@ -42,8 +46,8 @@ public void CanPopulateViewComponentFeature() var serviceProvider = services.BuildServiceProvider(); var cp = new ScriptedViewComponentFeatureProvider(); - cp.Engine = new ScriptingEngine(); - cp.Engine.Environment = new RuntimeEnvironment(); + + cp.Runtime = MakeRuntime(); cp.ScriptsProvider = serviceProvider.GetService(); var feature = new ViewComponentFeature(); @@ -67,8 +71,7 @@ public void CanIgnoreModulesWithoutInvokator() var serviceProvider = services.BuildServiceProvider(); var cp = new ScriptedViewComponentFeatureProvider(); - cp.Engine = new ScriptingEngine(); - cp.Engine.Environment = new RuntimeEnvironment(); + cp.Runtime = MakeRuntime(); cp.ScriptsProvider = serviceProvider.GetService(); var feature = new ViewComponentFeature(); @@ -91,8 +94,7 @@ public void CanActivateVC_Through_Activator() var serviceProvider = services.BuildServiceProvider(); var cp = new ScriptedViewComponentFeatureProvider(); - cp.Engine = new ScriptingEngine(); - cp.Engine.Environment = new RuntimeEnvironment(); + cp.Runtime = MakeRuntime(); cp.ScriptsProvider = serviceProvider.GetService(); var feature = new ViewComponentFeature(); @@ -137,10 +139,7 @@ public void CanDiscoverVCThroughAllPipeline() services.TryAddSingleton(Mock.Of()); services.TryAddSingleton(Mock.Of>()); services.TryAddSingleton(Mock.Of()); - services.TryAddScoped(x => new HostingEnvironment() - { - ContentRootPath = "/" - }); + services.TryAddScoped(x => Mock.Of()); var webAppMoq = new Mock(); var engine = new ScriptingEngine() @@ -150,6 +149,8 @@ public void CanDiscoverVCThroughAllPipeline() webAppMoq.SetupGet(x => x.Engine).Returns(engine); webAppMoq.SetupGet(x => x.Environment).Returns(engine.Environment); + webAppMoq.Setup(x => x.GetCompilerService()).Returns(engine.GetCompilerService()); + services.AddSingleton(webAppMoq.Object); services.AddMvc() .ConfigureApplicationPartManager(pm => pm.FeatureProviders.Add(new ScriptedViewComponentFeatureProvider())); From 0cc8bca52169ccf5b4c6f6bd59ac256eaa8801ef Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 13:52:18 +0300 Subject: [PATCH 03/18] =?UTF-8?q?=D0=90=D0=BF=D0=B3=D1=80=D0=B5=D0=B9?= =?UTF-8?q?=D0=B4=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=20=D0=B4=D0=BE=20aspnetcore=203.1=20=D0=B8=20=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D1=81=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript/Identity/IdentityExtensions.cs | 5 ---- .../Infrastructure/DynamicContextWrapper.cs | 2 -- src/OneScript/OneScriptWeb.csproj | 27 ++++++++----------- .../ApplicationStartupTests.cs | 10 +++---- src/OneScriptWeb.Tests/DbModelCreatorTests.cs | 15 +++++++---- .../OneScriptWeb.Tests.csproj | 13 +++++---- 6 files changed, 34 insertions(+), 38 deletions(-) diff --git a/src/OneScript/Identity/IdentityExtensions.cs b/src/OneScript/Identity/IdentityExtensions.cs index e9e4c6c..c62260d 100644 --- a/src/OneScript/Identity/IdentityExtensions.cs +++ b/src/OneScript/Identity/IdentityExtensions.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Extensions.Configuration; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using OneScript.WebHost.Database; diff --git a/src/OneScript/Infrastructure/DynamicContextWrapper.cs b/src/OneScript/Infrastructure/DynamicContextWrapper.cs index 07f0691..5385873 100644 --- a/src/OneScript/Infrastructure/DynamicContextWrapper.cs +++ b/src/OneScript/Infrastructure/DynamicContextWrapper.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Dynamic; using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/OneScriptWeb.csproj b/src/OneScript/OneScriptWeb.csproj index f7159da..ff1e455 100644 --- a/src/OneScript/OneScriptWeb.csproj +++ b/src/OneScript/OneScriptWeb.csproj @@ -33,22 +33,17 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs index 89702d3..f526f6e 100644 --- a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs +++ b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs @@ -95,7 +95,7 @@ private static ServiceCollection MockMvcServices() { var services = new ServiceCollection(); services.TryAddSingleton(); - services.AddSingleton(Mock.Of()); + services.AddSingleton(Mock.Of()); services.AddSingleton(Mock.Of()); services.AddTransient(typeof(IActionInvokerFactory), (s) => Mock.Of()); services.AddTransient(typeof(IActionSelector), (s) => Mock.Of()); @@ -124,7 +124,7 @@ private static ServiceCollection MockMvcServices() return services; } - //[Fact] + [Fact(Skip = "Skipped for some reasons")] public void CheckThatRoutesAreRegisteredInHandler() { var services = MockMvcServices(); @@ -154,7 +154,7 @@ public void CheckThatRoutesAreRegisteredInHandler() Assert.IsType(routeCollection); } - [Fact(Skip = "Сменилось поведение Verify не признает тип FormattedLogValues в качестве It.IsAny")] + [Fact] public void MethodEchoWritesLog() { var services = new ServiceCollection(); @@ -177,9 +177,9 @@ public void MethodEchoWritesLog() x.Log( LogLevel.Information, It.IsAny(), - It.IsAny(), + It.Is((v, t) => true), null, - It.IsAny>()), + It.Is>((v, t) => true)), Times.Once); } diff --git a/src/OneScriptWeb.Tests/DbModelCreatorTests.cs b/src/OneScriptWeb.Tests/DbModelCreatorTests.cs index 670e7f3..6876be5 100644 --- a/src/OneScriptWeb.Tests/DbModelCreatorTests.cs +++ b/src/OneScriptWeb.Tests/DbModelCreatorTests.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Moq; using OneScript.WebHost.Database; @@ -69,13 +70,17 @@ public void CanCreateInfobaseUsers() { var opts = new DbContextOptionsBuilder(); var services = new ServiceCollection(); - services.AddTransient>((svc) => opts.UseInMemoryDatabase("usersManagerTest").Options); + services.AddTransient(_ => opts.UseInMemoryDatabase("usersManagerTest").Options); + services.AddTransient(_ => Mock.Of>>()); + services.AddTransient(_ => Mock.Of>>()); var cfgBuilder = new ConfigurationBuilder(); - Dictionary keys = new Dictionary(); - keys["Security:Password:RequireDigit"] = "false"; - keys["Security:Password:RequireUppercase"] = "false"; - keys["Security:Password:RequireLowercase"] = "false"; + var keys = new Dictionary + { + ["Security:Password:RequireDigit"] = "false", + ["Security:Password:RequireUppercase"] = "false", + ["Security:Password:RequireLowercase"] = "false" + }; cfgBuilder.AddInMemoryCollection(keys); services.AddIdentityByConfiguration(cfgBuilder.Build()); diff --git a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj index 7943725..7db0f7e 100644 --- a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj +++ b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj @@ -22,12 +22,15 @@ - - + + - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + From 991811ab235b651527c71115aa99bdfd1a299073 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 15:57:44 +0300 Subject: [PATCH 04/18] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D1=82=20=D0=B0=D0=BA=D1=81=D0=B5=D1=81=D1=81=D0=BE=D1=80?= =?UTF-8?q?=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=20=D0=B2=20=D0=BE?= =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=B0=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript/Startup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OneScript/Startup.cs b/src/OneScript/Startup.cs index 9e97f4b..0de5b6e 100644 --- a/src/OneScript/Startup.cs +++ b/src/OneScript/Startup.cs @@ -50,6 +50,7 @@ public void ConfigureServices(IServiceCollection services) services.AddMemoryCache(); services.AddSession(); + services.AddHttpContextAccessor(); services.AddDatabaseByConfiguration(Configuration); services.AddIdentityByConfiguration(Configuration); services.AddBackgroundJobsByConfiguration(Configuration); From 7e80a1993df9d163597059cd7067cff95f8be437 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 15:58:09 +0300 Subject: [PATCH 05/18] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B0=D0=BF=D0=B3=D1=80=D0=B5=D0=B9=D0=B4=20=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=81=D0=B8=D0=B8=20=D0=B2=20=D1=81=D0=B1=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D1=8B=D1=85=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82?= =?UTF-8?q?=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- Jenkinsfile | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c398bc..86d3f52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY . ./ RUN dotnet restore OneScript/OneScriptWeb.csproj -RUN dotnet publish OneScript/OneScriptWeb.csproj -c Release -o /app/out -f netcoreapp2.2 -r debian-x64 +RUN dotnet publish OneScript/OneScriptWeb.csproj -c Release -o /app/out -f netcoreapp3.1 -r debian-x64 # RUNTIME #FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 diff --git a/Jenkinsfile b/Jenkinsfile index 016d99e..d28451d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) - /*dir('src/OneScriptWeb.Tests'){ + dir('src/OneScriptWeb.Tests'){ bat ''' @echo off dotnet restore @@ -30,7 +30,7 @@ pipeline { ''' nunit testResultsPattern: 'testresult.xml' - }*/ + } dir('artifact'){ deleteDir() @@ -39,21 +39,20 @@ pipeline { dir('src'){ bat ''' @echo off - dotnet publish OneScript/OneScriptWeb.csproj -c Release -f net461 -o ../artifact/net461/win7-x64 -r win7-x64 - dotnet publish OneScript/OneScriptWeb.csproj -c Release -f net461 -o ../artifact/net461/debian-x64 -r debian-x64 - dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp2.2 -o ../artifact/core22/debian-x64 -r debian-x64 + dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp3.1 -o ../artifact/core/win7-x64 -r win7-x64 + dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp3.1 -o ../artifact/core/debian-x64 -r debian-x64 ''' } // новые версии дженкинса падают, если есть ранее зипованый артефакт fileOperations([fileDeleteOperation(excludes: '', includes: '*.zip')]) - zip archive: true, dir: 'artifact/net461/win7-x64', glob: '', zipFile: 'oscript.web-win7-x64.zip' - zip archive: true, dir: 'artifact/net461/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64.zip' - zip archive: true, dir: 'artifact/core22/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64-core.zip' + zip archive: true, dir: 'artifact/core/win7-x64', glob: '', zipFile: 'oscript.web-win7-x64.zip' + zip archive: true, dir: 'artifact/core/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64-core.zip' } } stage('Create docker image'){ + when { branch 'master' } options { skipDefaultCheckout() } agent { label 'linux' @@ -73,8 +72,8 @@ pipeline { userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) { - sh 'docker build -t evilbeaver/oscript-web:0.6.0 --file Dockerfile src' - sh 'docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:0.6.0' + sh 'docker build -t evilbeaver/oscript-web:0.7.0 --file Dockerfile src' + sh 'docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:0.7.0' } } } From 7fbf0068fdf3c1fd841bd52b2192c6d82fce74cd Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 23 Oct 2020 15:59:32 +0300 Subject: [PATCH 06/18] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BF=D1=80=D0=B5=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=D1=8B=20=D0=BB=D0=B8=D1=86=D0=B5=D0=BD=D0=B7=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/ApplicationInstance.cs | 12 +- .../Application/ContentActionResult.cs | 11 +- .../Application/CookieOptionsWraper.cs | 11 +- src/OneScript/Application/FileActionResult.cs | 10 +- .../Application/FormDataCollectionContext.cs | 10 +- src/OneScript/Application/FormFileContext.cs | 11 +- .../Application/FormFilesCollectionContext.cs | 11 +- src/OneScript/Application/HttpRequestImpl.cs | 11 +- src/OneScript/Application/HttpResponseImpl.cs | 11 +- .../ModelStateDictionaryWrapper.cs | 11 +- .../Application/RedirectActionResult.cs | 11 +- .../Application/RouteDescriptionContext.cs | 11 +- .../Application/RoutesCollectionContext.cs | 10 +- .../Application/ScriptedController.cs | 130 +++++++++--------- .../Application/ScriptedMiddleware.cs | 10 +- .../Application/ScriptedViewComponent.cs | 12 +- src/OneScript/Application/SessionImpl.cs | 10 +- .../Application/StatusCodeActionResult.cs | 11 +- src/OneScript/Application/ViewActionResult.cs | 15 +- .../Application/ViewComponentContentResult.cs | 10 +- .../Application/ViewComponentViewResult.cs | 10 +- .../Application/ViewDataDictionaryWrapper.cs | 11 +- src/OneScript/Application/WebGlobalContext.cs | 10 +- .../Authorization/AuthorizationModule.cs | 9 +- .../Authorization/CustomAuthExtensions.cs | 13 +- .../Authorization/CustomAuthRequirement.cs | 11 +- .../OneScriptAuthorizationHandlerProvider.cs | 9 +- .../ScriptedAuthorizationHandler.cs | 9 +- .../BackgroundJobs/BackgroundJobContext.cs | 10 +- .../BackgroundJobsExtensions.cs | 12 +- .../BackgroundJobsManagerContext.cs | 11 +- src/OneScript/BackgroundJobs/CronWrapper.cs | 10 +- .../DashboardAutorizationFilter.cs | 10 +- .../ScheduledJobsManagerContext.cs | 12 +- .../BackgroundJobs/TimeSpanWrapper.cs | 10 +- .../Database/ApplicationDbContext.cs | 8 +- src/OneScript/Database/DatabaseExtensions.cs | 11 +- src/OneScript/Database/DbQueryContext.cs | 8 +- src/OneScript/Database/InfobaseContext.cs | 9 +- src/OneScript/Database/InfobaseUserContext.cs | 11 +- .../Database/InfobaseUsersManagerContext.cs | 11 +- src/OneScript/Database/QueryResult.cs | 10 +- src/OneScript/Identity/ApplicationRole.cs | 12 +- src/OneScript/Identity/ApplicationUser.cs | 12 +- src/OneScript/Identity/IdentityExtensions.cs | 13 +- .../AnnotationAttributeMapper.cs | 14 +- .../Infrastructure/AnnotationException.cs | 12 +- src/OneScript/Infrastructure/AppStarter.cs | 10 +- .../Infrastructure/CustomMarshaller.cs | 10 +- .../Infrastructure/DbContextProvider.cs | 8 +- .../Infrastructure/DynamicContextWrapper.cs | 8 +- .../Infrastructure/ExtensionsCompiler.cs | 10 +- .../Infrastructure/FileInfoCodeSource.cs | 11 +- .../Infrastructure/IApplicationFactory.cs | 9 +- .../Infrastructure/IApplicationRuntime.cs | 11 +- .../Implementations/ClassAttributeResolver.cs | 11 +- .../CustomHttpMethodAttribute.cs | 10 +- .../OscriptApplicationModelProvider.cs | 41 +++++- .../OscriptViewComponentActivator.cs | 11 +- .../OscriptViewComponentInvoker.cs | 12 +- .../OscriptViewComponentInvokerFactory.cs | 8 +- .../ScriptedControllerActivator.cs | 14 +- .../ScriptedMiddlewareActivator.cs | 12 +- .../ScriptedViewComponentFeatureProvider.cs | 11 +- .../Infrastructure/OneScriptServicePlugin.cs | 11 +- .../Infrastructure/OscriptViewsOverride.cs | 8 +- .../ScriptedMiddlewareExtension.cs | 15 +- .../Infrastructure/TypeReflectionEngine.cs | 11 +- .../Infrastructure/WebApplicationEngine.cs | 16 +-- src/OneScript/Program.cs | 8 +- src/OneScript/Startup.cs | 15 +- src/OneScriptWeb.Tests/ActionResultTests.cs | 8 +- src/OneScriptWeb.Tests/AppModelTests.cs | 8 +- .../ApplicationStartupTests.cs | 8 +- src/OneScriptWeb.Tests/AssemblyInfo.cs | 10 +- src/OneScriptWeb.Tests/AuthHandlerTests.cs | 8 +- .../ControllerCreationTest.cs | 8 +- src/OneScriptWeb.Tests/DbModelCreatorTests.cs | 8 +- .../DynamicContextWrapperTest.cs | 8 +- .../DynamicExtensionTest.cs | 8 +- src/OneScriptWeb.Tests/FakeFileInfo.cs | 8 +- .../FileProviderExtensions.cs | 8 +- .../HttpRequestResponseTests.cs | 8 +- src/OneScriptWeb.Tests/SessionsTest.cs | 8 +- src/OneScriptWeb.Tests/TestOrderingLock.cs | 8 +- src/OneScriptWeb.Tests/TypeReflectionTest.cs | 8 +- .../ViewComponentDiscoveryTest.cs | 8 +- 87 files changed, 715 insertions(+), 333 deletions(-) diff --git a/src/OneScript/Application/ApplicationInstance.cs b/src/OneScript/Application/ApplicationInstance.cs index 4e32c07..e7b693c 100644 --- a/src/OneScript/Application/ApplicationInstance.cs +++ b/src/OneScript/Application/ApplicationInstance.cs @@ -1,18 +1,20 @@ -using ScriptEngine.Environment; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using ScriptEngine.Environment; using ScriptEngine.Machine.Contexts; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Hangfire; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; using OneScript.WebHost.BackgroundJobs; using OneScript.WebHost.Infrastructure; -using ScriptEngine; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; -using Microsoft.Extensions.FileProviders; namespace OneScript.WebHost.Application { diff --git a/src/OneScript/Application/ContentActionResult.cs b/src/OneScript/Application/ContentActionResult.cs index cb2c236..5441c74 100644 --- a/src/OneScript/Application/ContentActionResult.cs +++ b/src/OneScript/Application/ContentActionResult.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Mvc; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/CookieOptionsWraper.cs b/src/OneScript/Application/CookieOptionsWraper.cs index e48eb7f..73f2d88 100644 --- a/src/OneScript/Application/CookieOptionsWraper.cs +++ b/src/OneScript/Application/CookieOptionsWraper.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using Microsoft.AspNetCore.Http; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/FileActionResult.cs b/src/OneScript/Application/FileActionResult.cs index 5bd2646..4df4b6b 100644 --- a/src/OneScript/Application/FileActionResult.cs +++ b/src/OneScript/Application/FileActionResult.cs @@ -1,7 +1,11 @@ -using System; -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.IO; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using ScriptEngine.HostedScript.Library.Binary; diff --git a/src/OneScript/Application/FormDataCollectionContext.cs b/src/OneScript/Application/FormDataCollectionContext.cs index d5eb0c3..11334be 100644 --- a/src/OneScript/Application/FormDataCollectionContext.cs +++ b/src/OneScript/Application/FormDataCollectionContext.cs @@ -1,8 +1,12 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; diff --git a/src/OneScript/Application/FormFileContext.cs b/src/OneScript/Application/FormFileContext.cs index 3cfbab1..4803d29 100644 --- a/src/OneScript/Application/FormFileContext.cs +++ b/src/OneScript/Application/FormFileContext.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using Microsoft.AspNetCore.Http; using ScriptEngine.HostedScript.Library; using ScriptEngine.HostedScript.Library.Binary; diff --git a/src/OneScript/Application/FormFilesCollectionContext.cs b/src/OneScript/Application/FormFilesCollectionContext.cs index 352020f..35e31de 100644 --- a/src/OneScript/Application/FormFilesCollectionContext.cs +++ b/src/OneScript/Application/FormFilesCollectionContext.cs @@ -1,8 +1,13 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; @@ -73,4 +78,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/src/OneScript/Application/HttpRequestImpl.cs b/src/OneScript/Application/HttpRequestImpl.cs index ebdc0e8..0e7b74c 100644 --- a/src/OneScript/Application/HttpRequestImpl.cs +++ b/src/OneScript/Application/HttpRequestImpl.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Http; using ScriptEngine.HostedScript.Library; using ScriptEngine.HostedScript.Library.Binary; diff --git a/src/OneScript/Application/HttpResponseImpl.cs b/src/OneScript/Application/HttpResponseImpl.cs index de248d5..8c7e622 100644 --- a/src/OneScript/Application/HttpResponseImpl.cs +++ b/src/OneScript/Application/HttpResponseImpl.cs @@ -1,9 +1,12 @@ -using System; -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.IO; -using System.Linq; using System.Text; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using ScriptEngine.HostedScript.Library; using ScriptEngine.HostedScript.Library.Binary; diff --git a/src/OneScript/Application/ModelStateDictionaryWrapper.cs b/src/OneScript/Application/ModelStateDictionaryWrapper.cs index f67e822..b95b7d7 100644 --- a/src/OneScript/Application/ModelStateDictionaryWrapper.cs +++ b/src/OneScript/Application/ModelStateDictionaryWrapper.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Mvc.ModelBinding; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/RedirectActionResult.cs b/src/OneScript/Application/RedirectActionResult.cs index d0ab8fd..97a186d 100644 --- a/src/OneScript/Application/RedirectActionResult.cs +++ b/src/OneScript/Application/RedirectActionResult.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Mvc; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/RouteDescriptionContext.cs b/src/OneScript/Application/RouteDescriptionContext.cs index 018860e..33d809e 100644 --- a/src/OneScript/Application/RouteDescriptionContext.cs +++ b/src/OneScript/Application/RouteDescriptionContext.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/RoutesCollectionContext.cs b/src/OneScript/Application/RoutesCollectionContext.cs index 1dc7fae..f32e04a 100644 --- a/src/OneScript/Application/RoutesCollectionContext.cs +++ b/src/OneScript/Application/RoutesCollectionContext.cs @@ -1,8 +1,12 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/ScriptedController.cs b/src/OneScript/Application/ScriptedController.cs index 51310e7..8384c90 100644 --- a/src/OneScript/Application/ScriptedController.cs +++ b/src/OneScript/Application/ScriptedController.cs @@ -1,3 +1,9 @@ +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; @@ -5,8 +11,6 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.DependencyInjection; using OneScript.WebHost.Infrastructure; -using ScriptEngine; -using ScriptEngine.Environment; using ScriptEngine.HostedScript.Library; using ScriptEngine.HostedScript.Library.Binary; using ScriptEngine.Machine; @@ -15,9 +19,9 @@ namespace OneScript.WebHost.Application { /// - /// Главный класс, отвечающий за обработку входящего запроса и генерацию ответа. + /// Главный класс, отвечающий Р·Р° обработку входящего запроса Рё генерацию ответа. /// - [ContextClass("Контроллер")] + [ContextClass("Контроллер")] [NonController] public class ScriptedController : AutoScriptDrivenObject { @@ -51,7 +55,7 @@ public ScriptedController(ControllerContext context, LoadedModule module) : base RouteValues = ValueFactory.Create(); var typeClr = (Type)context.ActionDescriptor.Properties["type"]; - var type = TypeManager.RegisterType("Контроллер."+typeClr.Name, typeof(ScriptedController)); + var type = TypeManager.RegisterType("Контроллер."+typeClr.Name, typeof(ScriptedController)); DefineType(type); InitOwnData(); } @@ -97,29 +101,29 @@ public ViewDataDictionary FrameworkViewData } /// - /// Входящий запрос HTTP + /// Входящий запрос HTTP /// - [ContextProperty("ЗапросHttp")] + [ContextProperty("ЗапросHttp")] public HttpRequestImpl HttpRequest { get; } /// - /// Исходящий ответ HTTP + /// Исходящий ответ HTTP /// - [ContextProperty("ОтветHttp")] + [ContextProperty("ОтветHttp")] public HttpResponseImpl HttpResponse { get; } /// - /// Действующие значения маршрута для текущего вызова. - /// Тип: Соответствие или Неопределено. - /// Ключами соответствия являются переменные маршрута. + /// Действующие значения маршрута для текущего вызова. + /// РўРёРї: Соответствие или Неопределено. + /// Ключами соответствия являются переменные маршрута. /// - [ContextProperty("ЗначенияМаршрута")] + [ContextProperty("ЗначенияМаршрута")] public IValue RouteValues { get; } /// - /// Данные http-сессии. Механизм сессий использует Cookies для привязки сессии и InMemory хранилище для данных сессии. + /// Данные http-сессии. Механизм сессий использует Cookies для РїСЂРёРІСЏР·РєРё сессии Рё InMemory хранилище для данных сессии. /// - [ContextProperty("Сессия")] + [ContextProperty("Сессия")] public SessionImpl Session { get @@ -131,27 +135,27 @@ public SessionImpl Session } /// - /// Специализированный объект, предназначенный для передачи данных в генерируемое Представление. - /// Элементы коллекции доступны в Представлении через свойства ViewBag и ViewData. + /// Специализированный объект, предназначенный для передачи данных РІ генерируемое Представление. + /// Элементы коллекции доступны РІ Представлении через свойства ViewBag Рё ViewData. /// - [ContextProperty("ДанныеПредставления")] + [ContextProperty("ДанныеПредставления")] public ViewDataDictionaryWrapper ViewData { get => _osViewData ?? (_osViewData = new ViewDataDictionaryWrapper()); set => _osViewData = value ?? throw new ArgumentException(); } - [ContextProperty("СостояниеМодели", "ModelState")] + [ContextProperty("СостояниеМодели", "ModelState")] public ModelStateDictionaryWrapper ModelState => _modelState ?? (_modelState = new ModelStateDictionaryWrapper(_ctx.ModelState)); /// - /// Вспомогательный метод генерации ответа в виде представления. + /// Вспомогательный метод генерации ответа РІ РІРёРґРµ представления. /// - /// Имя представления или объект Модели (если используется представление по умолчанию) - /// Объект модели (произвольный) - /// РезультатДействияПредставление. - [ContextMethod("Представление")] + /// Имя представления или объект Модели (если используется представление РїРѕ умолчанию) + /// Объект модели (произвольный) + /// РезультатДействияПредставление. + [ContextMethod("Представление")] public ViewActionResult View(IValue nameOrModel = null, IValue model = null) { if (nameOrModel == null && model == null) @@ -178,12 +182,12 @@ public ViewActionResult View(IValue nameOrModel = null, IValue model = null) } /// - /// Вспомогательный метод генерации ответа в виде текстового содержимого + /// Вспомогательный метод генерации ответа РІ РІРёРґРµ текстового содержимого /// - /// Содержимое ответа - /// Кодировка текста ответа - /// РезультатДействияСодержимое - [ContextMethod("Содержимое")] + /// Содержимое ответа + /// РљРѕРґРёСЂРѕРІРєР° текста ответа + /// РезультатДействияСодержимое + [ContextMethod("Содержимое")] public ContentActionResult Content(string content, string contentType = null) { var ctResult = new ContentActionResult() @@ -196,13 +200,13 @@ public ContentActionResult Content(string content, string contentType = null) } /// - /// Вспомогательный метод генерации ответа в виде скачиваемого файла. + /// Вспомогательный метод генерации ответа РІ РІРёРґРµ скачиваемого файла. /// - /// Данные файла (путь или ДвоичныеДанные) - /// Содержимое заголовка Content-type - /// Имя скачиваемого файла - /// РезультатДействияФайл - [ContextMethod("Файл")] + /// Данные файла (путь или ДвоичныеДанные) + /// Содержимое заголовка Content-type + /// Имя скачиваемого файла + /// РезультатДействияФайл + [ContextMethod("Файл")] public FileActionResult File(IValue data, string contentType = null, string downloadFileName = null) { FileActionResult fileResult; @@ -226,37 +230,37 @@ public FileActionResult File(IValue data, string contentType = null, string down } /// - /// Вспомогательный метод, генерирующий код состояния HTTP + /// Вспомогательный метод, генерирующий РєРѕРґ состояния HTTP /// - /// Код состояния - /// РезультатДействияКодСостояния - [ContextMethod("КодСостояния")] + /// РљРѕРґ состояния + /// РезультатДействияКодСостояния + [ContextMethod("КодСостояния")] public StatusCodeActionResult StatusCode(int code) { return StatusCodeActionResult.Constructor(code); } /// - /// Вспомогательный метод, генерирующий ответ в виде http-редиректа + /// Вспомогательный метод, генерирующий ответ РІ РІРёРґРµ http-редиректа /// - /// Адрес перенаправления - /// Признак постоянного (permanent) перенаправления. - /// РезультатДействияПеренаправление - [ContextMethod("Перенаправление")] + /// Адрес перенаправления + /// Признак постоянного (permanent) перенаправления. + /// РезультатДействияПеренаправление + [ContextMethod("Перенаправление")] public RedirectActionResult Redirect(string url, bool permanent = false) { return RedirectActionResult.Create(url, permanent); } /// - /// Вспомогательный метод, генерирующий ответ в виде http-редиректа + /// Вспомогательный метод, генерирующий ответ РІ РІРёРґРµ http-редиректа /// - /// Имя действия перенаправления - /// Контроллер перенаправления - /// Дополнительные поля - /// Признак постоянного (permanent) перенаправления. - /// РезультатДействияПеренаправление - [ContextMethod("ПеренаправлениеНаДействие")] + /// Имя действия перенаправления + /// Контроллер перенаправления + /// Дополнительные поля + /// Признак постоянного (permanent) перенаправления. + /// РезультатДействияПеренаправление + [ContextMethod("ПеренаправлениеНаДействие")] public RedirectActionResult RedirectToAction(string action, string controller = null, StructureImpl fields = null, bool permanent = false) { if(fields == null) @@ -267,19 +271,19 @@ public RedirectActionResult RedirectToAction(string action, string controller = var url = ActionUrl(action, fields); if(url == null) - throw new RuntimeException("Не обнаружен заданный маршрут."); + throw new RuntimeException("РќРµ обнаружен заданный маршрут."); return RedirectActionResult.Create(url, permanent); } /// - /// Генерирует URL для маршрута, заданного в приложении. - /// Параметр routeName позволяет жестко привязать генерацию адреса к конкретному маршруту + /// Генерирует URL для маршрута, заданного РІ приложении. + /// Параметр routeName позволяет жестко привязать генерацию адреса Рє конкретному маршруту /// - /// Строка. Имя маршрута - /// Структура. Поля маршрута в виде структуры. - /// РезультатДействияПеренаправление - [ContextMethod("АдресМаршрута")] + /// Строка. Имя маршрута + /// Структура. Поля маршрута РІ РІРёРґРµ структуры. + /// РезультатДействияПеренаправление + [ContextMethod("АдресМаршрута")] public string RouteUrl(string routeName = null, StructureImpl fields = null) { string result; @@ -305,12 +309,12 @@ public string RouteUrl(string routeName = null, StructureImpl fields = null) } /// - /// Генерирует Url для действия в контроллере + /// Генерирует Url для действия РІ контроллере /// - /// Имя действия - /// Имя контроллера строкой или структура/соответствие полей маршрута. + /// Имя действия + /// Имя контроллера строкой или структура/соответствие полей маршрута. /// - [ContextMethod("АдресДействия", "ActionUrl")] + [ContextMethod("АдресДействия", "ActionUrl")] public string ActionUrl(string action, IValue fieldsOrController = null) { string result; @@ -383,7 +387,7 @@ private ViewActionResult DefaultViewResult() return new ViewActionResult() { ViewData = ViewData }; } - // TODO: Костыль вызванный ошибкой https://github.com/EvilBeaver/OneScript/issues/660 + // TODO: Костыль вызванный ошибкой https://github.com/EvilBeaver/OneScript/issues/660 internal static int GetOwnMethodsRelectionOffset() { return _ownMethods.Count; diff --git a/src/OneScript/Application/ScriptedMiddleware.cs b/src/OneScript/Application/ScriptedMiddleware.cs index c382dcd..ed97397 100644 --- a/src/OneScript/Application/ScriptedMiddleware.cs +++ b/src/OneScript/Application/ScriptedMiddleware.cs @@ -1,6 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/src/OneScript/Application/ScriptedViewComponent.cs b/src/OneScript/Application/ScriptedViewComponent.cs index acd2b6d..34d906b 100644 --- a/src/OneScript/Application/ScriptedViewComponent.cs +++ b/src/OneScript/Application/ScriptedViewComponent.cs @@ -1,14 +1,16 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.Extensions.DependencyInjection; using OneScript.WebHost.Infrastructure; -using ScriptEngine; -using ScriptEngine.Environment; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/SessionImpl.cs b/src/OneScript/Application/SessionImpl.cs index 5e5bc74..0594437 100644 --- a/src/OneScript/Application/SessionImpl.cs +++ b/src/OneScript/Application/SessionImpl.cs @@ -1,4 +1,10 @@ -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Linq; using Microsoft.AspNetCore.Http; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; @@ -106,4 +112,4 @@ public void Remove(string key) public object UnderlyingObject => _requestSession; } -} \ No newline at end of file +} diff --git a/src/OneScript/Application/StatusCodeActionResult.cs b/src/OneScript/Application/StatusCodeActionResult.cs index 9f39414..b324609 100644 --- a/src/OneScript/Application/StatusCodeActionResult.cs +++ b/src/OneScript/Application/StatusCodeActionResult.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Mvc; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Application/ViewActionResult.cs b/src/OneScript/Application/ViewActionResult.cs index 2b50217..89d4d34 100644 --- a/src/OneScript/Application/ViewActionResult.cs +++ b/src/OneScript/Application/ViewActionResult.cs @@ -1,13 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using OneScript.WebHost.Infrastructure; -using ScriptEngine.HostedScript.Library; -using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; namespace OneScript.WebHost.Application diff --git a/src/OneScript/Application/ViewComponentContentResult.cs b/src/OneScript/Application/ViewComponentContentResult.cs index e398f73..78e5b64 100644 --- a/src/OneScript/Application/ViewComponentContentResult.cs +++ b/src/OneScript/Application/ViewComponentContentResult.cs @@ -1,6 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewComponents; diff --git a/src/OneScript/Application/ViewComponentViewResult.cs b/src/OneScript/Application/ViewComponentViewResult.cs index 77f2d95..4b72fd2 100644 --- a/src/OneScript/Application/ViewComponentViewResult.cs +++ b/src/OneScript/Application/ViewComponentViewResult.cs @@ -1,6 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewComponents; diff --git a/src/OneScript/Application/ViewDataDictionaryWrapper.cs b/src/OneScript/Application/ViewDataDictionaryWrapper.cs index 6a5e5ea..8fd6820 100644 --- a/src/OneScript/Application/ViewDataDictionaryWrapper.cs +++ b/src/OneScript/Application/ViewDataDictionaryWrapper.cs @@ -1,10 +1,15 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Collections; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ViewFeatures; using OneScript.WebHost.Infrastructure; -using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; @@ -94,4 +99,4 @@ public ViewDataDictionary GetDictionary() return realDict; } } -} \ No newline at end of file +} diff --git a/src/OneScript/Application/WebGlobalContext.cs b/src/OneScript/Application/WebGlobalContext.cs index 2fefd6e..f30bb1a 100644 --- a/src/OneScript/Application/WebGlobalContext.cs +++ b/src/OneScript/Application/WebGlobalContext.cs @@ -1,10 +1,14 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Reflection; using OneScript.WebHost.Infrastructure; -using ScriptEngine; using ScriptEngine.Environment; using ScriptEngine.HostedScript; using ScriptEngine.HostedScript.Library; diff --git a/src/OneScript/Authorization/AuthorizationModule.cs b/src/OneScript/Authorization/AuthorizationModule.cs index af22685..899e154 100644 --- a/src/OneScript/Authorization/AuthorizationModule.cs +++ b/src/OneScript/Authorization/AuthorizationModule.cs @@ -1,7 +1,12 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.FileProviders; using OneScript.WebHost.Infrastructure; diff --git a/src/OneScript/Authorization/CustomAuthExtensions.cs b/src/OneScript/Authorization/CustomAuthExtensions.cs index 59b0e19..675ba2a 100644 --- a/src/OneScript/Authorization/CustomAuthExtensions.cs +++ b/src/OneScript/Authorization/CustomAuthExtensions.cs @@ -1,11 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.FileProviders; namespace OneScript.WebHost.Authorization { diff --git a/src/OneScript/Authorization/CustomAuthRequirement.cs b/src/OneScript/Authorization/CustomAuthRequirement.cs index 3f86c0b..c7bf020 100644 --- a/src/OneScript/Authorization/CustomAuthRequirement.cs +++ b/src/OneScript/Authorization/CustomAuthRequirement.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using Microsoft.AspNetCore.Authorization; using ScriptEngine.Machine.Contexts; diff --git a/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs b/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs index 5064775..171f20d 100644 --- a/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs +++ b/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs @@ -1,6 +1,11 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.FileProviders; diff --git a/src/OneScript/Authorization/ScriptedAuthorizationHandler.cs b/src/OneScript/Authorization/ScriptedAuthorizationHandler.cs index a425705..8315429 100644 --- a/src/OneScript/Authorization/ScriptedAuthorizationHandler.cs +++ b/src/OneScript/Authorization/ScriptedAuthorizationHandler.cs @@ -1,5 +1,10 @@ -using System; -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; diff --git a/src/OneScript/BackgroundJobs/BackgroundJobContext.cs b/src/OneScript/BackgroundJobs/BackgroundJobContext.cs index 607fe61..d9a9d58 100644 --- a/src/OneScript/BackgroundJobs/BackgroundJobContext.cs +++ b/src/OneScript/BackgroundJobs/BackgroundJobContext.cs @@ -1,4 +1,10 @@ -using ScriptEngine.Machine.Contexts; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using ScriptEngine.Machine.Contexts; namespace OneScript.WebHost.BackgroundJobs { @@ -12,4 +18,4 @@ public BackgroundJobContext(string jobId) _jobId = jobId; } } -} \ No newline at end of file +} diff --git a/src/OneScript/BackgroundJobs/BackgroundJobsExtensions.cs b/src/OneScript/BackgroundJobs/BackgroundJobsExtensions.cs index 9d2258a..4fe3c01 100644 --- a/src/OneScript/BackgroundJobs/BackgroundJobsExtensions.cs +++ b/src/OneScript/BackgroundJobs/BackgroundJobsExtensions.cs @@ -1,12 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Configuration; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Linq; -using System.Threading.Tasks; using Hangfire; using Hangfire.MemoryStorage; using Hangfire.PostgreSql; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs b/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs index 2df07f7..ad29b31 100644 --- a/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs +++ b/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using Hangfire; using ScriptEngine; using ScriptEngine.Machine; diff --git a/src/OneScript/BackgroundJobs/CronWrapper.cs b/src/OneScript/BackgroundJobs/CronWrapper.cs index 3f6eaa1..0450468 100644 --- a/src/OneScript/BackgroundJobs/CronWrapper.cs +++ b/src/OneScript/BackgroundJobs/CronWrapper.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Hangfire; using ScriptEngine.Machine.Contexts; @@ -84,4 +90,4 @@ public static CronWrapper Constructor() } -} \ No newline at end of file +} diff --git a/src/OneScript/BackgroundJobs/DashboardAutorizationFilter.cs b/src/OneScript/BackgroundJobs/DashboardAutorizationFilter.cs index a754f5e..91bafa9 100644 --- a/src/OneScript/BackgroundJobs/DashboardAutorizationFilter.cs +++ b/src/OneScript/BackgroundJobs/DashboardAutorizationFilter.cs @@ -1,4 +1,10 @@ -using Hangfire.Dashboard; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using Hangfire.Dashboard; namespace OneScript.WebHost.BackgroundJobs { @@ -12,4 +18,4 @@ public bool Authorize(DashboardContext context) return httpContext.User.Identity.IsAuthenticated; } } -} \ No newline at end of file +} diff --git a/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs b/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs index 7b09bea..494654f 100644 --- a/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs +++ b/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs @@ -1,13 +1,17 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Collections.Generic; -using System.Linq; using ScriptEngine.Machine.Contexts; using ScriptEngine.Machine; using Hangfire; using Hangfire.Storage; -using Microsoft.Extensions.DependencyInjection; using OneScript.WebHost.Database; using OneScript.WebHost.Infrastructure; using ScriptEngine; @@ -121,4 +125,4 @@ public static void PerformAction(string module, string method) } } } -} \ No newline at end of file +} diff --git a/src/OneScript/BackgroundJobs/TimeSpanWrapper.cs b/src/OneScript/BackgroundJobs/TimeSpanWrapper.cs index a571530..5213c52 100644 --- a/src/OneScript/BackgroundJobs/TimeSpanWrapper.cs +++ b/src/OneScript/BackgroundJobs/TimeSpanWrapper.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using ScriptEngine.Machine.Contexts; namespace OneScript.WebHost.BackgroundJobs @@ -59,4 +65,4 @@ public static TimeSpanWrapper Constructor() } } -} \ No newline at end of file +} diff --git a/src/OneScript/Database/ApplicationDbContext.cs b/src/OneScript/Database/ApplicationDbContext.cs index ee44943..f3eb42c 100644 --- a/src/OneScript/Database/ApplicationDbContext.cs +++ b/src/OneScript/Database/ApplicationDbContext.cs @@ -1,4 +1,10 @@ -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using OneScript.WebHost.Identity; using OneScript.WebHost.Infrastructure; diff --git a/src/OneScript/Database/DatabaseExtensions.cs b/src/OneScript/Database/DatabaseExtensions.cs index 927ed1e..d98c841 100644 --- a/src/OneScript/Database/DatabaseExtensions.cs +++ b/src/OneScript/Database/DatabaseExtensions.cs @@ -1,8 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Configuration; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; diff --git a/src/OneScript/Database/DbQueryContext.cs b/src/OneScript/Database/DbQueryContext.cs index ef8b2ed..08309b9 100644 --- a/src/OneScript/Database/DbQueryContext.cs +++ b/src/OneScript/Database/DbQueryContext.cs @@ -1,4 +1,10 @@ -using System.Data.Common; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Data.Common; using Microsoft.EntityFrameworkCore; using ScriptEngine.HostedScript.Library; using ScriptEngine.Machine; diff --git a/src/OneScript/Database/InfobaseContext.cs b/src/OneScript/Database/InfobaseContext.cs index 5a73b28..55f0646 100644 --- a/src/OneScript/Database/InfobaseContext.cs +++ b/src/OneScript/Database/InfobaseContext.cs @@ -1,5 +1,10 @@ -using System; -using Microsoft.Extensions.DependencyInjection; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using ScriptEngine.Machine.Contexts; namespace OneScript.WebHost.Database diff --git a/src/OneScript/Database/InfobaseUserContext.cs b/src/OneScript/Database/InfobaseUserContext.cs index feb8720..5941452 100644 --- a/src/OneScript/Database/InfobaseUserContext.cs +++ b/src/OneScript/Database/InfobaseUserContext.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using Microsoft.AspNetCore.Identity; using OneScript.WebHost.Identity; using ScriptEngine.HostedScript.Library; diff --git a/src/OneScript/Database/InfobaseUsersManagerContext.cs b/src/OneScript/Database/InfobaseUsersManagerContext.cs index 2731a96..852f629 100644 --- a/src/OneScript/Database/InfobaseUsersManagerContext.cs +++ b/src/OneScript/Database/InfobaseUsersManagerContext.cs @@ -1,10 +1,13 @@ -using System; -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using OneScript.WebHost.Identity; using ScriptEngine.HostedScript.Library; diff --git a/src/OneScript/Database/QueryResult.cs b/src/OneScript/Database/QueryResult.cs index a20f940..80eb0de 100644 --- a/src/OneScript/Database/QueryResult.cs +++ b/src/OneScript/Database/QueryResult.cs @@ -1,4 +1,10 @@ - +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using ScriptEngine.HostedScript.Library.Binary; using ScriptEngine.HostedScript.Library.ValueTable; using ScriptEngine.Machine; @@ -107,4 +113,4 @@ public Boolean IsEmpty() return _resultTable.Count() == 0; } } -} \ No newline at end of file +} diff --git a/src/OneScript/Identity/ApplicationRole.cs b/src/OneScript/Identity/ApplicationRole.cs index b8d43e3..bb31c70 100644 --- a/src/OneScript/Identity/ApplicationRole.cs +++ b/src/OneScript/Identity/ApplicationRole.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; namespace OneScript.WebHost.Identity { diff --git a/src/OneScript/Identity/ApplicationUser.cs b/src/OneScript/Identity/ApplicationUser.cs index 6dd142e..7eec5ad 100644 --- a/src/OneScript/Identity/ApplicationUser.cs +++ b/src/OneScript/Identity/ApplicationUser.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; namespace OneScript.WebHost.Identity { diff --git a/src/OneScript/Identity/IdentityExtensions.cs b/src/OneScript/Identity/IdentityExtensions.cs index c62260d..a113b47 100644 --- a/src/OneScript/Identity/IdentityExtensions.cs +++ b/src/OneScript/Identity/IdentityExtensions.cs @@ -1,10 +1,14 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Linq; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using OneScript.WebHost.Database; namespace OneScript.WebHost.Identity @@ -40,9 +44,6 @@ public static void AddIdentityByConfiguration(this IServiceCollection services, cookieOpts.Bind("Cookie", options.Cookie); }); } - - services.TryAddScoped(); - } private static void ProcessSecurityOptions(IdentityOptions options, IConfigurationSection security) diff --git a/src/OneScript/Infrastructure/AnnotationAttributeMapper.cs b/src/OneScript/Infrastructure/AnnotationAttributeMapper.cs index b74d8dc..c5a293b 100644 --- a/src/OneScript/Infrastructure/AnnotationAttributeMapper.cs +++ b/src/OneScript/Infrastructure/AnnotationAttributeMapper.cs @@ -1,10 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using OneScript.WebHost.Infrastructure.Implementations; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using ScriptEngine.Machine; namespace OneScript.WebHost.Infrastructure diff --git a/src/OneScript/Infrastructure/AnnotationException.cs b/src/OneScript/Infrastructure/AnnotationException.cs index 0c58126..5df9fa4 100644 --- a/src/OneScript/Infrastructure/AnnotationException.cs +++ b/src/OneScript/Infrastructure/AnnotationException.cs @@ -1,8 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using ScriptEngine; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using ScriptEngine.Machine; namespace OneScript.WebHost.Infrastructure diff --git a/src/OneScript/Infrastructure/AppStarter.cs b/src/OneScript/Infrastructure/AppStarter.cs index 1c71ce1..f21cd47 100644 --- a/src/OneScript/Infrastructure/AppStarter.cs +++ b/src/OneScript/Infrastructure/AppStarter.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.IO; using System.Linq; using System.Reflection; @@ -102,4 +108,4 @@ public string[] GetCommandLineArguments() throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/CustomMarshaller.cs b/src/OneScript/Infrastructure/CustomMarshaller.cs index 61eb841..087f7b8 100644 --- a/src/OneScript/Infrastructure/CustomMarshaller.cs +++ b/src/OneScript/Infrastructure/CustomMarshaller.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; @@ -106,4 +112,4 @@ public static object ConvertToCLRObject(IValue value) } } } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/DbContextProvider.cs b/src/OneScript/Infrastructure/DbContextProvider.cs index 52c7fc1..cf2e633 100644 --- a/src/OneScript/Infrastructure/DbContextProvider.cs +++ b/src/OneScript/Infrastructure/DbContextProvider.cs @@ -1,3 +1,9 @@ +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ // /*---------------------------------------------------------- // This Source Code Form is subject to the terms of the // Mozilla Public License, v.2.0. If a copy of the MPL @@ -24,4 +30,4 @@ public ApplicationDbContext CreateContext() return new ApplicationDbContext(_options); } } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/DynamicContextWrapper.cs b/src/OneScript/Infrastructure/DynamicContextWrapper.cs index 5385873..330d9ab 100644 --- a/src/OneScript/Infrastructure/DynamicContextWrapper.cs +++ b/src/OneScript/Infrastructure/DynamicContextWrapper.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections; using System.Collections.Generic; using System.Dynamic; diff --git a/src/OneScript/Infrastructure/ExtensionsCompiler.cs b/src/OneScript/Infrastructure/ExtensionsCompiler.cs index b6f90e9..b63e6d9 100644 --- a/src/OneScript/Infrastructure/ExtensionsCompiler.cs +++ b/src/OneScript/Infrastructure/ExtensionsCompiler.cs @@ -1,4 +1,10 @@ -#if NET461 +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +#if NET461 using System; using System.CodeDom.Compiler; using System.Collections.Generic; @@ -70,4 +76,4 @@ public void AddSource(string code) } } } -#endif \ No newline at end of file +#endif diff --git a/src/OneScript/Infrastructure/FileInfoCodeSource.cs b/src/OneScript/Infrastructure/FileInfoCodeSource.cs index bcb36ea..5d56d5e 100644 --- a/src/OneScript/Infrastructure/FileInfoCodeSource.cs +++ b/src/OneScript/Infrastructure/FileInfoCodeSource.cs @@ -1,8 +1,11 @@ -using System; -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.IO; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.FileProviders; using ScriptEngine.Environment; diff --git a/src/OneScript/Infrastructure/IApplicationFactory.cs b/src/OneScript/Infrastructure/IApplicationFactory.cs index b25c53c..3b8a5a9 100644 --- a/src/OneScript/Infrastructure/IApplicationFactory.cs +++ b/src/OneScript/Infrastructure/IApplicationFactory.cs @@ -1,6 +1,11 @@ -using Microsoft.AspNetCore.Hosting; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using OneScript.WebHost.Application; -using ScriptEngine.Machine; namespace OneScript.WebHost.Infrastructure { diff --git a/src/OneScript/Infrastructure/IApplicationRuntime.cs b/src/OneScript/Infrastructure/IApplicationRuntime.cs index f6feae1..79ffe41 100644 --- a/src/OneScript/Infrastructure/IApplicationRuntime.cs +++ b/src/OneScript/Infrastructure/IApplicationRuntime.cs @@ -1,5 +1,10 @@ -using ScriptEngine; -using ScriptEngine.Environment; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using ScriptEngine; namespace OneScript.WebHost.Infrastructure { @@ -10,4 +15,4 @@ public interface IApplicationRuntime CompilerService GetCompilerService(); } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/Implementations/ClassAttributeResolver.cs b/src/OneScript/Infrastructure/Implementations/ClassAttributeResolver.cs index 01b1c87..44b18ff 100644 --- a/src/OneScript/Infrastructure/Implementations/ClassAttributeResolver.cs +++ b/src/OneScript/Infrastructure/Implementations/ClassAttributeResolver.cs @@ -1,6 +1,11 @@ -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Collections.Generic; using System.Linq; -using ScriptEngine; using ScriptEngine.Compiler; using ScriptEngine.Environment; using ScriptEngine.Machine; @@ -61,4 +66,4 @@ public void AfterCompilation() { } } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/Implementations/CustomHttpMethodAttribute.cs b/src/OneScript/Infrastructure/Implementations/CustomHttpMethodAttribute.cs index a5fc59b..0ccd9db 100644 --- a/src/OneScript/Infrastructure/Implementations/CustomHttpMethodAttribute.cs +++ b/src/OneScript/Infrastructure/Implementations/CustomHttpMethodAttribute.cs @@ -1,7 +1,11 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Routing; namespace OneScript.WebHost.Infrastructure.Implementations diff --git a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs index cc75128..572b922 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs @@ -1,9 +1,15 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using System.Threading; +using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ActionConstraints; @@ -16,7 +22,6 @@ using Microsoft.Extensions.Primitives; using OneScript.WebHost.Application; using ScriptEngine.Environment; -using ScriptEngine.HostedScript; using ScriptEngine.Machine.Contexts; using ScriptEngine.Machine; using ScriptEngine.Machine.Reflection; @@ -534,11 +539,11 @@ private void MapDirect(string name, string alias, Type attrType) private void FillDefaultMappers() { - MapDirect("Authorize", "Авторизовать", typeof(AuthorizeAttribute)); MapDirect("HttpPost", null, typeof(HttpPostAttribute)); MapDirect("HttpGet", null, typeof(HttpGetAttribute)); _annotationMapper.AddMapper("HttpMethod", MapHttpMethod); + _annotationMapper.AddMapper("Authorize", "Авторизовать", MapAuthorizationAttribute); _annotationMapper.AddMapper("Action", "Действие", (annotation) => { if (annotation.ParamCount != 1) @@ -581,5 +586,33 @@ private static object MapHttpMethod(AnnotationDefinition anno) throw new AnnotationException(anno, "Too many parameters"); } + + private static object MapAuthorizationAttribute(AnnotationDefinition anno) + { + var instance = new AuthorizeAttribute(); + if (anno.ParamCount == 0) + return instance; + + foreach (var parameter in anno.Parameters) + { + if (BiLingualEquals(parameter.Name, "roles", "роли")) + { + instance.Roles = parameter.RuntimeValue.AsString(); + } + else if (BiLingualEquals(parameter.Name, "policy", "политика")) + { + instance.Policy = parameter.RuntimeValue.AsString(); + } + } + + return instance; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool BiLingualEquals(string src, string en, string ru) + { + return src.Equals(en, StringComparison.OrdinalIgnoreCase) || + src.Equals(ru, StringComparison.OrdinalIgnoreCase); + } } } diff --git a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentActivator.cs b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentActivator.cs index 8149556..e0ed8da 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentActivator.cs @@ -1,11 +1,14 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; using System.Reflection; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ViewComponents; -using Microsoft.Extensions.DependencyInjection; using ScriptEngine.Machine; using ScriptEngine.Machine.Reflection; diff --git a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvoker.cs b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvoker.cs index 9f2c5a9..00f8f3f 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvoker.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvoker.cs @@ -1,10 +1,14 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Diagnostics; using System.Threading.Tasks; -using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewComponents; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using OneScript.WebHost.Application; namespace OneScript.WebHost.Infrastructure.Implementations @@ -45,4 +49,4 @@ private static IViewComponentResult CoerceToViewComponentResult(object value) throw new InvalidOperationException($"Can't use type {value.GetType()} as the result of view component"); } } -} \ No newline at end of file +} diff --git a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs index 108b434..77cae99 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptViewComponentInvokerFactory.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Microsoft.AspNetCore.Mvc.ViewComponents; namespace OneScript.WebHost.Infrastructure.Implementations diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs b/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs index c2f9992..1558d4d 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs @@ -1,13 +1,13 @@ -using Microsoft.AspNetCore.Mvc.Controllers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc; using OneScript.WebHost.Application; using OneScript.WebHost.Database; -using ScriptEngine; -using ScriptEngine.Environment; using ScriptEngine.Machine; namespace OneScript.WebHost.Infrastructure.Implementations diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs index c7a0661..4fb3cbf 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs @@ -1,11 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using OneScript.WebHost.Application; -using ScriptEngine; -using ScriptEngine.Environment; using ScriptEngine.Machine; using Microsoft.Extensions.FileProviders; diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs b/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs index e7fc3b2..cd24af2 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedViewComponentFeatureProvider.cs @@ -1,17 +1,20 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders.Physical; using OneScript.WebHost.Application; -using ScriptEngine; using ScriptEngine.Machine.Reflection; namespace OneScript.WebHost.Infrastructure.Implementations diff --git a/src/OneScript/Infrastructure/OneScriptServicePlugin.cs b/src/OneScript/Infrastructure/OneScriptServicePlugin.cs index 70c690a..5b59e26 100644 --- a/src/OneScript/Infrastructure/OneScriptServicePlugin.cs +++ b/src/OneScript/Infrastructure/OneScriptServicePlugin.cs @@ -1,8 +1,12 @@ -#if NETCOREAPP +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +#if NETCOREAPP using System.Text; #endif - -using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -16,7 +20,6 @@ using OneScript.DebugServices; using OneScript.WebHost.Authorization; using OneScript.WebHost.Infrastructure.Implementations; -using ScriptEngine.Machine; namespace OneScript.WebHost.Infrastructure { diff --git a/src/OneScript/Infrastructure/OscriptViewsOverride.cs b/src/OneScript/Infrastructure/OscriptViewsOverride.cs index b52811e..38914df 100644 --- a/src/OneScript/Infrastructure/OscriptViewsOverride.cs +++ b/src/OneScript/Infrastructure/OscriptViewsOverride.cs @@ -1,4 +1,10 @@ -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.Razor; diff --git a/src/OneScript/Infrastructure/ScriptedMiddlewareExtension.cs b/src/OneScript/Infrastructure/ScriptedMiddlewareExtension.cs index 06e6718..56f186c 100644 --- a/src/OneScript/Infrastructure/ScriptedMiddlewareExtension.cs +++ b/src/OneScript/Infrastructure/ScriptedMiddlewareExtension.cs @@ -1,12 +1,11 @@ -using Microsoft.AspNetCore.Builder; -using OneScript.WebHost.Application; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using Microsoft.AspNetCore.Builder; using OneScript.WebHost.Infrastructure.Implementations; -using ScriptEngine.Environment; -using ScriptEngine.Machine; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace OneScript.WebHost.Infrastructure { diff --git a/src/OneScript/Infrastructure/TypeReflectionEngine.cs b/src/OneScript/Infrastructure/TypeReflectionEngine.cs index e6955eb..9856399 100644 --- a/src/OneScript/Infrastructure/TypeReflectionEngine.cs +++ b/src/OneScript/Infrastructure/TypeReflectionEngine.cs @@ -1,9 +1,12 @@ -using ScriptEngine.Environment; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using ScriptEngine.Machine.Contexts; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using ScriptEngine.Machine; using ScriptEngine.Machine.Reflection; diff --git a/src/OneScript/Infrastructure/WebApplicationEngine.cs b/src/OneScript/Infrastructure/WebApplicationEngine.cs index 82bc5e9..0bdd144 100644 --- a/src/OneScript/Infrastructure/WebApplicationEngine.cs +++ b/src/OneScript/Infrastructure/WebApplicationEngine.cs @@ -1,15 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Hosting; -using OneScript.WebHost.Application; using ScriptEngine; using ScriptEngine.HostedScript.Library; -using ScriptEngine.HostedScript; -using ScriptEngine.Machine; -using ScriptEngine.Machine.Contexts; namespace OneScript.WebHost.Infrastructure { diff --git a/src/OneScript/Program.cs b/src/OneScript/Program.cs index 48c144d..2dad41b 100644 --- a/src/OneScript/Program.cs +++ b/src/OneScript/Program.cs @@ -1,4 +1,10 @@ -using System.Collections.Generic; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; diff --git a/src/OneScript/Startup.cs b/src/OneScript/Startup.cs index 0de5b6e..94283a7 100644 --- a/src/OneScript/Startup.cs +++ b/src/OneScript/Startup.cs @@ -1,20 +1,19 @@ -using System; -using System.IO; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.IO.Compression; using System.Linq; -using System.Net.Mime; -using System.Reflection; -using Hangfire; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor; -using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.ResponseCompression; -using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/OneScriptWeb.Tests/ActionResultTests.cs b/src/OneScriptWeb.Tests/ActionResultTests.cs index ae1b739..62f69cb 100644 --- a/src/OneScriptWeb.Tests/ActionResultTests.cs +++ b/src/OneScriptWeb.Tests/ActionResultTests.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/OneScriptWeb.Tests/AppModelTests.cs b/src/OneScriptWeb.Tests/AppModelTests.cs index c1e055c..c56abe5 100644 --- a/src/OneScriptWeb.Tests/AppModelTests.cs +++ b/src/OneScriptWeb.Tests/AppModelTests.cs @@ -1,4 +1,10 @@ -using System.Linq; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Linq; using System.Reflection; using Dazinator.AspNet.Extensions.FileProviders; using Microsoft.AspNetCore.Authorization; diff --git a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs index f526f6e..ebc8e59 100644 --- a/src/OneScriptWeb.Tests/ApplicationStartupTests.cs +++ b/src/OneScriptWeb.Tests/ApplicationStartupTests.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/src/OneScriptWeb.Tests/AssemblyInfo.cs b/src/OneScriptWeb.Tests/AssemblyInfo.cs index c0542bc..48f99bb 100644 --- a/src/OneScriptWeb.Tests/AssemblyInfo.cs +++ b/src/OneScriptWeb.Tests/AssemblyInfo.cs @@ -1,4 +1,10 @@ - +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + using Xunit; -[assembly: Xunit.CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] \ No newline at end of file +[assembly: Xunit.CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] diff --git a/src/OneScriptWeb.Tests/AuthHandlerTests.cs b/src/OneScriptWeb.Tests/AuthHandlerTests.cs index 528f9da..b423678 100644 --- a/src/OneScriptWeb.Tests/AuthHandlerTests.cs +++ b/src/OneScriptWeb.Tests/AuthHandlerTests.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; diff --git a/src/OneScriptWeb.Tests/ControllerCreationTest.cs b/src/OneScriptWeb.Tests/ControllerCreationTest.cs index 97f1879..c4526a1 100644 --- a/src/OneScriptWeb.Tests/ControllerCreationTest.cs +++ b/src/OneScriptWeb.Tests/ControllerCreationTest.cs @@ -1,4 +1,10 @@ -using System.Reflection; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System.Reflection; using Dazinator.AspNet.Extensions.FileProviders; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; diff --git a/src/OneScriptWeb.Tests/DbModelCreatorTests.cs b/src/OneScriptWeb.Tests/DbModelCreatorTests.cs index 6876be5..5044573 100644 --- a/src/OneScriptWeb.Tests/DbModelCreatorTests.cs +++ b/src/OneScriptWeb.Tests/DbModelCreatorTests.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/OneScriptWeb.Tests/DynamicContextWrapperTest.cs b/src/OneScriptWeb.Tests/DynamicContextWrapperTest.cs index 51f7051..c5b422e 100644 --- a/src/OneScriptWeb.Tests/DynamicContextWrapperTest.cs +++ b/src/OneScriptWeb.Tests/DynamicContextWrapperTest.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; diff --git a/src/OneScriptWeb.Tests/DynamicExtensionTest.cs b/src/OneScriptWeb.Tests/DynamicExtensionTest.cs index 7ae895b..1d6989b 100644 --- a/src/OneScriptWeb.Tests/DynamicExtensionTest.cs +++ b/src/OneScriptWeb.Tests/DynamicExtensionTest.cs @@ -1,4 +1,10 @@ -#if NETFRAMEWORK +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +#if NETFRAMEWORK using System; using System.CodeDom.Compiler; diff --git a/src/OneScriptWeb.Tests/FakeFileInfo.cs b/src/OneScriptWeb.Tests/FakeFileInfo.cs index 5d2e64f..9cc1dbb 100644 --- a/src/OneScriptWeb.Tests/FakeFileInfo.cs +++ b/src/OneScriptWeb.Tests/FakeFileInfo.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/OneScriptWeb.Tests/FileProviderExtensions.cs b/src/OneScriptWeb.Tests/FileProviderExtensions.cs index f12183d..55446b9 100644 --- a/src/OneScriptWeb.Tests/FileProviderExtensions.cs +++ b/src/OneScriptWeb.Tests/FileProviderExtensions.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs b/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs index 65a3a3f..a210141 100644 --- a/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs +++ b/src/OneScriptWeb.Tests/HttpRequestResponseTests.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Net.Http.Headers; diff --git a/src/OneScriptWeb.Tests/SessionsTest.cs b/src/OneScriptWeb.Tests/SessionsTest.cs index 7ff3198..3406f78 100644 --- a/src/OneScriptWeb.Tests/SessionsTest.cs +++ b/src/OneScriptWeb.Tests/SessionsTest.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/OneScriptWeb.Tests/TestOrderingLock.cs b/src/OneScriptWeb.Tests/TestOrderingLock.cs index a313202..eac51de 100644 --- a/src/OneScriptWeb.Tests/TestOrderingLock.cs +++ b/src/OneScriptWeb.Tests/TestOrderingLock.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Collections.Generic; using System.Text; diff --git a/src/OneScriptWeb.Tests/TypeReflectionTest.cs b/src/OneScriptWeb.Tests/TypeReflectionTest.cs index a2a3bdd..1e33553 100644 --- a/src/OneScriptWeb.Tests/TypeReflectionTest.cs +++ b/src/OneScriptWeb.Tests/TypeReflectionTest.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Threading; using OneScript.WebHost.Infrastructure; using OneScript.WebHost.Infrastructure.Implementations; diff --git a/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs b/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs index 2dbfd2c..1b86002 100644 --- a/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs +++ b/src/OneScriptWeb.Tests/ViewComponentDiscoveryTest.cs @@ -1,4 +1,10 @@ -using System; +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ +using System; using System.Linq; using System.Reflection; using Dazinator.AspNet.Extensions.FileProviders; From bbbbfc54dd680c9ab8715110a851ce399f66ab09 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Mon, 26 Oct 2020 12:01:06 +0300 Subject: [PATCH 07/18] =?UTF-8?q?=D0=9D=D0=B5=D0=BD=D1=83=D0=B6=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript/Application/ApplicationInstance.cs | 5 ----- src/OneScript/Startup.cs | 1 - 2 files changed, 6 deletions(-) diff --git a/src/OneScript/Application/ApplicationInstance.cs b/src/OneScript/Application/ApplicationInstance.cs index e7b693c..ba7b00a 100644 --- a/src/OneScript/Application/ApplicationInstance.cs +++ b/src/OneScript/Application/ApplicationInstance.cs @@ -265,10 +265,5 @@ public static ApplicationInstance Create(ICodeSource src, IApplicationRuntime we return app; } - - public void UseServices(IServiceProvider services) - { - //throw new NotImplementedException(); - } } } diff --git a/src/OneScript/Startup.cs b/src/OneScript/Startup.cs index 94283a7..16d7c41 100644 --- a/src/OneScript/Startup.cs +++ b/src/OneScript/Startup.cs @@ -107,7 +107,6 @@ private static void StartOneScriptApp(IApplicationBuilder app, IServiceProvider { var oscriptApp = services.GetService(); appRuntime.Engine.DebugController = services.GetService(); - oscriptApp.UseServices(services); if (appRuntime.DebugEnabled()) { From c2fb9ca322e73c658375506a8b6b88e1bde27f97 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 18:36:45 +0300 Subject: [PATCH 08/18] =?UTF-8?q?=D0=9D=D0=B5=D1=83=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=BF=D1=80=D0=B5=D1=84=D0=B8=D0=BA=D1=81=D1=8B=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=86=D0=B5=D0=BD=D0=B7=D0=B8=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/ScriptedController.cs | 124 +++++++++--------- .../Infrastructure/DbContextProvider.cs | 8 +- src/OneScriptWeb.Tests/AssemblyInfo.cs | 10 +- 3 files changed, 66 insertions(+), 76 deletions(-) diff --git a/src/OneScript/Application/ScriptedController.cs b/src/OneScript/Application/ScriptedController.cs index 8384c90..8c1e469 100644 --- a/src/OneScript/Application/ScriptedController.cs +++ b/src/OneScript/Application/ScriptedController.cs @@ -11,6 +11,8 @@ This Source Code Form is subject to the terms of the using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.DependencyInjection; using OneScript.WebHost.Infrastructure; +using ScriptEngine; +using ScriptEngine.Environment; using ScriptEngine.HostedScript.Library; using ScriptEngine.HostedScript.Library.Binary; using ScriptEngine.Machine; @@ -19,9 +21,9 @@ This Source Code Form is subject to the terms of the namespace OneScript.WebHost.Application { /// - /// Главный класс, отвечающий Р·Р° обработку входящего запроса Рё генерацию ответа. + /// Главный класс, отвечающий за обработку входящего запроса и генерацию ответа. /// - [ContextClass("Контроллер")] + [ContextClass("Контроллер")] [NonController] public class ScriptedController : AutoScriptDrivenObject { @@ -55,7 +57,7 @@ public ScriptedController(ControllerContext context, LoadedModule module) : base RouteValues = ValueFactory.Create(); var typeClr = (Type)context.ActionDescriptor.Properties["type"]; - var type = TypeManager.RegisterType("Контроллер."+typeClr.Name, typeof(ScriptedController)); + var type = TypeManager.RegisterType("Контроллер."+typeClr.Name, typeof(ScriptedController)); DefineType(type); InitOwnData(); } @@ -101,29 +103,29 @@ public ViewDataDictionary FrameworkViewData } /// - /// Входящий запрос HTTP + /// Входящий запрос HTTP /// - [ContextProperty("ЗапросHttp")] + [ContextProperty("ЗапросHttp")] public HttpRequestImpl HttpRequest { get; } /// - /// Исходящий ответ HTTP + /// Исходящий ответ HTTP /// - [ContextProperty("ОтветHttp")] + [ContextProperty("ОтветHttp")] public HttpResponseImpl HttpResponse { get; } /// - /// Действующие значения маршрута для текущего вызова. - /// РўРёРї: Соответствие или Неопределено. - /// Ключами соответствия являются переменные маршрута. + /// Действующие значения маршрута для текущего вызова. + /// Тип: Соответствие или Неопределено. + /// Ключами соответствия являются переменные маршрута. /// - [ContextProperty("ЗначенияМаршрута")] + [ContextProperty("ЗначенияМаршрута")] public IValue RouteValues { get; } /// - /// Данные http-сессии. Механизм сессий использует Cookies для РїСЂРёРІСЏР·РєРё сессии Рё InMemory хранилище для данных сессии. + /// Данные http-сессии. Механизм сессий использует Cookies для привязки сессии и InMemory хранилище для данных сессии. /// - [ContextProperty("Сессия")] + [ContextProperty("Сессия")] public SessionImpl Session { get @@ -135,27 +137,27 @@ public SessionImpl Session } /// - /// Специализированный объект, предназначенный для передачи данных РІ генерируемое Представление. - /// Элементы коллекции доступны РІ Представлении через свойства ViewBag Рё ViewData. + /// Специализированный объект, предназначенный для передачи данных в генерируемое Представление. + /// Элементы коллекции доступны в Представлении через свойства ViewBag и ViewData. /// - [ContextProperty("ДанныеПредставления")] + [ContextProperty("ДанныеПредставления")] public ViewDataDictionaryWrapper ViewData { get => _osViewData ?? (_osViewData = new ViewDataDictionaryWrapper()); set => _osViewData = value ?? throw new ArgumentException(); } - [ContextProperty("СостояниеМодели", "ModelState")] + [ContextProperty("СостояниеМодели", "ModelState")] public ModelStateDictionaryWrapper ModelState => _modelState ?? (_modelState = new ModelStateDictionaryWrapper(_ctx.ModelState)); /// - /// Вспомогательный метод генерации ответа РІ РІРёРґРµ представления. + /// Вспомогательный метод генерации ответа в виде представления. /// - /// Имя представления или объект Модели (если используется представление РїРѕ умолчанию) - /// Объект модели (произвольный) - /// РезультатДействияПредставление. - [ContextMethod("Представление")] + /// Имя представления или объект Модели (если используется представление по умолчанию) + /// Объект модели (произвольный) + /// РезультатДействияПредставление. + [ContextMethod("Представление")] public ViewActionResult View(IValue nameOrModel = null, IValue model = null) { if (nameOrModel == null && model == null) @@ -182,12 +184,12 @@ public ViewActionResult View(IValue nameOrModel = null, IValue model = null) } /// - /// Вспомогательный метод генерации ответа РІ РІРёРґРµ текстового содержимого + /// Вспомогательный метод генерации ответа в виде текстового содержимого /// - /// Содержимое ответа - /// РљРѕРґРёСЂРѕРІРєР° текста ответа - /// РезультатДействияСодержимое - [ContextMethod("Содержимое")] + /// Содержимое ответа + /// Кодировка текста ответа + /// РезультатДействияСодержимое + [ContextMethod("Содержимое")] public ContentActionResult Content(string content, string contentType = null) { var ctResult = new ContentActionResult() @@ -200,13 +202,13 @@ public ContentActionResult Content(string content, string contentType = null) } /// - /// Вспомогательный метод генерации ответа РІ РІРёРґРµ скачиваемого файла. + /// Вспомогательный метод генерации ответа в виде скачиваемого файла. /// - /// Данные файла (путь или ДвоичныеДанные) - /// Содержимое заголовка Content-type - /// Имя скачиваемого файла - /// РезультатДействияФайл - [ContextMethod("Файл")] + /// Данные файла (путь или ДвоичныеДанные) + /// Содержимое заголовка Content-type + /// Имя скачиваемого файла + /// РезультатДействияФайл + [ContextMethod("Файл")] public FileActionResult File(IValue data, string contentType = null, string downloadFileName = null) { FileActionResult fileResult; @@ -230,37 +232,37 @@ public FileActionResult File(IValue data, string contentType = null, string down } /// - /// Вспомогательный метод, генерирующий РєРѕРґ состояния HTTP + /// Вспомогательный метод, генерирующий код состояния HTTP /// - /// РљРѕРґ состояния - /// РезультатДействияКодСостояния - [ContextMethod("КодСостояния")] + /// Код состояния + /// РезультатДействияКодСостояния + [ContextMethod("КодСостояния")] public StatusCodeActionResult StatusCode(int code) { return StatusCodeActionResult.Constructor(code); } /// - /// Вспомогательный метод, генерирующий ответ РІ РІРёРґРµ http-редиректа + /// Вспомогательный метод, генерирующий ответ в виде http-редиректа /// - /// Адрес перенаправления - /// Признак постоянного (permanent) перенаправления. - /// РезультатДействияПеренаправление - [ContextMethod("Перенаправление")] + /// Адрес перенаправления + /// Признак постоянного (permanent) перенаправления. + /// РезультатДействияПеренаправление + [ContextMethod("Перенаправление")] public RedirectActionResult Redirect(string url, bool permanent = false) { return RedirectActionResult.Create(url, permanent); } /// - /// Вспомогательный метод, генерирующий ответ РІ РІРёРґРµ http-редиректа + /// Вспомогательный метод, генерирующий ответ в виде http-редиректа /// - /// Имя действия перенаправления - /// Контроллер перенаправления - /// Дополнительные поля - /// Признак постоянного (permanent) перенаправления. - /// РезультатДействияПеренаправление - [ContextMethod("ПеренаправлениеНаДействие")] + /// Имя действия перенаправления + /// Контроллер перенаправления + /// Дополнительные поля + /// Признак постоянного (permanent) перенаправления. + /// РезультатДействияПеренаправление + [ContextMethod("ПеренаправлениеНаДействие")] public RedirectActionResult RedirectToAction(string action, string controller = null, StructureImpl fields = null, bool permanent = false) { if(fields == null) @@ -271,19 +273,19 @@ public RedirectActionResult RedirectToAction(string action, string controller = var url = ActionUrl(action, fields); if(url == null) - throw new RuntimeException("РќРµ обнаружен заданный маршрут."); + throw new RuntimeException("Не обнаружен заданный маршрут."); return RedirectActionResult.Create(url, permanent); } /// - /// Генерирует URL для маршрута, заданного РІ приложении. - /// Параметр routeName позволяет жестко привязать генерацию адреса Рє конкретному маршруту + /// Генерирует URL для маршрута, заданного в приложении. + /// Параметр routeName позволяет жестко привязать генерацию адреса к конкретному маршруту /// - /// Строка. Имя маршрута - /// Структура. Поля маршрута РІ РІРёРґРµ структуры. - /// РезультатДействияПеренаправление - [ContextMethod("АдресМаршрута")] + /// Строка. Имя маршрута + /// Структура. Поля маршрута в виде структуры. + /// РезультатДействияПеренаправление + [ContextMethod("АдресМаршрута")] public string RouteUrl(string routeName = null, StructureImpl fields = null) { string result; @@ -309,12 +311,12 @@ public string RouteUrl(string routeName = null, StructureImpl fields = null) } /// - /// Генерирует Url для действия РІ контроллере + /// Генерирует Url для действия в контроллере /// - /// Имя действия - /// Имя контроллера строкой или структура/соответствие полей маршрута. + /// Имя действия + /// Имя контроллера строкой или структура/соответствие полей маршрута. /// - [ContextMethod("АдресДействия", "ActionUrl")] + [ContextMethod("АдресДействия", "ActionUrl")] public string ActionUrl(string action, IValue fieldsOrController = null) { string result; @@ -387,7 +389,7 @@ private ViewActionResult DefaultViewResult() return new ViewActionResult() { ViewData = ViewData }; } - // TODO: Костыль вызванный ошибкой https://github.com/EvilBeaver/OneScript/issues/660 + // TODO: Костыль вызванный ошибкой https://github.com/EvilBeaver/OneScript/issues/660 internal static int GetOwnMethodsRelectionOffset() { return _ownMethods.Count; diff --git a/src/OneScript/Infrastructure/DbContextProvider.cs b/src/OneScript/Infrastructure/DbContextProvider.cs index cf2e633..2fb00bb 100644 --- a/src/OneScript/Infrastructure/DbContextProvider.cs +++ b/src/OneScript/Infrastructure/DbContextProvider.cs @@ -4,12 +4,6 @@ This Source Code Form is subject to the terms of the was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ -// /*---------------------------------------------------------- -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v.2.0. If a copy of the MPL -// was not distributed with this file, You can obtain one -// at http://mozilla.org/MPL/2.0/. -// ----------------------------------------------------------*/ using Microsoft.EntityFrameworkCore; using OneScript.WebHost.Database; @@ -30,4 +24,4 @@ public ApplicationDbContext CreateContext() return new ApplicationDbContext(_options); } } -} +} \ No newline at end of file diff --git a/src/OneScriptWeb.Tests/AssemblyInfo.cs b/src/OneScriptWeb.Tests/AssemblyInfo.cs index 48f99bb..c0542bc 100644 --- a/src/OneScriptWeb.Tests/AssemblyInfo.cs +++ b/src/OneScriptWeb.Tests/AssemblyInfo.cs @@ -1,10 +1,4 @@ -/*---------------------------------------------------------- -This Source Code Form is subject to the terms of the -Mozilla Public License, v.2.0. If a copy of the MPL -was not distributed with this file, You can obtain one -at http://mozilla.org/MPL/2.0/. -----------------------------------------------------------*/ - + using Xunit; -[assembly: Xunit.CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] +[assembly: Xunit.CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] \ No newline at end of file From a233e78ecb3c31280a6e4e6a2d53711c7e75ba25 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 18:38:21 +0300 Subject: [PATCH 09/18] =?UTF-8?q?=D0=9D=D0=B5=D0=BD=D1=83=D0=B6=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript/Application/ScriptedController.cs | 6 ------ .../Implementations/OscriptApplicationModelProvider.cs | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/OneScript/Application/ScriptedController.cs b/src/OneScript/Application/ScriptedController.cs index 8c1e469..6c291b2 100644 --- a/src/OneScript/Application/ScriptedController.cs +++ b/src/OneScript/Application/ScriptedController.cs @@ -388,11 +388,5 @@ private ViewActionResult DefaultViewResult() { return new ViewActionResult() { ViewData = ViewData }; } - - // TODO: Костыль вызванный ошибкой https://github.com/EvilBeaver/OneScript/issues/660 - internal static int GetOwnMethodsRelectionOffset() - { - return _ownMethods.Count; - } } } diff --git a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs index 572b922..078d34c 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs @@ -35,7 +35,6 @@ public class OscriptApplicationModelProvider : IApplicationModelProvider private readonly IApplicationRuntime _fw; private readonly IFileProvider _scriptsProvider; - private readonly int _controllersMethodOffset; private readonly ApplicationInstance _app; private readonly IAuthorizationPolicyProvider _policyProvider; private readonly ClassAttributeResolver _classAttribResolver; @@ -50,7 +49,6 @@ public OscriptApplicationModelProvider(ApplicationInstance appObject, _fw = framework; _app = appObject; _scriptsProvider = sourceProvider; - _controllersMethodOffset = ScriptedController.GetOwnMethodsRelectionOffset(); _policyProvider = authPolicyProvider; _classAttribResolver = new ClassAttributeResolver(); From e8417919828616c3d508dd4f8de9f1e2a1fe5f05 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 21:34:55 +0300 Subject: [PATCH 10/18] =?UTF-8?q?=D0=91=D1=8D=D0=BA=D0=B0=D0=BF=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d28451d..617b6fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,61 @@ pipeline { agent none + environment { + ReleaseNumber = '0.7.0' + } + stages { - stage('Build everything') + + stage('Build and test'){ + options { skipDefaultCheckout() } + parallel { + stage('Build Windows'){ + agent {label 'windows'} + steps { + bat "dotnet build OneScript.sln -r win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release" + + bat ''' + if exist testResults erase /Q testResults + dotnet test src/OneScriptWeb.Tests\OneScriptWeb.Tests.csproj -c Release -f netcoreapp3.1 --logger=trx --results-directory=testResults + '''.stripIndent() + mstest testResultsFile: 'testResults/*.trx' + } + } + + stage('Build Linux') { + agent { + label 'linux' + image 'mcr.microsoft.com/dotnet/core/sdk:3.1' + } + steps { + sh "dotnet build OneScript.sln -r linux-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release" + sh ''' + rm testResults/* + dotnet test src/OneScriptWeb.Tests\OneScriptWeb.Tests.csproj -c Release -f netcoreapp3.1 --logger=trx --results-directory=testResults + '''.stripIndent() + mstest testResultsFile: 'testResults/*.trx' + } + } + } + } + + stage('Package'){ + options { skipDefaultCheckout() } + parallel { + stage('Make Windows artifact'){ + agent { label 'windows' } + steps { + bat 'dotnet publish src/OneScript/OneScriptWeb.csproj -r win-x64 -f netcoreapp3.1 --no-build -o artifact/core/win-x64' + } + } + stage('Make Linux artifact'){ + + } + } + } + + stage('Package') { options { skipDefaultCheckout() } agent { From c18f1c37e53efcef9de54315fdd8410c177e3d3a Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 22:32:05 +0300 Subject: [PATCH 11/18] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=B1=D0=BE=D1=80=D0=BE=D1=87=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 19 +-- Jenkinsfile | 127 ++++++------------ src/OneScript.sln | 15 --- src/OneScript/OneScriptWeb.csproj | 14 +- .../OneScriptWeb.Tests.csproj | 18 +-- 5 files changed, 56 insertions(+), 137 deletions(-) diff --git a/Dockerfile b/Dockerfile index 86d3f52..fc04205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env -WORKDIR /app - -# Copy everything else and build - -COPY . ./ -RUN dotnet restore OneScript/OneScriptWeb.csproj -RUN dotnet publish OneScript/OneScriptWeb.csproj -c Release -o /app/out -f netcoreapp3.1 -r debian-x64 - -# RUNTIME -#FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 -FROM ubuntu:18.04 - -RUN apt update -RUN apt install -y --no-install-recommends liblttng-ust0 libcurl4 libssl1.0.0 libkrb5-3 zlib1g libicu60 && \ - rm -rf /var/lib/apt/lists/* +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 ENV LANG ru_RU.UTF-8 @@ -22,7 +7,7 @@ ENV ASPNETCORE_ENVIRONMENT=Production ENV ASPNETCORE_URLS=http://0.0.0.0:5000 WORKDIR /app -COPY --from=build-env /app/out /var/osp.net +COPY . /var/osp.net ENTRYPOINT ["/var/osp.net/OneScript.WebHost"] EXPOSE 5000 \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 617b6fa..39836be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,103 +8,56 @@ pipeline { stages { stage('Build and test'){ - options { skipDefaultCheckout() } - parallel { - stage('Build Windows'){ - agent {label 'windows'} - steps { - bat "dotnet build OneScript.sln -r win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release" - - bat ''' - if exist testResults erase /Q testResults - dotnet test src/OneScriptWeb.Tests\OneScriptWeb.Tests.csproj -c Release -f netcoreapp3.1 --logger=trx --results-directory=testResults - '''.stripIndent() - mstest testResultsFile: 'testResults/*.trx' - } - } - - stage('Build Linux') { - agent { - label 'linux' - image 'mcr.microsoft.com/dotnet/core/sdk:3.1' - } - steps { - sh "dotnet build OneScript.sln -r linux-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release" - sh ''' - rm testResults/* - dotnet test src/OneScriptWeb.Tests\OneScriptWeb.Tests.csproj -c Release -f netcoreapp3.1 --logger=trx --results-directory=testResults - '''.stripIndent() - mstest testResultsFile: 'testResults/*.trx' - } - } + agent { + label 'linux' + image 'mcr.microsoft.com/dotnet/core/sdk:3.1' } - } + steps { + sh "dotnet build src/OneScript/OneScriptWeb.csproj -r linux-x64;win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" + sh ''' + rm -rf testResults + dotnet test src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj \ + -c Release \ + -f netcoreapp3.1 \ + --runtime win-x64 --logger="trx;LogFileName=win.trx" --results-directory=testResults - stage('Package'){ - options { skipDefaultCheckout() } - parallel { - stage('Make Windows artifact'){ - agent { label 'windows' } - steps { - bat 'dotnet publish src/OneScript/OneScriptWeb.csproj -r win-x64 -f netcoreapp3.1 --no-build -o artifact/core/win-x64' - } - } - stage('Make Linux artifact'){ - - } - } - } + src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj \ + -c Release \ + -f netcoreapp3.1 \ + --runtime linux-x64 --logger="trx;LogFileName=linux.trx" --results-directory=testResults + '''.stripIndent() - stage('Package') - { - options { skipDefaultCheckout() } - agent { - label 'windows' - } - steps { - checkout( - [$class: 'GitSCM', branches: [[name: "${env.BRANCH_NAME}"]], - doGenerateSubmoduleConfigurations: false, - extensions: [ - [$class: 'SubmoduleOption', - disableSubmodules: false, - parentCredentials: false, - recursiveSubmodules: true, - reference: '', - trackingSubmodules: false]], - submoduleCfg: [], - userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) + mstest testResultsFile: 'testResults/*.trx' - dir('src/OneScriptWeb.Tests'){ - bat ''' - @echo off - dotnet restore - dotnet xunit -nunit testresult.xml -configuration Release - ''' - - nunit testResultsPattern: 'testresult.xml' - } + sh '''dotnet publish src/OneScript/OneScriptWeb.csproj \ + --no-build \ + -c Release + -f netcoreapp3.1 + -r win-x64 + -o artifact/core/win-x64 - dir('artifact'){ - deleteDir() - } - - dir('src'){ - bat ''' - @echo off - dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp3.1 -o ../artifact/core/win7-x64 -r win7-x64 - dotnet publish OneScript/OneScriptWeb.csproj -c Release -f netcoreapp3.1 -o ../artifact/core/debian-x64 -r debian-x64 - ''' - } + '''.stripIndent() + + sh '''dotnet publish src/OneScript/OneScriptWeb.csproj \ + --no-build \ + -c Release + -f netcoreapp3.1 + -r linux-x64 + -o artifact/core/linux-x64 + + '''.stripIndent() + + stash includes: 'artifact/**', name: 'buildResults' // новые версии дженкинса падают, если есть ранее зипованый артефакт fileOperations([fileDeleteOperation(excludes: '', includes: '*.zip')]) - zip archive: true, dir: 'artifact/core/win7-x64', glob: '', zipFile: 'oscript.web-win7-x64.zip' - zip archive: true, dir: 'artifact/core/debian-x64', glob: '', zipFile: 'oscript.web-debian-x64-core.zip' + zip archive: true, dir: 'artifact/core/win-x64', glob: '', zipFile: 'oscript.web-win-x64.zip' + zip archive: true, dir: 'artifact/core/linux-x64', glob: '', zipFile: 'oscript.web-linux-x64.zip' } } - stage('Create docker image'){ + + stage('Create docker image') { when { branch 'master' } options { skipDefaultCheckout() } agent { @@ -124,6 +77,8 @@ pipeline { submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) + unstash 'buildResults' + withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) { sh 'docker build -t evilbeaver/oscript-web:0.7.0 --file Dockerfile src' sh 'docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:0.7.0' diff --git a/src/OneScript.sln b/src/OneScript.sln index 8d2cf3e..b3a471e 100644 --- a/src/OneScript.sln +++ b/src/OneScript.sln @@ -21,51 +21,36 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU - ReleaseNetStandard|Any CPU = ReleaseNetStandard|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.Release|Any CPU.Build.0 = Release|Any CPU - {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.ReleaseNetStandard|Any CPU.ActiveCfg = Release|Any CPU - {082351A7-DB5F-41F3-8337-CBAA7C877EC6}.ReleaseNetStandard|Any CPU.Build.0 = Release|Any CPU {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.Debug|Any CPU.Build.0 = Debug|Any CPU {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.Release|Any CPU.ActiveCfg = Release|Any CPU {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.Release|Any CPU.Build.0 = Release|Any CPU - {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.ReleaseNetStandard|Any CPU.ActiveCfg = Release|Any CPU - {894A3A1B-D6FC-4FA2-8712-953A1CA96875}.ReleaseNetStandard|Any CPU.Build.0 = Release|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.Build.0 = Release|Any CPU - {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.ReleaseNetStandard|Any CPU.ActiveCfg = ReleaseNetStandard|Any CPU - {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.ReleaseNetStandard|Any CPU.Build.0 = ReleaseNetStandard|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.ActiveCfg = Release|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.Build.0 = Release|Any CPU - {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.ReleaseNetStandard|Any CPU.ActiveCfg = ReleaseNetStandard|Any CPU - {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.ReleaseNetStandard|Any CPU.Build.0 = ReleaseNetStandard|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.Build.0 = Release|Any CPU - {778596E5-05C4-4775-A88B-34B3B48B56BA}.ReleaseNetStandard|Any CPU.ActiveCfg = Debug|Any CPU - {778596E5-05C4-4775-A88B-34B3B48B56BA}.ReleaseNetStandard|Any CPU.Build.0 = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.Build.0 = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.ActiveCfg = Release|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.Build.0 = Release|Any CPU - {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.ReleaseNetStandard|Any CPU.ActiveCfg = Debug|Any CPU - {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.ReleaseNetStandard|Any CPU.Build.0 = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.Build.0 = Release|Any CPU - {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.ReleaseNetStandard|Any CPU.ActiveCfg = Debug|Any CPU - {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.ReleaseNetStandard|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/OneScript/OneScriptWeb.csproj b/src/OneScript/OneScriptWeb.csproj index ff1e455..2565f5a 100644 --- a/src/OneScript/OneScriptWeb.csproj +++ b/src/OneScript/OneScriptWeb.csproj @@ -1,15 +1,25 @@ + + 0.7.0 + $(BUILD_NUMBER) + 0 + OneScript.WebHost OneScript.WebHost OneScript.WebHost.Program - 0.7.0.0 - 0.7.0.0 + $(ReleaseNumber).$(BuildNumber) + $(ReleaseNumber).$(BuildNumber) false false netcoreapp3.1 + + 1Script Server Pages + Copyright (c) 2018 EvilBeaver + + AnyCPU win7-x64;debian-x64;fedora-x64 diff --git a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj index 7db0f7e..23d1d02 100644 --- a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj +++ b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj @@ -1,26 +1,10 @@  - false - netcoreapp3.1 - - - 1 - $(BUILD_NUMBER) - 0 - 0 - - - - 1.$(ReleaseNumber).$(PatchNumber).$(BuildNumber) - $(Version) - 1Script Server Pages - Copyright (c) 2018 EvilBeaver - - + From d38f7608d4d5890d615577e1f11d59b267f87223 Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 22:38:20 +0300 Subject: [PATCH 12/18] =?UTF-8?q?=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D0=B5=20=D1=81?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=BA=D0=B5.=20=D0=98=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=BB=20=D0=B0=D0=B3=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 39836be..d4f61a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,6 @@ pipeline { stage('Build and test'){ agent { - label 'linux' image 'mcr.microsoft.com/dotnet/core/sdk:3.1' } steps { From 8bfb0ac001dc5bca080aeef386362b32f761a7aa Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Wed, 28 Oct 2020 22:40:48 +0300 Subject: [PATCH 13/18] =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=BE=20=D0=B2=D0=BD?= =?UTF-8?q?=D0=B8=D0=BC=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B5=D0=B5=20?= =?UTF-8?q?=D0=B3=D1=83=D0=B3=D0=BB=D0=B8=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d4f61a0..42dd19f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,10 @@ pipeline { stage('Build and test'){ agent { - image 'mcr.microsoft.com/dotnet/core/sdk:3.1' + docker { + image 'mcr.microsoft.com/dotnet/core/sdk:3.1' + label 'linux' + } } steps { sh "dotnet build src/OneScript/OneScriptWeb.csproj -r linux-x64;win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" From cb2e2e4796218f5e67de875b10d95f0947d536fb Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Thu, 29 Oct 2020 14:16:00 +0300 Subject: [PATCH 14/18] =?UTF-8?q?=D0=95=D1=89=D0=B5=20=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B4=D0=BE=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D0=BF=D0=B0?= =?UTF-8?q?=D0=B9=D0=BF=D0=BB=D0=B0=D0=B9=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42dd19f..45ed968 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,14 +8,32 @@ pipeline { stages { stage('Build and test'){ + options { skipDefaultCheckout() } agent { docker { image 'mcr.microsoft.com/dotnet/core/sdk:3.1' label 'linux' } } + environment { + DOTNET_CLI_HOME = "/tmp/DOTNET_CLI_HOME" + } steps { - sh "dotnet build src/OneScript/OneScriptWeb.csproj -r linux-x64;win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" + + checkout( + [$class: 'GitSCM', branches: [[name: "${env.BRANCH_NAME}"]], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'SubmoduleOption', + disableSubmodules: false, + parentCredentials: false, + recursiveSubmodules: true, + reference: '', + trackingSubmodules: false]], + submoduleCfg: [], + userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) + + sh "dotnet build src/OneScript/OneScriptWeb.csproj -r \"linux-x64;win-x64\" /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" sh ''' rm -rf testResults dotnet test src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj \ From abfb745471e5277a99405f0294e8c744da55581c Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 30 Oct 2020 11:48:36 +0300 Subject: [PATCH 15/18] =?UTF-8?q?=D0=A4=D0=BB=D0=B0=D0=B3=D0=B8=20=D1=81?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8=D0=B7=D0=B0=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B.=20=D0=A1=D0=BD=D1=8F=D1=82=20=D1=84=D0=BB?= =?UTF-8?q?=D0=B0=D0=B3=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=20nuget,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=20=D0=BB=D0=B5?= =?UTF-8?q?=D0=B6=D0=B0=D1=82=20=D0=BA=D0=B0=D0=BA=20=D1=87=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D1=81=D0=B0=D0=B1=D0=BC=D0=BE=D0=B4=D1=83=D0=BB?= =?UTF-8?q?=D1=8F=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript.sln | 5 ----- src/OneScript/OneScriptWeb.csproj | 2 ++ src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/OneScript.sln b/src/OneScript.sln index b3a471e..177ca59 100644 --- a/src/OneScript.sln +++ b/src/OneScript.sln @@ -34,23 +34,18 @@ Global {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.Build.0 = Release|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.Build.0 = Release|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.Build.0 = Release|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.Build.0 = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.Build.0 = Release|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/OneScript/OneScriptWeb.csproj b/src/OneScript/OneScriptWeb.csproj index 2565f5a..b821216 100644 --- a/src/OneScript/OneScriptWeb.csproj +++ b/src/OneScript/OneScriptWeb.csproj @@ -17,6 +17,8 @@ 1Script Server Pages Copyright (c) 2018 EvilBeaver + Debug;Release + AnyCPU diff --git a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj index 23d1d02..68b639d 100644 --- a/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj +++ b/src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj @@ -3,6 +3,8 @@ false netcoreapp3.1 + Debug;Release + AnyCPU From 7b265d390f161d5ba566ee70327c79761ccce2bc Mon Sep 17 00:00:00 2001 From: Andrei Ovsiankin Date: Fri, 6 Nov 2020 14:00:56 +0300 Subject: [PATCH 16/18] Ga script (#76) Co-authored-by: Oleg Tymko --- .github/workflows/dotnet-core.yml | 59 +++++++++++++++++++ Jenkinsfile | 6 +- src/Include/OneScript | 2 +- src/OneScript.sln | 5 ++ .../Application/ApplicationInstance.cs | 16 +++-- .../OneScriptAuthorizationHandlerProvider.cs | 2 +- .../BackgroundJobsManagerContext.cs | 4 +- .../ScheduledJobsManagerContext.cs | 2 +- .../OscriptApplicationModelProvider.cs | 2 +- .../ScriptedControllerActivator.cs | 4 +- .../ScriptedMiddlewareActivator.cs | 2 +- .../Infrastructure/RuntimeExtensions.cs | 21 +++++++ src/OneScript/OneScriptWeb.csproj | 6 +- src/OneScript/Startup.cs | 8 ++- 14 files changed, 117 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/dotnet-core.yml create mode 100644 src/OneScript/Infrastructure/RuntimeExtensions.cs diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml new file mode 100644 index 0000000..bf199fd --- /dev/null +++ b/.github/workflows/dotnet-core.yml @@ -0,0 +1,59 @@ +name: Build .NET Core + +on: + push: + branches: + - master + - develop + - GA-* + +env: + MAIN_PROJECT: OneScript/OneScriptWeb.csproj + TEST_PROJECT: OneScriptWeb.Tests/OneScriptWeb.Tests.csproj + SOLUTION: OneScript.sln + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest] + dotnet-version: [3.1.301] + include: + - os: windows-latest + RID: win-x64 + target: netcoreapp3.1 + - os: ubuntu-latest + RID: linux-x64 + target: netcoreapp3.1 + defaults: + run: + working-directory: src + steps: + + # актуализация с сабмодулями + - uses: actions/checkout@v2 + with: + submodules: true + + # установка дотнет + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + # Сборка + - name: Build + run: dotnet build ${{env.MAIN_PROJECT}} -c Release -r ${{matrix.RID}} -f ${{ matrix.target }} -o ../artifact/${{matrix.target}}/${{matrix.RID}} + + # Тесты + - name: Test + run: dotnet test ${{env.TEST_PROJECT}} -c Release --runtime=${{matrix.RID}} -f ${{ matrix.target }} --logger="trx;LogFileName=${{matrix.RID}}.trx" --results-directory=testResults + + # Заливка в артефакты + - name: Artifact + uses: actions/upload-artifact@v2 + with: + name: oscript.web-${{matrix.RID}}.zip + path: ./artifact/${{matrix.target}}/${{matrix.RID}} diff --git a/Jenkinsfile b/Jenkinsfile index 45ed968..23b9a2c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,10 @@ pipeline { agent none + environment { ReleaseNumber = '0.7.0' } - stages { stage('Build and test'){ @@ -100,8 +100,8 @@ pipeline { unstash 'buildResults' withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) { - sh 'docker build -t evilbeaver/oscript-web:0.7.0 --file Dockerfile src' - sh 'docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:0.7.0' + sh "docker build -t evilbeaver/oscript-web:${ReleaseNumber} --file Dockerfile src" + sh "docker login -p $dockerpassword -u $dockeruser && docker push evilbeaver/oscript-web:${ReleaseNumber}" } } } diff --git a/src/Include/OneScript b/src/Include/OneScript index 6e3d3df..44d84f2 160000 --- a/src/Include/OneScript +++ b/src/Include/OneScript @@ -1 +1 @@ -Subproject commit 6e3d3df01d1196c7afac04dd4d17ccade41e11af +Subproject commit 44d84f29680fa691d016520c98d183c726181515 diff --git a/src/OneScript.sln b/src/OneScript.sln index 177ca59..b3a471e 100644 --- a/src/OneScript.sln +++ b/src/OneScript.sln @@ -34,18 +34,23 @@ Global {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59C56111-1C71-475C-8BE9-1173C9E7B7E0}.Release|Any CPU.Build.0 = Release|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0753066-45FE-4A74-9E25-D1D0A6EE1162}.Release|Any CPU.Build.0 = Release|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {778596E5-05C4-4775-A88B-34B3B48B56BA}.Release|Any CPU.Build.0 = Release|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Debug|Any CPU.Build.0 = Debug|Any CPU {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {272DC28D-54B6-4D4D-9970-D3BA324DBECF}.Release|Any CPU.Build.0 = Release|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8530889-A741-4A5E-B606-6C25FE4B8EA4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/OneScript/Application/ApplicationInstance.cs b/src/OneScript/Application/ApplicationInstance.cs index ba7b00a..4769e47 100644 --- a/src/OneScript/Application/ApplicationInstance.cs +++ b/src/OneScript/Application/ApplicationInstance.cs @@ -147,10 +147,15 @@ public void UseStaticFiles() [ContextMethod("ИспользоватьМаршруты")] public void UseMvcRoutes(string handler = null) { - if (handler == null) - _startupBuilder.UseMvcWithDefaultRoute(); + _startupBuilder.UseRouting(); + if (handler == default) + { + _startupBuilder.UseEndpoints(x => x.MapDefaultControllerRoute()); + } else + { CallRoutesRegistrationHandler(handler); + } } /// @@ -221,14 +226,13 @@ private void CallRoutesRegistrationHandler(string handler) var handlerIndex = GetScriptMethod(handler); var routesCol = new RoutesCollectionContext(); - CallScriptMethod(handlerIndex, new IValue[]{routesCol}); - _startupBuilder.UseMvc(routes => + _startupBuilder.UseEndpoints(routes => { foreach (var route in routesCol) { - routes.MapRoute(route.Name, route.Template, route.Defaults?.Select(x=> + routes.MapControllerRoute(route.Name, route.Template, route.Defaults?.Select(x=> { var kv = new KeyValuePair(x.Key.AsString(),ContextValuesMarshaller.ConvertToCLRObject(x.Value)); return kv; @@ -260,7 +264,7 @@ public static ApplicationInstance Create(ICodeSource src, IApplicationRuntime we var bc = compiler.Compile(src); var app = new ApplicationInstance(new LoadedModule(bc)); var machine = MachineInstance.Current; - webApp.Environment.LoadMemory(machine); + machine.PrepareThread(webApp.Environment); webApp.Engine.InitializeSDO(app); return app; diff --git a/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs b/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs index 171f20d..1c428af 100644 --- a/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs +++ b/src/OneScript/Authorization/OneScriptAuthorizationHandlerProvider.cs @@ -31,7 +31,7 @@ private void AppendScriptedHandlers(IApplicationRuntime runtime, IFileProvider f if(!authFile.Exists || authFile.IsDirectory) return; - runtime.Environment.LoadMemory(MachineInstance.Current); + MachineInstance.Current.PrepareThread(runtime.Environment); var codeSource = new FileInfoCodeSource(authFile); runtime.DebugCurrentThread(); diff --git a/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs b/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs index ad29b31..10eee55 100644 --- a/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs +++ b/src/OneScript/BackgroundJobs/BackgroundJobsManagerContext.cs @@ -6,6 +6,7 @@ This Source Code Form is subject to the terms of the ----------------------------------------------------------*/ using System; using Hangfire; +using OneScript.WebHost.Infrastructure; using ScriptEngine; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; @@ -51,8 +52,7 @@ public void WaitForCompletion() // должен быть public, т.к. hangfire не умеет вызывать private public static void PerformAction(string module, string method) { - var machine = MachineInstance.Current; - _globalEnv.LoadMemory(machine); + MachineInstance.Current.PrepareThread(_globalEnv); var scriptObject = (IRuntimeContextInstance)_globalEnv.GetGlobalProperty(module); var methodId = scriptObject.FindMethod(method); diff --git a/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs b/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs index 494654f..40d3cfc 100644 --- a/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs +++ b/src/OneScript/BackgroundJobs/ScheduledJobsManagerContext.cs @@ -98,7 +98,7 @@ public void RunContinuationsTask(string TaskIDFrom, string module, string method public static void PerformAction(string module, string method) { - _globalEnv.LoadMemory(MachineInstance.Current); + MachineInstance.Current.PrepareThread(_globalEnv); ApplicationDbContext dbContext = null; try diff --git a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs index 078d34c..1cfc209 100644 --- a/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs +++ b/src/OneScript/Infrastructure/Implementations/OscriptApplicationModelProvider.cs @@ -99,7 +99,7 @@ public void OnProvidersExecuting(ApplicationModelProviderContext context) private void FillContext(IEnumerable sources, ApplicationModelProviderContext context) { var reflector = new TypeReflectionEngine(); - _fw.Environment.LoadMemory(MachineInstance.Current); + MachineInstance.Current.PrepareThread(_fw.Environment); foreach (var virtualPath in sources) { LoadedModule module; diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs b/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs index 1558d4d..4ffe6b1 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedControllerActivator.cs @@ -39,8 +39,8 @@ public object Create(ControllerContext context) var module = info.Module; var instance = new ScriptedController(context, module); var machine = MachineInstance.Current; - engine.Environment.LoadMemory(machine); - + machine.PrepareThread(engine.Environment); + _runtime.DebugCurrentThread(); engine.InitializeSDO(instance); return instance; diff --git a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs index 4fb3cbf..3589c74 100644 --- a/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs +++ b/src/OneScript/Infrastructure/Implementations/ScriptedMiddlewareActivator.cs @@ -37,7 +37,7 @@ public async Task InvokeAsync(HttpContext context) var engine = _runtime.Engine; var instance = new ScriptedMiddleware(_next, _module); var machine = MachineInstance.Current; - engine.Environment.LoadMemory(machine); + machine.PrepareThread(engine.Environment); try { _runtime.DebugCurrentThread(); diff --git a/src/OneScript/Infrastructure/RuntimeExtensions.cs b/src/OneScript/Infrastructure/RuntimeExtensions.cs new file mode 100644 index 0000000..b1656ed --- /dev/null +++ b/src/OneScript/Infrastructure/RuntimeExtensions.cs @@ -0,0 +1,21 @@ +/*---------------------------------------------------------- +This Source Code Form is subject to the terms of the +Mozilla Public License, v.2.0. If a copy of the MPL +was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. +----------------------------------------------------------*/ + +using ScriptEngine; +using ScriptEngine.Machine; + +namespace OneScript.WebHost.Infrastructure +{ + public static class RuntimeExtensions + { + public static void PrepareThread(this MachineInstance machine, RuntimeEnvironment env) + { + if (!machine.IsRunning) + env.LoadMemory(machine); + } + } +} \ No newline at end of file diff --git a/src/OneScript/OneScriptWeb.csproj b/src/OneScript/OneScriptWeb.csproj index b821216..2b71f66 100644 --- a/src/OneScript/OneScriptWeb.csproj +++ b/src/OneScript/OneScriptWeb.csproj @@ -29,6 +29,8 @@ AnyCPU bin\Release\$(TargetFramework)\OneScript.WebHost.xml + false + 2 @@ -48,6 +50,8 @@ + + @@ -55,7 +59,7 @@ - + diff --git a/src/OneScript/Startup.cs b/src/OneScript/Startup.cs index 16d7c41..a5787ac 100644 --- a/src/OneScript/Startup.cs +++ b/src/OneScript/Startup.cs @@ -71,9 +71,9 @@ public void ConfigureServices(IServiceCollection services) //TODO подумать как вывести данную конструкцию в конфигурацю доступную для разработчика 1С services.AddAntiforgery(options => options.Cookie.Name = "OScriptWeb.Antiforgery"); - services.AddMvc() + services.AddControllersWithViews(mvcopts => mvcopts.EnableEndpointRouting = false) + .AddRazorRuntimeCompilation() .ConfigureApplicationPartManager(pm=>pm.FeatureProviders.Add(new ScriptedViewComponentFeatureProvider())); - services.AddOneScript(); services.AddOneScriptDebug(Configuration); } @@ -106,8 +106,10 @@ private static void StartOneScriptApp(IApplicationBuilder app, IServiceProvider try { var oscriptApp = services.GetService(); + + MachineInstance.Current.PrepareThread(appRuntime.Environment); + appRuntime.Engine.DebugController = services.GetService(); - if (appRuntime.DebugEnabled()) { var logger = services.GetService>(); From 9bcec6837e6b2557c5d9ece6697dadfaa5206032 Mon Sep 17 00:00:00 2001 From: Andrey Ovsiankin Date: Tue, 8 Dec 2020 13:47:41 +0300 Subject: [PATCH 17/18] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=B4=D0=B2=D0=B8=D0=B6=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 2 +- src/Include/OneScript | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 23b9a2c..1b01eb0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { agent none environment { - ReleaseNumber = '0.7.0' + ReleaseNumber = '0.8.0' } stages { diff --git a/src/Include/OneScript b/src/Include/OneScript index 44d84f2..9673f28 160000 --- a/src/Include/OneScript +++ b/src/Include/OneScript @@ -1 +1 @@ -Subproject commit 44d84f29680fa691d016520c98d183c726181515 +Subproject commit 9673f2811b4fe51479034fcf65ba323f2030b7ce From cf482f6653232d8cf2c214df79fc5201d58197b7 Mon Sep 17 00:00:00 2001 From: Andrey Ovsiankin Date: Tue, 8 Dec 2020 14:47:16 +0300 Subject: [PATCH 18/18] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20je?= =?UTF-8?q?nkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b01eb0..7fcaa41 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,8 @@ pipeline { submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/EvilBeaver/OneScript.Web.git']]]) - sh "dotnet build src/OneScript/OneScriptWeb.csproj -r \"linux-x64;win-x64\" /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" + sh "dotnet build src/OneScript/OneScriptWeb.csproj -r linux-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" + sh "dotnet build src/OneScript/OneScriptWeb.csproj -r win-x64 /p:ReleaseNumber=${ReleaseNumber} -c Release -f netcoreapp3.1" sh ''' rm -rf testResults dotnet test src/OneScriptWeb.Tests/OneScriptWeb.Tests.csproj \