Skip to content

Commit

Permalink
Made the module output folder be 'artifacts' at the repo root. Update…
Browse files Browse the repository at this point in the history
…d all references to src/Package/<CONFIG>/ResourceManager/AzureResourceManager/ that I could find. Removed legacy/unused files or logic that used this old output pathing.
  • Loading branch information
MiYanni committed Dec 17, 2018
1 parent 68966fa commit 7b17d0d
Show file tree
Hide file tree
Showing 139 changed files with 296 additions and 1,844 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
**/*

# Include the build.
!src/Package/Release/ResourceManager/**/*
!src/Package/Debug/ResourceManager/**/*
!artifacts/Release/**/*
!artifacts/Debug/**/*
!tools/InstallationTests/NetcoreTests/**/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Azure PowerShell specific
src/Publish/
src/Package/
artifacts/
src/Stack/
src/local-artifacts/*
/tools/AzureRM/AzureRM.psm1
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ before_install:
# https://github.com/travis-ci/travis-ci/issues/1066#issuecomment-383489298
script:
- sudo dotnet msbuild build.proj /t:Full /p:Configuration=$CONFIG || travis_terminate 1
# - sudo dotnet src/Package/StaticAnalysis/StaticAnalysis.Netcore.dll -p $TRAVIS_BUILD_DIR/src/Package/$CONFIG -r $TRAVIS_BUILD_DIR/src/Package/StaticAnalysis -u || travis_terminate 1
# - sudo pwsh -NonInteractive -NoLogo -NoProfile -File tools/TestModuleLoading.ps1 || travis_terminate 1
# - sudo dotnet test src/Azure.PowerShell.Netcore.Test.sln --filter "AcceptanceType=CheckIn&RunType!=DesktopOnly" --configuration $CONFIG --framework netcoreapp2.0

after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ FROM mcr.microsoft.com/powershell

ARG CONFIG=Release

COPY src/Package/${CONFIG}/ResourceManager/AzureResourceManager /usr/local/share/powershell/Modules
COPY artifacts/${CONFIG} /usr/local/share/powershell/Modules
COPY tools/InstallationTests/NetcoreTests /azpstests
2 changes: 1 addition & 1 deletion Repo.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepoSrc>$(RepoRoot)src\</RepoSrc>
<RepoArtifacts>$(RepoSrc)Package\</RepoArtifacts>
<RepoArtifacts>$(RepoRoot)artifacts\</RepoArtifacts>
<RepoTools>$(RepoRoot)tools\</RepoTools>
</PropertyGroup>

Expand Down
79 changes: 35 additions & 44 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Available Targets:
<!--
Available Targets:
/t:Clean
Removes temporary build outputs.
/t:Clean
Removes temporary build outputs.
/t:Build
Builds assemblies.
/t:Build
Builds assemblies.
/t:Test
Runs tests
/t:Test
Runs tests
/t:Publish
Creates local nuget packages and MSI
/t:Publish
Creates local nuget packages and MSI
/p:CodeSign=True
Code sign binaries, mainly for official release. Default is false.
/p:CodeSign=True
Code sign binaries, mainly for official release. Default is false.
/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.
/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.
/p:Scope
'ServiceManagement': service management
'AzureStorage': storage data plane cmdlets
'Stack': Azure Stack cmdlets
'Subfolder under src\ResourceManager': An individual cmdlet module
By default, it builds everything
/p:Scope
'ServiceManagement': service management
'AzureStorage': storage data plane cmdlets
'Stack': Azure Stack cmdlets
'Subfolder under src\ResourceManager': An individual cmdlet module
By default, it builds everything
/p:SkipHelp=True
Skips help generation, mainly for local builds to save time.
/p:SkipHelp=True
Skips help generation, mainly for local builds to save time.
/p:SkipNugetRestore=True
Skips nuget restore, mainly for local builds to save time when you have already restored nugets.
/p:SkipNugetRestore=True
Skips nuget restore, mainly for local builds to save time when you have already restored nugets.
/p:SkipDependencyAnalysis=True
Skips build validation, mainly for local builds to save time.
/p:SkipDependencyAnalysis=True
Skips build validation, mainly for local builds to save time.
/p:QuickBuild=true
Same thing as doing SkipHelp, SkipNugetRestore, and SkipDependencyAnalysis
/p:QuickBuild=true
Same thing as doing SkipHelp, SkipNugetRestore, and SkipDependencyAnalysis
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

-->
<Import Project="$(MSBuildThisFileDirectory)Repo.props" />

<!-- Define default build properties -->
<PropertyGroup>
Expand Down Expand Up @@ -255,15 +255,6 @@
<Artifacts Include="@(GetAllFiles->'%(RootDir)%(Directory)'->Distinct())" />
</ItemGroup>
<RemoveDir Directories="%(Artifacts.Identity)" ContinueOnError="true" />

<ItemGroup>
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Resources\Az.Tags.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Websites\Az.Resources.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Websites\Az.Tags.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Network\Az.Resources.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Network\Az.Tags.psd1" />
</ItemGroup>
<Delete Files="@(ExtraPsdFiles->'%(FullPath)')" />
<!-- TODO: </REMOVE THIS SECTION> -->


Expand Down Expand Up @@ -430,7 +421,7 @@
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
</PropertyGroup>
<!-- TODO: Use '-m @(ModulesChanged)' in command when FilterBuild is fixed. -->
<!-- <Exec Command="dotnet $(MSBuildThisFileDirectory)src/Package/StaticAnalysis/StaticAnalysis.Netcore.dll -p $(MSBuildThisFileDirectory)src/Package/$(Configuration) -r $(MSBuildThisFileDirectory)src/Package/StaticAnalysis $(SkipHelpValue) -u" /> -->
<!-- <Exec Command="dotnet $(MSBuildThisFileDirectory)artifacts/StaticAnalysis/StaticAnalysis.Netcore.dll -p $(MSBuildThisFileDirectory)artifacts/$(Configuration) -r $(MSBuildThisFileDirectory)artifacts/StaticAnalysis $(SkipHelpValue) -u" /> -->

<OnError ExecuteTargets="StaticAnalysisErrorMessage" />
</Target>
Expand All @@ -449,7 +440,7 @@
<PropertyGroup>
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
</PropertyGroup>
<Exec Command="dotnet $(MSBuildProjectDirectory)\src\Package\StaticAnalysis.Netcore.dll -p $(MSBuildProjectDirectory)\src\Package\$(Configuration) -r $(MSBuildProjectDirectory)\src\Package $(SkipHelpValue) -u -m @(ModulesChanged)" />
<Exec Command="dotnet $(MSBuildProjectDirectory)\artifacts\StaticAnalysis.Netcore.dll -p $(MSBuildProjectDirectory)\artifacts\$(Configuration) -r $(MSBuildProjectDirectory)\artifacts $(SkipHelpValue) -u -m @(ModulesChanged)" />

<OnError ExecuteTargets="StaticAnalysisErrorMessage"/>
</Target>
Expand Down Expand Up @@ -514,7 +505,7 @@
</Target>

<Target Name="BinScopeErrorMessage">
<Error Text="Binscope failed, please check the files in src/Package/BinScope" />
<Error Text="Binscope failed, please check the files in artifacts/BinScope" />
</Target>

<Target Name="RunPoliCheck">
Expand All @@ -523,7 +514,7 @@
</Target>

<Target Name="PoliCheckErrorMessage">
<Error Text="PoliCheck failed with a Severity 1 issue, please check the report at in src/Package/PoliCheck-Scan.html" />
<Error Text="PoliCheck failed with a Severity 1 issue, please check the report at in artifacts/PoliCheck-Scan.html" />
</Target>

</Project>
6 changes: 3 additions & 3 deletions documentation/Debugging-StaticAnalysis-Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ Our StaticAnalysis tools help us ensure our modules follow PowerShell guidelines
## How to know if you have a StaticAnalysis Error
If your build is failing, click on the Jenkins job inside the PR (marked as "Default" within checks). Then check the Console Output within the Jenkins job. If you have this error, then you have failed StaticAnalysis:
```
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\src\Package\StaticAnalysis.exe d:\workspace\powershell\src\Package\Debug d:\workspace\powershell\src\Package true false" exited with code 255.
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\artifacts\StaticAnalysis.exe d:\workspace\powershell\artifacts\Debug d:\workspace\powershell\artifacts true false" exited with code 255.
```

## Where to find StaticAnalysis reports

The StaticAnalysis reports could show up in two different places in the CI build:
- On the status page in Jenkins, under the Build Artifacts: the relevant files are `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.
- On the status page in Jenkins, click Build Artifacts then navigate to src/Package. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.
- On the status page in Jenkins, click Build Artifacts then navigate to artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.

Locally, the StaticAnalysis report will show up under Azure-PowerShell/src/Package. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`. You can generate these files by running
Locally, the StaticAnalysis report will show up under Azure-PowerShell/artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`. You can generate these files by running
```
msbuild build.proj
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ Now, you'll need to edit the solution file. Open the `<SERVICE>.sln` in your tex

After the solution file is updated, save and close it. Now, open the solution file in Visual Studio. Right click on the `Commands.<SERVICE>` project in the `Solution Explorer` and select `Unload project`. Right click on the unloaded project and select `Edit Commands.<SERVICE>.csproj`. Once opened, ensure that the following things are changed:
- The `AssemblyNamespace` and `RootNamespace` attributes of the project _must_ be changed to `Microsoft.Azure.PowerShell.Cmdlets.<SERVICE>`. If these changes are not made, then the assembly produced from this project is not be signed and results in errors when users try to use your module.
- Change the `OutputPath` attribute to `$(ProjectDir)..\..\..\Package\$(Configuration)\ResourceManager\AzureResourceManager\Az.<SERVICE>\`
- Change the particular `<ItemGroup>` containing `<None Include="Az.<SERVICE>.psd1">`

Right click on the project and select `Reload project`, and then build the solution by either right clicking on the solution and selecting `Rebuild Solution` or, from the top of Visual Studio, selecting `Build > Rebuild Solution`. If the build does not succeed, open the `.csproj` file and ensure there are no errors.
Expand Down Expand Up @@ -198,7 +197,7 @@ To import modules automatically when debug has started, follow the below steps:

- In the **Debug** tab mentioned previously, go to **Start Options**
- Import the Profile module, along with the module you are testing, by pasting the following in the **Command line arguments** box (_note_: you have to update the <PATH_TO_REPO> and <SERVICE> values provided below):
- `-NoExit -Command "Import-Module <PATH_TO_REPO>/src/Package/Debug/ResourceManager/AzureResourceManager/Az.Accounts/Az.Accounts.psd1;Import-Module <PATH_TO_REPO>/src/Package/Debug/ResourceManager/AzureResourceManager/Az.<SERVICE>/Az.<SERVICE>.psd1;$VerbosePreference='Continue'"`
- `-NoExit -Command "Import-Module <PATH_TO_REPO>/artifacts/Debug/Az.Accounts/Az.Accounts.psd1;Import-Module <PATH_TO_REPO>/artifacts/Debug/Az.<SERVICE>/Az.<SERVICE>.psd1;$VerbosePreference='Continue'"`
- **Note**: if you do not see all of the changes you made to the cmdlets when importing your module in a PowerShell session (_e.g.,_ a cmdlet you added is not recognized as a cmdlet), you may need to delete any existing Azure PowerShell modules that you have on your machine (installed through the PowerShell Gallery) before you import your module.

## Adding Help Content
Expand Down Expand Up @@ -303,7 +302,7 @@ $subcriptions = $job | Receive-Job

## Argument Completers

PowerShell uses Argument Completers to provide tab completion for users. At the moment, Azure PowerShell has two specific argument completers that should be applied to relevant parameters, and one generic argument completer that can be used to tab complete with a given list of values. To test the completers, run a complete build after you have added the completers (`msbuild build.proj`) and ensure that the psm1 file (`Az.<Service>.psm1`) has been added to the psd1 file found in `src/Package/Debug/ResourceManager/AzureResourceManager/AzureRM.<Service>/AzureRM.<Service>.psd1` under "Root Module".
PowerShell uses Argument Completers to provide tab completion for users. At the moment, Azure PowerShell has two specific argument completers that should be applied to relevant parameters, and one generic argument completer that can be used to tab complete with a given list of values. To test the completers, run a complete build after you have added the completers (`msbuild build.proj`) and ensure that the psm1 file (`Az.<Service>.psm1`) has been added to the psd1 file found in `artifacts/Debug/Az.<Service>/Az.<Service>.psd1` under "Root Module".

### Resource Group Completer

Expand Down
34 changes: 16 additions & 18 deletions documentation/development-docs/generate-format.ps1xml-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ This will place the column at the very beginning of the table.
PS E:\git\azure-powershell> msbuild build.proj /p:SkipHelp=true
```

* After the build is completed you can find build artifacts in the ```.\src\Package\Debug``` folder:
* After the build is completed you can find build artifacts in the ```.\artifacts\Debug``` folder:

```Powershell
PS E:\git\azure-powershell> ls .\src\Package\Debug\
PS E:\git\azure-powershell> ls .\artifacts\Debug\


Directory: E:\git\azure-powershell\src\Package\Debug
Directory: E:\git\azure-powershell\artifacts\Debug


Mode LastWriteTime Length Name
Expand All @@ -340,33 +340,33 @@ d----- 4/25/2018 4:35 PM Storage
PS E:\git\azure-powershell> Import-Module E:\git\azure-powershell\tools\RepoTasks\RepoTasks.Cmdlets\bin\Debug\RepoTasks.Cmdlets.dll
```
3. Run the **New-FormatPs1Xml** cmdlet.
* The cmdlet has one required argument **-ModulePath** - a path to a module manifest (psd1) file. Since in our example we are using the Get-AzSubscription cmdlet from the Az.Profile module we need to specify path to the Az.Profile module manifest which is
* The cmdlet has one required argument **-ModulePath** - a path to a module manifest (psd1) file. Since in our example we are using the Get-AzSubscription cmdlet from the Az.Accounts module we need to specify path to the Az.Accounts module manifest which is
```
E:\git\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\Az.Profile\Az.Profile.psd1
E:\git\azure-powershell\artifacts\Debug\Az.Accounts\Az.Accounts.psd1
```
* Also with the cmdlet we need to use **-OnlyMarkedProperties** switch.
* You may also want to specify an output path for the generated file with the **-OutputPath** argument. If not specified this is current folder.

```
PS E:\git\azure-powershell> New-FormatPs1Xml -ModulePath .\src\Package\Debug\ResourceManager\AzureResourceManager\Az.Profile\Az.Profile.psd1 -OnlyMarkedProperties
PS E:\git\azure-powershell> New-FormatPs1Xml -ModulePath .\artifacts\Debug\Az.Accounts\Az.Accounts.psd1 -OnlyMarkedProperties

E:\git\azure-powershell\Microsoft.Azure.Commands.Profile.generated.format.ps1xml
```
* After a successful run the cmdlet outputs the full path to the generated format.ps1xml file.

# How to test the format.ps1xml file.

**Note:** All the paths used in the example in the section are under **_azure-powershell/src/Package/Debug_**
**Note:** All the paths used in the example in the section are under **_azure-powershell/artifacts/Debug_**

1. **Copy** the generated format.ps1xml file to the built module folder (this is where your module manifest file psd1 is located). In our example the module folder is
```
E:\git\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\Az.Profile
E:\git\azure-powershell\artifacts\Debug\Az.Accounts
```

2. Modify your module manifest file.
* In our example the module manifest is Az.Profile.psd1:
* In our example the module manifest is Az.Accounts.psd1:
```
E:\git\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\Az.Profile\Az.Profile.psd1
E:\git\azure-powershell\artifacts\Debug\Az.Accounts\Az.Accounts.psd1
```

* In the module manifest file there is a variable called **FormatsToProcess** to reference format.ps1xml files.
Expand All @@ -387,9 +387,9 @@ FunctionsToExport = @()

# script omitted for brevity
```
3. Open a **PowerShell window** and **import** your module. In our example it is Az.Profile:
3. Open a **PowerShell window** and **import** your module. In our example it is Az.Accounts:
```Powershell
PS C:\> Import-Module E:\git\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\Az.Profile\Az.Profile.psd1
PS C:\> Import-Module E:\git\azure-powershell\artifacts\Debug\Az.Accounts\Az.Accounts.psd1
```

4. Try your cmdlet out. In our example it is Get-AuzreRmSubsription:
Expand Down Expand Up @@ -423,8 +423,8 @@ c9cbd920-c00c-427c-852b-c329e824c3a8 Azure SDK Powershell Test Enabled 72f988bf-
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="..\AzureRM.Profile.psd1">
<Link>AzureRM.Profile.psd1</Link>
<None Include="..\Az.Accounts.psd1">
<Link>Az.Accounts.psd1</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Microsoft.Azure.Commands.Profile.types.ps1xml">
Expand All @@ -433,12 +433,10 @@ c9cbd920-c00c-427c-852b-c329e824c3a8 Azure SDK Powershell Test Enabled 72f988bf-
</Content>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
<None Include="StartupScripts\*.ps1">
<!-- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> -->
</None>
<None Include="StartupScripts\*.ps1" />
</ItemGroup>
```
3. Add the generated format.ps1xml file to your source module manifest **FormatsToProcess** variable. In our example this is [src/ResourceManager/Profile/Az.Profile.psd1](https://github.com/Azure/azure-powershell/blob/master/src/ResourceManager/Profile/Az.Profile.psd1) file:
3. Add the generated format.ps1xml file to your source module manifest **FormatsToProcess** variable. In our example this is [src/ResourceManager/Profile/Az.Accounts.psd1](https://github.com/Azure/azure-powershell/blob/master/src/ResourceManager/Profile/Az.Accounts.psd1) file:
```Powershell
# script omitted for brevity

Expand Down
Loading

0 comments on commit 7b17d0d

Please sign in to comment.