From 3dbaae43041bc18631baea3f7a1f1022554b2722 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 6 Sep 2018 15:32:48 -0700 Subject: [PATCH 1/3] refactor package for AzF use --- azure-functions-powershell-worker.sln | 4 ++-- src/AssemblyInfo.cs | 2 +- ...crosoft.Azure.Functions.PowerShellWorker.Package.props} | 2 +- ...j => Microsoft.Azure.Functions.PowerShellWorker.csproj} | 7 ++++++- ...Microsoft.Azure.Functions.PowerShellWorker.Module.psd1} | 2 +- ...Microsoft.Azure.Functions.PowerShellWorker.Module.psm1} | 0 src/PowerShell/PowerShellManager.cs | 4 ++-- src/worker.config.json | 2 +- test/Function/FunctionLoaderTests.cs | 2 +- ...Microsoft.Azure.Functions.PowerShellWorker.Test.csproj} | 2 +- test/Requests/HandleWorkerInitRequestTests.cs | 2 +- test/Utility/TypeExtensionsTests.cs | 2 +- 12 files changed, 18 insertions(+), 13 deletions(-) rename src/{Azure.Functions.PowerShell.Worker.Package.props => Microsoft.Azure.Functions.PowerShellWorker.Package.props} (94%) rename src/{Azure.Functions.PowerShell.Worker.csproj => Microsoft.Azure.Functions.PowerShellWorker.csproj} (85%) rename src/Modules/{Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psd1 => Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psd1} (97%) rename src/Modules/{Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psm1 => Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psm1} (100%) rename test/{Azure.Functions.PowerShell.Worker.Test.csproj => Microsoft.Azure.Functions.PowerShellWorker.Test.csproj} (86%) diff --git a/azure-functions-powershell-worker.sln b/azure-functions-powershell-worker.sln index 06985175..d0b16df1 100644 --- a/azure-functions-powershell-worker.sln +++ b/azure-functions-powershell-worker.sln @@ -5,11 +5,11 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8C758288-3909-4CE1-972D-1BE966628D6C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker", "src\Azure.Functions.PowerShell.Worker.csproj", "{939262BA-4823-405E-81CD-436C0B77D524}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Azure.Functions.PowerShellWorker", "src\Microsoft.Azure.Functions.PowerShellWorker.csproj", "{939262BA-4823-405E-81CD-436C0B77D524}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{12092936-4F2A-4B40-9AF2-56C840D44FEA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker.Test", "test\Azure.Functions.PowerShell.Worker.Test.csproj", "{535C8DA3-479D-42BF-B1AF-5B03ECAF67A4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Azure.Functions.PowerShellWorker.Test", "test\Microsoft.Azure.Functions.PowerShellWorker.Test.csproj", "{535C8DA3-479D-42BF-B1AF-5B03ECAF67A4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs index 8b0dcdf5..e809df04 100644 --- a/src/AssemblyInfo.cs +++ b/src/AssemblyInfo.cs @@ -5,5 +5,5 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("Azure.Functions.PowerShell.Worker.Test")] +[assembly:InternalsVisibleTo("Microsoft.Azure.Functions.PowerShellWorker.Test")] diff --git a/src/Azure.Functions.PowerShell.Worker.Package.props b/src/Microsoft.Azure.Functions.PowerShellWorker.Package.props similarity index 94% rename from src/Azure.Functions.PowerShell.Worker.Package.props rename to src/Microsoft.Azure.Functions.PowerShellWorker.Package.props index 14bd9668..8e2e6741 100644 --- a/src/Azure.Functions.PowerShell.Worker.Package.props +++ b/src/Microsoft.Azure.Functions.PowerShellWorker.Package.props @@ -5,7 +5,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li 0.1.0 - Azure.Functions.PowerShell.Worker + Microsoft.Azure.Functions.PowerShellWorker Microsoft Microsoft Microsoft Corporation diff --git a/src/Azure.Functions.PowerShell.Worker.csproj b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj similarity index 85% rename from src/Azure.Functions.PowerShell.Worker.csproj rename to src/Microsoft.Azure.Functions.PowerShellWorker.csproj index 922e7d58..83293346 100644 --- a/src/Azure.Functions.PowerShell.Worker.csproj +++ b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj @@ -3,11 +3,12 @@ Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information. --> - + Exe netcoreapp2.1 Azure Function PowerShell Language Worker + Latest true false @@ -26,6 +27,10 @@ Licensed under the MIT license. See LICENSE file in the project root for full li + + + contentFiles\any\any\workers\powershell + PreserveNewest diff --git a/src/Modules/Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psd1 b/src/Modules/Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psd1 similarity index 97% rename from src/Modules/Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psd1 rename to src/Modules/Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psd1 index 150be33a..68dff7f2 100644 --- a/src/Modules/Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psd1 +++ b/src/Modules/Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psd1 @@ -1,7 +1,7 @@ @{ # Script module or binary module file associated with this manifest. -RootModule = 'Azure.Functions.PowerShell.Worker.Module.psm1' +RootModule = 'Microsoft.Azure.Functions.PowerShellWorker.Module.psm1' # Version number of this module. ModuleVersion = '0.1.0' diff --git a/src/Modules/Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psm1 b/src/Modules/Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psm1 similarity index 100% rename from src/Modules/Azure.Functions.PowerShell.Worker.Module/Azure.Functions.PowerShell.Worker.Module.psm1 rename to src/Modules/Microsoft.Azure.Functions.PowerShellWorker.Module/Microsoft.Azure.Functions.PowerShellWorker.Module.psm1 diff --git a/src/PowerShell/PowerShellManager.cs b/src/PowerShell/PowerShellManager.cs index a2860839..eae8784a 100644 --- a/src/PowerShell/PowerShellManager.cs +++ b/src/PowerShell/PowerShellManager.cs @@ -56,7 +56,7 @@ internal void InitializeRunspace() _pwsh.AddScript($"using namespace {typeof(HttpResponseContext).Namespace}").InvokeAndClearCommands(); // Set the PSModulePath - Environment.SetEnvironmentVariable("PSModulePath", Path.Join(AppDomain.CurrentDomain.BaseDirectory, "Modules")); + Environment.SetEnvironmentVariable("PSModulePath", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "workers", "powershell", "Modules")); } internal Hashtable InvokeFunction( @@ -121,7 +121,7 @@ internal Hashtable InvokeFunction( returnObject = pipelineItems[pipelineItems.Count - 1]; } - var result = _pwsh.AddCommand("Azure.Functions.PowerShell.Worker.Module\\Get-OutputBinding") + var result = _pwsh.AddCommand("Microsoft.Azure.Functions.PowerShellWorker.Module\\Get-OutputBinding") .AddParameter("Purge") .InvokeAndClearCommands()[0]; diff --git a/src/worker.config.json b/src/worker.config.json index d5395f85..2f6221df 100644 --- a/src/worker.config.json +++ b/src/worker.config.json @@ -3,6 +3,6 @@ "language":"powershell", "extensions":[".ps1"], "defaultExecutablePath":"dotnet", - "defaultWorkerPath":"Azure.Functions.PowerShell.Worker.dll" + "defaultWorkerPath":"../../Microsoft.Azure.Functions.PowerShellWorker.dll" } } diff --git a/test/Function/FunctionLoaderTests.cs b/test/Function/FunctionLoaderTests.cs index da6625c4..be35f43d 100644 --- a/test/Function/FunctionLoaderTests.cs +++ b/test/Function/FunctionLoaderTests.cs @@ -8,7 +8,7 @@ using Microsoft.Azure.WebJobs.Script.Grpc.Messages; using Xunit; -namespace Azure.Functions.PowerShell.Worker.Test +namespace Microsoft.Azure.Functions.PowerShellWorker.Test { public class FunctionLoaderTests { diff --git a/test/Azure.Functions.PowerShell.Worker.Test.csproj b/test/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj similarity index 86% rename from test/Azure.Functions.PowerShell.Worker.Test.csproj rename to test/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj index 2167776e..cc86a445 100644 --- a/test/Azure.Functions.PowerShell.Worker.Test.csproj +++ b/test/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj @@ -15,7 +15,7 @@ - + diff --git a/test/Requests/HandleWorkerInitRequestTests.cs b/test/Requests/HandleWorkerInitRequestTests.cs index 36fd8873..c9adef27 100644 --- a/test/Requests/HandleWorkerInitRequestTests.cs +++ b/test/Requests/HandleWorkerInitRequestTests.cs @@ -8,7 +8,7 @@ using Microsoft.Azure.WebJobs.Script.Grpc.Messages; using Xunit; -namespace Azure.Functions.PowerShell.Worker.Test +namespace Microsoft.Azure.Functions.PowerShellWorker.Test { public class ProcessWorkerInitRequestTests { diff --git a/test/Utility/TypeExtensionsTests.cs b/test/Utility/TypeExtensionsTests.cs index 73ff1c8b..a2237880 100644 --- a/test/Utility/TypeExtensionsTests.cs +++ b/test/Utility/TypeExtensionsTests.cs @@ -14,7 +14,7 @@ using Newtonsoft.Json; using Xunit; -namespace Azure.Functions.PowerShell.Worker.Test +namespace Microsoft.Azure.Functions.PowerShellWorker.Test { public class TypeExtensionsTests { From d6acdeace3f7b442f45c3a1d8c47eca1445b469e Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Fri, 7 Sep 2018 10:10:59 -0700 Subject: [PATCH 2/3] use nuspec --- ....Functions.PowerShellWorker.Package.csproj | 15 ++++++++++ ...ft.Azure.Functions.PowerShellWorker.nuspec | 30 +++++++++++++++++++ ...e.Functions.PowerShellWorker.Package.props | 25 ---------------- ...ft.Azure.Functions.PowerShellWorker.csproj | 9 +----- src/PowerShell/PowerShellManager.cs | 2 +- src/worker.config.json | 2 +- 6 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj create mode 100644 package/Microsoft.Azure.Functions.PowerShellWorker.nuspec delete mode 100644 src/Microsoft.Azure.Functions.PowerShellWorker.Package.props diff --git a/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj new file mode 100644 index 00000000..18dda866 --- /dev/null +++ b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp2.1 + Microsoft.Azure.Functions.PowerShellWorker.nuspec + configuration=$(Configuration);targetFramework=$(TargetFramework) + true + false + true + NU5100 + + \ No newline at end of file diff --git a/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec b/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec new file mode 100644 index 00000000..a79fd695 --- /dev/null +++ b/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec @@ -0,0 +1,30 @@ + + + + + Microsoft.Azure.Functions.PowerShellWorker + 0.1.0 + Azure Function PowerShell Language Worker + Microsoft + Microsoft + false + https://github.com/Azure/azure-functions-powershell-worker/blob/dev/LICENSE + https://github.com/Azure/azure-functions-powershell-worker + https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_64.png + The Azure Function PowerShell Language Worker allows users to write Azure Function Apps using PowerShell. It leverages the PowerShell Core SDK. + # 0.1.0 + + Initial Release + © Microsoft Corporation. All rights reserved. + azure,functions,powershell,worker + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.Azure.Functions.PowerShellWorker.Package.props b/src/Microsoft.Azure.Functions.PowerShellWorker.Package.props deleted file mode 100644 index 8e2e6741..00000000 --- a/src/Microsoft.Azure.Functions.PowerShellWorker.Package.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - 0.1.0 - Microsoft.Azure.Functions.PowerShellWorker - Microsoft - Microsoft - Microsoft Corporation - The Azure Function PowerShell Language Worker allows users to write Azure Function Apps using PowerShell. It leverages the PowerShell Core SDK. - Azure Function PowerShell Language Worker - © Microsoft Corporation. All rights reserved. - https://github.com/Azure/azure-functions-powershell-worker/blob/dev/LICENSE - https://github.com/Azure/azure-functions-powershell-worker - https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_64.png - azure,functions,powershell,worker - - # 0.1.0 - - Initial Release - - - diff --git a/src/Microsoft.Azure.Functions.PowerShellWorker.csproj b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj index 83293346..851623f8 100644 --- a/src/Microsoft.Azure.Functions.PowerShellWorker.csproj +++ b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj @@ -3,18 +3,16 @@ Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information. --> - Exe netcoreapp2.1 Azure Function PowerShell Language Worker + Microsoft.Azure.Functions.PowerShellWorker Latest true false true - true - true true en-US @@ -27,10 +25,6 @@ Licensed under the MIT license. See LICENSE file in the project root for full li - - - contentFiles\any\any\workers\powershell - PreserveNewest @@ -40,5 +34,4 @@ Licensed under the MIT license. See LICENSE file in the project root for full li PreserveNewest - diff --git a/src/PowerShell/PowerShellManager.cs b/src/PowerShell/PowerShellManager.cs index eae8784a..2924d9ee 100644 --- a/src/PowerShell/PowerShellManager.cs +++ b/src/PowerShell/PowerShellManager.cs @@ -56,7 +56,7 @@ internal void InitializeRunspace() _pwsh.AddScript($"using namespace {typeof(HttpResponseContext).Namespace}").InvokeAndClearCommands(); // Set the PSModulePath - Environment.SetEnvironmentVariable("PSModulePath", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "workers", "powershell", "Modules")); + Environment.SetEnvironmentVariable("PSModulePath", Path.Join(AppDomain.CurrentDomain.BaseDirectory, "Modules")); } internal Hashtable InvokeFunction( diff --git a/src/worker.config.json b/src/worker.config.json index 2f6221df..74e56413 100644 --- a/src/worker.config.json +++ b/src/worker.config.json @@ -3,6 +3,6 @@ "language":"powershell", "extensions":[".ps1"], "defaultExecutablePath":"dotnet", - "defaultWorkerPath":"../../Microsoft.Azure.Functions.PowerShellWorker.dll" + "defaultWorkerPath":"Microsoft.Azure.Functions.PowerShellWorker.dll" } } From 67ac33aca8e724702ed0d2dfdbf1a80f34267c09 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Fri, 7 Sep 2018 10:17:20 -0700 Subject: [PATCH 3/3] newline at end --- .../Microsoft.Azure.Functions.PowerShellWorker.Package.csproj | 2 +- package/Microsoft.Azure.Functions.PowerShellWorker.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj index 18dda866..ee219ccf 100644 --- a/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj +++ b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj @@ -12,4 +12,4 @@ Licensed under the MIT license. See LICENSE file in the project root for full li true NU5100 - \ No newline at end of file + diff --git a/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec b/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec index a79fd695..2f5dc3ea 100644 --- a/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec +++ b/package/Microsoft.Azure.Functions.PowerShellWorker.nuspec @@ -27,4 +27,4 @@ Licensed under the MIT license. See LICENSE file in the project root for full li - \ No newline at end of file +