Skip to content

Add support for preview modules #4921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@
<UsingTask TaskName="VerifyAuthenticodeSignatureTask" AssemblyFile="$(BuildTasksPath)\Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="SmartTestingTask" AssemblyFile="$(BuildTasksPath)\Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="SetEnvVar" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<ParameterGroup>
<EnvName ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
<ParameterGroup>
<EnvName ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Code Type="Fragment" Language="cs">
<![CDATA[System.Environment.SetEnvironmentVariable(EnvName, EnvValue);]]>
</Code>
</Task>
<Using Namespace="System"/>
<Code Type="Fragment" Language="cs">
<![CDATA[System.Environment.SetEnvironmentVariable(EnvName, EnvValue);]]>
</Code>
</Task>
</UsingTask> <!--
CI build related
-->
Expand Down Expand Up @@ -196,17 +196,17 @@
<MakeDir Directories="$(PackageDirectory)" />
<Exec ContinueOnError="false"
Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot; . $(LibraryToolsFolder)\CreateMappings.ps1 -RootPath $(LibrarySourceFolder) -OutputFile $(PackageDirectory)\groupMapping.json -WarningFile $(PackageDirectory)\groupMappingWarnings.json -RulesFile $(LibraryToolsFolder)\CreateMappings_rules.json &quot;" Condition="'$(Latest)' == 'true'"/>
<MSBuild
Projects="@(CmdletSolutionsToBuild)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />

<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration) &quot;"
ContinueOnError="false"
Condition=" '$(SkipHelp)' == 'false' and '$(Latest)' == 'true'"/>
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;$ProgressPreference = 'SilentlyContinue';. $(LibraryToolsFolder)\GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration) &quot;"
ContinueOnError="false"
Condition=" '$(SkipHelp)' == 'false' and '$(Latest)' == 'true'"/>
<CallTarget Targets="BuildSetupTest"/>
<!-- moved copy tasks -->

Expand Down Expand Up @@ -234,7 +234,7 @@
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)"
Condition=" '$(CodeSign)' == 'true' "/>

<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />
<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />


<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
Expand Down Expand Up @@ -535,4 +535,4 @@
<Message Importance="high" Text="Running live tests..." />
<CallTarget Targets="LiveTests"/>
</Target>
</Project>
</Project>
3,863 changes: 29 additions & 3,834 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Newtonsoft.Json;
using System;

namespace Microsoft.WindowsAzure.Commands.Common
namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
public class AzurePSDataCollectionProfile
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@
<Compile Include="AuthenticationStore.cs" />
<Compile Include="Authentication\AadAuthenticationException.cs" />
<Compile Include="AzureAccount.cs" />
<Compile Include="AzurePSDataCollectionProfile.cs" />
<Compile Include="AzureRmProfileProvider.cs" />
<Compile Include="AzureSMProfileProvider.cs" />
<Compile Include="ContextSaveMode.cs" />
<Compile Include="DataCollectionController.cs" />
<Compile Include="DiskDataStore.cs" />
<Compile Include="Extensions\AzureAccountExtensions.cs" />
<Compile Include="AzureEnvironmentConstants.cs" />
<Compile Include="Extensions\AzureContextExtensions.cs" />
Expand Down Expand Up @@ -157,6 +160,7 @@
<Compile Include="Settings\UserAgentSettings.cs" />
<Compile Include="Settings\HandlerSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\FileUtilities.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.WindowsAzure.Commands.Common.Properties;
using Newtonsoft.Json;
using System;
using System.IO;
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,7 +12,11 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Commands.Common
using Newtonsoft.Json;
using System;
using System.IO;

namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
public abstract class DataCollectionController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Microsoft.WindowsAzure.Commands.Common.Properties;

namespace Microsoft.WindowsAzure.Commands.Common
namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
/// <summary>
/// A ddata store based on the managed windows file system functions (System.IO)
Expand Down Expand Up @@ -192,7 +191,11 @@ public X509Certificate2 GetCertificate(string thumbprint)
}
else
{
Validate.ValidateStringIsNullOrEmpty(thumbprint, "certificate thumbprint");
if (string.IsNullOrEmpty(thumbprint))
{
throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, "certificate thumbprint"));
}

X509Certificate2Collection certificates;
if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) ||
TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates))
Expand All @@ -212,7 +215,11 @@ public X509Certificate2 GetCertificate(string thumbprint)
/// <param name="cert">The certificate to add</param>
public void AddCertificate(X509Certificate2 certificate)
{
Validate.ValidateNullArgument(certificate, Resources.InvalidCertificate);
if (certificate == null)
{
throw new ArgumentException(Resources.InvalidCertificate);
}

X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, (store) =>
{
store.Open(OpenFlags.ReadWrite);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@
<data name="InvalidDnsName" xml:space="preserve">
<value>"{0}" is an invalid DNS name for {1}</value>
</data>
<data name="InvalidOrEmptyArgumentMessage" xml:space="preserve">
<value>{0} is invalid or empty.</value>
</data>
<data name="NoInternetConnection" xml:space="preserve">
<value>Please connect to internet before executing this cmdlet</value>
</data>
<data name="PathDoesNotExist" xml:space="preserve">
<value>Path {0} doesn't exist.</value>
</data>
<data name="ProfileLockReadDisposed" xml:space="preserve">
<value>Attempted to read from the Azure PowerShell context after it was disposed. Please reload the module and try this operation again.</value>
</data>
Expand Down Expand Up @@ -180,4 +186,7 @@
<data name="SessionNotInitialized" xml:space="preserve">
<value>The Azure PowerShell session has not been properly initialized. Please import the module and try again.</value>
</data>
<data name="x86InProgramFiles" xml:space="preserve">
<value>(x86)</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.Common.Authentication.Models;
using Microsoft.WindowsAzure.Commands.Common.Properties;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Microsoft.WindowsAzure.Commands.Common
namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
/// <summary>
/// File utilities using the data store
Expand Down Expand Up @@ -111,7 +108,7 @@ public static string GetWithProgramFilesPath(string directoryName, bool throwIfN
programFilesPath += Resources.x86InProgramFiles;
if (throwIfNotFound)
{
Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName));
ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName));
}
return Path.Combine(programFilesPath, directoryName);
}
Expand All @@ -120,7 +117,7 @@ public static string GetWithProgramFilesPath(string directoryName, bool throwIfN
programFilesPath = programFilesPath.Replace(Resources.x86InProgramFiles, String.Empty);
if (throwIfNotFound)
{
Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName));
ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName));
}
return Path.Combine(programFilesPath, directoryName);
}
Expand Down Expand Up @@ -167,7 +164,7 @@ public static void DirectoryCopy(string sourceDirName, string destDirName, bool
/// <param name="pathName">The path to the file that will be created</param>
public static void EnsureDirectoryExists(string pathName)
{
Validate.ValidateStringIsNullOrEmpty(pathName, "Settings directory");
ValidateStringIsNullOrEmpty(pathName, "Settings directory");
string directoryPath = Path.GetDirectoryName(pathName);
if (!DataStore.DirectoryExists(directoryPath))
{
Expand Down Expand Up @@ -368,5 +365,34 @@ public static string GetModuleFolderName(AzureModule module)
{
return module.ToString().Replace("Azure", "");
}

private static void ValidateDirectoryExists(string directory, string exceptionMessage = null)
{
string msg = string.Format(Resources.PathDoesNotExist, directory);
if (!DataStore.DirectoryExists(directory))
{
if (!string.IsNullOrEmpty(exceptionMessage))
{
msg = exceptionMessage;
}

throw new FileNotFoundException(msg);
}
}

private static void ValidateStringIsNullOrEmpty(string data, string messageData, bool useDefaultMessage = true)
{
if (string.IsNullOrEmpty(data))
{
if (useDefaultMessage)
{
throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, messageData));
}
else
{
throw new ArgumentException(messageData);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest.Azure.Authentication;
using Microsoft.WindowsAzure.Commands.Common;
using System.Security;
using System.Threading.Tasks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest.Azure.Authentication;
using Microsoft.WindowsAzure.Commands.Common;
using System;
using System.Collections.Generic;
using System.Security;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.Common.Authentication.Factories;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure.Commands.Common;
using System;
using System.IO;
using System.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@
<Project>{70527617-7598-4aef-b5bd-db9186b8184b}</Project>
<Name>Commands.Common.Authentication.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\Commands.Common\Commands.Common.csproj">
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.WindowsAzure.Commands.Common;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
4 changes: 0 additions & 4 deletions src/Common/Commands.Common/Commands.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DiskDataStore.cs" />
<Compile Include="DataCollectionController.cs" />
<Compile Include="Serialization\LegacyAzureAccount.cs" />
<Compile Include="Serialization\LegacyAzureEnvironment.cs" />
<Compile Include="Serialization\LegacyAzureSubscription.cs" />
<Compile Include="Serialization\ModelConversionExtensions.cs" />
<Compile Include="Utilities\FileUtilities.cs" />
<Compile Include="Utilities\INetworkHelper.cs" />
<Compile Include="Utilities\JsonUtilities.cs" />
<Compile Include="AzureDataCmdlet.cs" />
<Compile Include="AzurePSCmdlet.cs" />
<Compile Include="AzurePSDataCollectionProfile.cs" />
<Compile Include="AzurePowerShell.cs" />
<Compile Include="Extensions\ConcurrentQueueExtensions.cs" />
<Compile Include="Constants.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/Common/Commands.Common/Extensions/CmdletExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.WindowsAzure.Commands.Common;
using System;
using System.Collections.Generic;
Expand Down
1 change: 1 addition & 0 deletions src/Common/Commands.Common/MetricHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.WindowsAzure.Commands.Common.Utilities;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Newtonsoft.Json;
Expand Down
Loading