diff --git a/.gitignore b/.gitignore index e3bf90979e17..1e9a37ba50d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Azure PowerShell specific src/Publish/ src/Package/ +drop/ obj TestResults diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/AvailabilitySetBaseCmdlet.cs b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/AvailabilitySetBaseCmdlet.cs new file mode 100644 index 000000000000..f2758d3f2ccc --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/AvailabilitySetBaseCmdlet.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Management.Compute; + +namespace Microsoft.Azure.Commands.Compute +{ + public abstract class AvailabilitySetBaseCmdlet : ComputeClientBaseCmdlet + { + public IAvailabilitySetsOperations AvailabilitySetClient + { + get + { + return ComputeClient.ComputeManagementClient.AvailabilitySets; + } + } + } +} diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/GetAzureAvailabilitySetCommand.cs b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/GetAzureAvailabilitySetCommand.cs new file mode 100644 index 000000000000..25f82da23889 --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/GetAzureAvailabilitySetCommand.cs @@ -0,0 +1,72 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using AutoMapper; +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Management.Compute; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.Azure.Commands.Compute +{ + [Cmdlet(VerbsCommon.Get, ProfileNouns.AvailabilitySet)] + [OutputType(typeof(PSAvailabilitySet))] + public class GetAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName", "AvailabilitySetName")] + [Parameter( + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The availability set name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + if (string.IsNullOrEmpty(this.Name)) + { + var result = this.AvailabilitySetClient.List(this.ResourceGroupName); + + List psResultList = new List(); + foreach (var item in result) + { + var psItem = Mapper.Map(item); + psResultList.Add(psItem); + } + + WriteObject(psResultList, true); + } + else + { + var result = this.AvailabilitySetClient.Get(this.ResourceGroupName, this.Name); + var psResult = Mapper.Map(result); + WriteObject(psResult); + } + }); + } + } +} diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs new file mode 100644 index 000000000000..584d436f6a1f --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs @@ -0,0 +1,88 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using AutoMapper; +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using System.Management.Automation; + +namespace Microsoft.Azure.Commands.Compute +{ + [Cmdlet(VerbsCommon.New, ProfileNouns.AvailabilitySet)] + [OutputType(typeof(PSAvailabilitySet))] + public class NewAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName", "AvailabilitySetName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter( + Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The location.")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + + [Parameter( + Position = 3, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The Platform Update Domain Count.")] + [ValidateNotNullOrEmpty] + public int? PlatformUpdateDomainCount { get; set; } + + [Parameter( + Position = 4, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The Platform Fault Domain Count.")] + [ValidateNotNullOrEmpty] + public int? PlatformFaultDomainCount { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + var avSetParams = new AvailabilitySet + { + //Name = this.Name, + Location = this.Location, + PlatformUpdateDomainCount = this.PlatformUpdateDomainCount, + PlatformFaultDomainCount = this.PlatformFaultDomainCount + }; + + var result = this.AvailabilitySetClient.CreateOrUpdate(this.ResourceGroupName, this.Name, avSetParams); + + var psResult = Mapper.Map(result); + WriteObject(psResult); + }); + } + } +} diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs new file mode 100644 index 000000000000..392415d25592 --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Management.Compute; +using System.Management.Automation; + +namespace Microsoft.Azure.Commands.Compute +{ + [Cmdlet(VerbsCommon.Remove, ProfileNouns.AvailabilitySet)] + [OutputType(typeof(PSOperation))] + public class RemoveAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName", "AvailabilitySetName")] + [Parameter( + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The availability set name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter( + Position = 2, + HelpMessage = "To force the removal.")] + [ValidateNotNullOrEmpty] + public SwitchParameter Force { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + if (this.Force.IsPresent || this.ShouldContinue("Continue?", "Confirmation")) + { + this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name); + } + }); + } + } +} diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeAutoMapperProfile.cs b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeAutoMapperProfile.cs new file mode 100644 index 000000000000..47f5364fd595 --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeAutoMapperProfile.cs @@ -0,0 +1,87 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using AutoMapper; +using System; +using System.Collections; +using System.Collections.Generic; +using FROM = Microsoft.Azure.Management.Compute.Models; +using TO = Microsoft.Azure.Commands.Compute.Models; + +namespace Microsoft.Azure.Commands.Compute +{ + public static class ComputeMapperExtension + { + public static IMappingExpression ForItems( + this IMappingExpression mapper) + where TSource : IEnumerable + where TDestination : ICollection + { + mapper.AfterMap((c, s) => + { + if (c != null && s != null) + { + foreach (var t in c) + { + s.Add(Mapper.Map(t)); + } + } + }); + + return mapper; + } + } + + public class ComputeAutoMapperProfile : AutoMapper.Profile + { + private static readonly Lazy initialize; + + public ComputeAutoMapperProfile() : base("ComputeAutoMapperProfile") + { + } + + static ComputeAutoMapperProfile() + { + initialize = new Lazy(() => + { + Mapper.AddProfile(); + return true; + }); + } + + public static bool Initialize() + { + return initialize.Value; + } + + protected override void Configure() + { + //Mapper.CreateMap(); + //Mapper.CreateMap(); + //Mapper.CreateMap(); + + Mapper.CreateMap(); + //Mapper.CreateMap(); + + //Mapper.CreateMap(); + //Mapper.CreateMap(); + + Mapper.CreateMap(); + //Mapper.CreateMap(); + + //Mapper.CreateMap(); + //Mapper.CreateMap(); + } + } +} \ No newline at end of file diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClient.cs b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClient.cs index 1141c33d3e22..c3ce1e9e2891 100644 --- a/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClient.cs +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClient.cs @@ -28,7 +28,7 @@ public class ComputeClient public Action ErrorLogger { get; set; } public ComputeClient(IClientFactory clientFactory, AzureContext context) - : this(clientFactory.CreateClient(context, AzureEnvironment.Endpoint.ResourceManager)) + : this(clientFactory.CreateArmClient(context, AzureEnvironment.Endpoint.ResourceManager)) { } diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClientBaseCmdlet.cs b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClientBaseCmdlet.cs index d70896336fd3..6d2e6439cdcf 100644 --- a/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClientBaseCmdlet.cs +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Common/ComputeClientBaseCmdlet.cs @@ -51,6 +51,7 @@ public ComputeClient ComputeClient protected override void ProcessRecord() { base.ProcessRecord(); + ComputeAutoMapperProfile.Initialize(); } protected void ExecuteClientAction(Action action) diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Content/azure.lx b/src/CLU/Microsoft.Azure.Commands.Compute/Content/azure.lx index 23cd5d1b78d2..8ab6450921c3 100644 --- a/src/CLU/Microsoft.Azure.Commands.Compute/Content/azure.lx +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Content/azure.lx @@ -1,4 +1,4 @@ -RtPackage: Microsoft.CLU +RtPackage: Microsoft.CLU.Commands RtEntry: Microsoft.CLU.CommandModel.CmdletCommandModel.Run RtAssembly: Microsoft.CLU.dll Modules: Microsoft.Azure.Commands.Compute diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Microsoft.Azure.Commands.Compute.xproj b/src/CLU/Microsoft.Azure.Commands.Compute/Microsoft.Azure.Commands.Compute.xproj index d53ec44ba862..55ef1c9cbefa 100644 --- a/src/CLU/Microsoft.Azure.Commands.Compute/Microsoft.Azure.Commands.Compute.xproj +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Microsoft.Azure.Commands.Compute.xproj @@ -1,7 +1,7 @@  - + - 14.0.24711 + 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) @@ -14,8 +14,5 @@ 2.0 - - True - \ No newline at end of file diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/Models/PSAvailabilitySet.cs b/src/CLU/Microsoft.Azure.Commands.Compute/Models/PSAvailabilitySet.cs new file mode 100644 index 000000000000..d2a5b5ad84ed --- /dev/null +++ b/src/CLU/Microsoft.Azure.Commands.Compute/Models/PSAvailabilitySet.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using Microsoft.Azure.Management.Compute.Models; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace Microsoft.Azure.Commands.Compute.Models +{ + public class PSAvailabilitySet : PSOperation + { + // Gets or sets the property of 'ResourceGroupName' + public string ResourceGroupName + { + get + { + Regex r = new Regex(@"(.*?)/resourcegroups/(?\S+)/providers/(.*?)", RegexOptions.IgnoreCase); + Match m = r.Match(Id); + return m.Success ? m.Groups["rgname"].Value : null; + } + } + + // Gets or sets the property of 'Id' + public string Id { get; set; } + + // Gets or sets the property of 'Name' + public string Name { get; set; } + + // Gets or sets the property of 'Type' + public string Type { get; set; } + + // Gets or sets the property of 'Location' + public string Location { get; set; } + + // Gets or sets the property of 'Tags' + public IDictionary Tags { get; set; } + + [JsonIgnore] + public string TagsText + { + get { return JsonConvert.SerializeObject(Tags, Formatting.Indented); } + } + + // Gets or sets Fault Domain count. + public int? PlatformFaultDomainCount { get; set; } + + // Gets or sets Update Domain count. + public int? PlatformUpdateDomainCount { get; set; } + + // Gets or sets the resource status information. + public IList Statuses { get; set; } + + [JsonIgnore] + public string StatusesText + { + get { return JsonConvert.SerializeObject(Statuses, Formatting.Indented); } + } + + // Gets or sets a list containing reference to all Virtual Machines created under this Availability Set. + public IList VirtualMachinesReferences { get; set; } + + [JsonIgnore] + public string VirtualMachinesReferencesText + { + get { return JsonConvert.SerializeObject(VirtualMachinesReferences, Formatting.Indented); } + } + } +} diff --git a/src/CLU/Microsoft.Azure.Commands.Compute/project.json b/src/CLU/Microsoft.Azure.Commands.Compute/project.json index 0a17ea784dea..e77a629b0d32 100644 --- a/src/CLU/Microsoft.Azure.Commands.Compute/project.json +++ b/src/CLU/Microsoft.Azure.Commands.Compute/project.json @@ -17,24 +17,18 @@ "dependencies": { "System.Linq": "4.0.1-beta-23516", "Microsoft.CLU": "1.0.0", - "Commands.Common.Authentication": "", "Commands.Common": "", + "Commands.Common.Authentication": "", + "Commands.Common.Storage": "", "Commands.ResourceManager.Common": "", - "Commands.ResourceManager.Cmdlets": "", - "Microsoft.Azure.Graph.RBAC": "2.0.0-preview", - "Microsoft.Azure.Management.Authorization": "2.0.1-preview", - "Microsoft.Azure.Management.Resources": "3.1.1-preview", "Microsoft.Azure.Management.Compute": "11.0.0-prerelease", "Microsoft.Azure.Management.Network": "3.0.3-preview", - "Microsoft.Azure.Management.Storage": "4.0.0-preview", + "AutoMapper": "4.1.1", "Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.210231457-alpha", - "Microsoft.Rest.ClientRuntime": "1.4.1", - "Microsoft.Rest.ClientRuntime.Azure": "2.1.0", - "Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.0.0-preview", + "Microsoft.Rest.ClientRuntime": "1.5.0", "Newtonsoft.Json": "7.0.1", "System.Collections": "4.0.11-beta-23516", "System.Collections.Concurrent": "4.0.11-beta-23516", - "System.Diagnostics.Tools": "4.0.1-beta-23516", "System.Diagnostics.TraceSource": "4.0.0-beta-23516", "System.Diagnostics.Tracing": "4.0.21-beta-23516", "System.IO": "4.0.11-beta-23516", @@ -48,7 +42,6 @@ "System.Runtime": "4.0.21-beta-23516", "System.Runtime.Extensions": "4.0.11-beta-23516", "System.Runtime.Serialization.Json": "4.0.1-beta-23516", - "System.Runtime.Serialization.Primitives": "4.1.0-beta-23516", "System.Runtime.Serialization.Xml": "4.1.0-beta-23516", "System.Security.Cryptography.Algorithms": "4.0.0-beta-23516", "System.Security.Cryptography.X509Certificates": "4.0.0-beta-23516", @@ -57,8 +50,8 @@ "System.Threading": "4.0.11-beta-23516", "System.Threading.Tasks": "4.0.11-beta-23516", "System.Threading.Thread": "4.0.0-beta-23516", - "System.Xml.ReaderWriter": "4.0.11-beta-23516", - "System.Text.RegularExpressions": "4.0.11-beta-23516" + "WindowsAzure.Storage": "6.1.1-preview", + "Microsoft.Azure.Management.Storage": "4.0.0-preview" }, - "compilationOptions": { "emitEntryPoint": true } + "compilationOptions": {"emitEntryPoint": true} } diff --git a/src/CLU/NuGet.Config b/src/CLU/NuGet.Config new file mode 100644 index 000000000000..ef41e0c4f9e3 --- /dev/null +++ b/src/CLU/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/CLU/BuildDrop.ps1 b/tools/CLU/BuildDrop.ps1 new file mode 100644 index 000000000000..8f65f23ba59c --- /dev/null +++ b/tools/CLU/BuildDrop.ps1 @@ -0,0 +1,67 @@ +param([string]$dropLocation, [string]$packageVersion="0.0.1", [switch] $excludeCommandPackages, [switch] $excludeCluRun) + +$thisScriptDirectory = Split-Path $MyInvocation.MyCommand.Path -Parent + +$workspaceDirectory = $env:WORKSPACE +if (!($workspaceDirectory)) +{ + $workspaceDirectory = (Resolve-Path "$thisScriptDirectory\..\..").Path + $env:WORKSPACE = $workspaceDirectory +} + +$buildProfileScriptPath = "`"$thisScriptDirectory\BuildProfile.ps1`"" # Guard against spaces in the path +$sourcesRoot = "$workspaceDirectory\src\clu" + +if (!($dropLocation)) +{ + $dropLocation = "$workspaceDirectory\drop" +} + +if (!(Test-Path -Path $dropLocation -PathType Container)) +{ + mkdir "$dropLocation" + mkdir "$dropLocation\CommandRepo" + mkdir "$dropLocation\clurun" +} + + + +if (!($excludeCommandPackages.IsPresent)) +{ + # Grap all command packages to build. + # We'll assume that all directories that contain a *.nuspec.template file is a command package and that the name of the package is everything leading up to .nuspec.template + $commandPackages = Get-ChildItem -path $sourcesRoot -Filter '*.nuspec.template' -Recurse -File | ForEach-Object { New-Object PSObject -Property @{Directory=$_.DirectoryName; Package=$_.Name.Substring(0, $_.Name.Length - ".nuspec.template".Length)} } + + foreach($commandPackage in $commandPackages) + { + $commandPackageName = $commandPackage.Package + $commandPackageDir = $commandPackage.Directory + $buildOutputDirectory = Join-Path -path $commandPackageDir -ChildPath "bin\Debug\publish" + + + Invoke-Expression "& $buildProfileScriptPath $commandPackageDir $commandPackageName $buildOutputDirectory $packageVersion $dropLocation\CommandRepo" + } +} + +if (!($excludeCluRun)) +{ + foreach ($runtime in @("win7-x64", "osx.10.10-x64", "ubuntu.14.04-x64")) + { + $cluRunOutput = "$dropLocation\clurun\$runtime" + dotnet publish "$sourcesRoot\clurun" --framework dnxcore50 --runtime $runtime --output $cluRunOutput + + if (!($runtime.StartsWith("win"))) + { + # Fix current x-plat dotnet publish by correctly renaming ConsoleHost to clurun + Move-Item -Path "$cluRunOutput\coreconsole" -Destination "$cluRunOutput\clurun" -Force + + # Remove all extra exes that end up in the output directory... + Get-ChildItem -Path "$cluRunOutput" -Filter "*.exe" | Remove-Item + } + else + { + # Remove all extra exes that end up in the output directory... + Get-Childitem -path "$cluRunOutput" -Filter *.exe | Where-Object -Property "Name" -Value "clurun.exe" -NotMatch | Remove-Item + } + } +} \ No newline at end of file diff --git a/tools/CLU/BuildProfile.ps1 b/tools/CLU/BuildProfile.ps1 index 6ec76f460620..7f986445d242 100644 --- a/tools/CLU/BuildProfile.ps1 +++ b/tools/CLU/BuildProfile.ps1 @@ -17,7 +17,9 @@ if ([string]::IsNullOrWhiteSpace($env:WORKSPACE) -or !(Test-Path $env:WORKSPACE) $packageSource = $packageSource.TrimEnd('\\') Write-Host "using package id: $packageId, package source: $packageSource, packageVersion: $packageVersion" dotnet publish $cmdletsDir -f dnxcore50 -r win7-x64 -o $packageSource -$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec.template")))) +Copy-Item -Path $cmdletsDir\content -Destination $packageSource\content -Recurse -Force + +$nuSpecTemplate = (Get-ChildItem ([System.IO.Path]::Combine($cmdletsDir, ($packageId + ".nuspec.template")))) $nuSpecOutput = [System.IO.Path]::Combine($packageSource, ($packageId + ".nuspec")) Write-Host "Creating dynamic nuspec package in: $nuSpecOutput"