Skip to content

Commit

Permalink
Add binary build for tool (microsoft#1871)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Jul 15, 2024
1 parent 809f0e4 commit 2a844a7
Show file tree
Hide file tree
Showing 24 changed files with 4,022 additions and 97 deletions.
2 changes: 1 addition & 1 deletion PSRule.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Types", "src\PSRule.Types\PSRule.Types.csproj", "{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.BuildTask", "src\PSRule.BuildTask\PSRule.BuildTask.csproj", "{872D2648-2F00-475E-84B5-F08BE07385B7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.MSBuild", "src\PSRule.MSBuild\PSRule.MSBuild.csproj", "{872D2648-2F00-475E-84B5-F08BE07385B7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E0EA0CBA-96C5-4447-8B69-BC13EF0D7A4A}"
EndProject
Expand Down
29 changes: 24 additions & 5 deletions pipeline.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,31 @@ task TestDotNet {
task BuildCLI BuildModule, {
exec {
# Build library
dotnet publish src/PSRule.Tool -c $Configuration --self-contained /p:DebugType=None /p:DebugSymbols=false -r win-x64 -o ./out/cli/win-x64/ -p:version=$Build
# dotnet publish src/PSRule.Tool -c $Configuration --no-self-contained -r win-x64 -o ./out/cli/win-x64/ -p:version=$Build
# dotnet publish --self-contained true -p:PublishTrimmed=true -p:PublishSingleFile=true -r win-x64 .\src\PSRule.Tool\PSRule.Tool.csproj -o .\out\cli
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true -o ./out/cli/build/ -p:version=$Build
}
}

task ReleaseCLI BuildModule, {

# Copy-Item -Path out/modules/PSRule/ -Destination out/cli/win-x64/modules/ -Recurse -Force;
# Build win-x64
exec {
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime win-x64 -o ./out/cli/win-x64/ -p:version=$Build
}

# Build linux-x64
exec {
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime linux-x64 -o ./out/cli/linux-x64/ -p:version=$Build
}

# Build linux-musl-x64
exec {
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime linux-musl-x64 -o ./out/cli/linux-musl-x64/ -p:version=$Build
}

# Build osx-x64
exec {
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime osx-x64 -o ./out/cli/osx-x64/ -p:version=$Build
}
}

task CopyModule {
Expand Down Expand Up @@ -313,7 +332,7 @@ task TestModule Dependencies, {
}
}

# Synopsis: Run validation
# Synopsis: Run self-test validation.
task Rules {
$assertParams = @{
Path = './.ps-rule/'
Expand Down
23 changes: 0 additions & 23 deletions ps-project.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions ps-rule.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"modules": {
"PSRule.Rules.MSFT.OSS": {
"version": "1.1.0"
},
"PSRule.Rules.Azure": {
"version": "1.30.0"
}
}
}
28 changes: 11 additions & 17 deletions ps-rule.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# PSRule configuration
# PSRule configuration.
#

# Please see the documentation for all configuration options:
Expand All @@ -11,32 +11,26 @@ repository:

output:
culture:
- 'en-US'
- en-US

input:
pathIgnore:
- '.vscode/'
- '.github/workflows/'
- .vscode/
- .github/
- docs/
- overrides/
- '*.md'
- '*.Designer.cs'
- '*.resx'
- '*.sln'
- '*.txt'
- '*.html'
- '*.ico'
- '*.png'
- 'ps-docs.yaml'
- 'ps-project.yaml'
- 'ps-rule.yaml'
- 'mkdocs.yml'
- '**/.editorconfig'
- '.markdownlint.json'
- '.github/dependabot.yml'

- '**/launchSettings.json'
- '**/Resources/*.json'

# Bug #1269: There is an issue preventing #1259 from being merged. Ignore this until bug is fixed.
- 'docs/scenarios/containers/dockerfile'
- '**/tests/**/*.json'
- ps-rule.yaml
- mkdocs.yml
- .markdownlint.json

include:
path: []
1 change: 1 addition & 0 deletions src/PSRule.Common.props → src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
</PropertyGroup>

<!-- Package metadata -->
Expand Down
1 change: 0 additions & 1 deletion src/PSRule.Badges/PSRule.Badges.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<AssemblyName>Microsoft.PSRule.Badges</AssemblyName>
<RootNamespace>PSRule.Badges</RootNamespace>
Expand Down
12 changes: 2 additions & 10 deletions src/PSRule.Benchmark/PSRule.Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -10,19 +9,12 @@
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>TRACE;BENCHMARK</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
</ItemGroup>

<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.12" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
Expand Down
3 changes: 3 additions & 0 deletions src/PSRule.Benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PSRule benchmarks

This is used to perform internal benchmarks of the PSRule engine under various scenarios.
33 changes: 12 additions & 21 deletions src/PSRule.Benchmark/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
"version": 1,
"dependencies": {
"net8.0": {
"BenchmarkDotNet.Diagnostics.Windows": {
"BenchmarkDotNet": {
"type": "Direct",
"requested": "[0.13.12, )",
"resolved": "0.13.12",
"contentHash": "HdARbwcGFymgrSFoLVtuJaacyNW9WLuGljX0hsTarSO+80nI2OmbDS09R+I9kIeJ8Gn/1zJFjKgefmAlADhlww==",
"contentHash": "aKnzpUZJJfLBHG7zcfQZhCexZQKcJgElC8qcFUTXPMYFlVauJBobuOmtRnmrapqC2j7EjjZCsPxa3yLvFLx5/Q==",
"dependencies": {
"BenchmarkDotNet": "0.13.12",
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2"
"BenchmarkDotNet.Annotations": "0.13.12",
"CommandLineParser": "2.9.1",
"Gee.External.Capstone": "2.3.0",
"Iced": "1.17.0",
"Microsoft.CodeAnalysis.CSharp": "4.1.0",
"Microsoft.Diagnostics.Runtime": "2.2.332302",
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2",
"Microsoft.DotNet.PlatformAbstractions": "3.1.6",
"Perfolizer": "[0.2.1]",
"System.Management": "5.0.0"
}
},
"Microsoft.Extensions.CommandLineUtils": {
Expand Down Expand Up @@ -83,23 +91,6 @@
"System.Text.Encoding.CodePages": "8.0.0"
}
},
"BenchmarkDotNet": {
"type": "Transitive",
"resolved": "0.13.12",
"contentHash": "aKnzpUZJJfLBHG7zcfQZhCexZQKcJgElC8qcFUTXPMYFlVauJBobuOmtRnmrapqC2j7EjjZCsPxa3yLvFLx5/Q==",
"dependencies": {
"BenchmarkDotNet.Annotations": "0.13.12",
"CommandLineParser": "2.9.1",
"Gee.External.Capstone": "2.3.0",
"Iced": "1.17.0",
"Microsoft.CodeAnalysis.CSharp": "4.1.0",
"Microsoft.Diagnostics.Runtime": "2.2.332302",
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2",
"Microsoft.DotNet.PlatformAbstractions": "3.1.6",
"Perfolizer": "[0.2.1]",
"System.Management": "5.0.0"
}
},
"BenchmarkDotNet.Annotations": {
"type": "Transitive",
"resolved": "0.13.12",
Expand Down
1 change: 0 additions & 1 deletion src/PSRule.BuildTool/PSRule.BuildTool.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
Expand Down
3 changes: 3 additions & 0 deletions src/PSRule.BuildTool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PSRule Build Tool

This tool is used for preparing specific artifacts prior to building PSRule solution.
1 change: 0 additions & 1 deletion src/PSRule.CommandLine/PSRule.CommandLine.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<AssemblyName>Microsoft.PSRule.CommandLine</AssemblyName>
<PackageId>Microsoft.PSRule.CommandLine</PackageId>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.CodeAnalysis;

namespace PSRule.BuildTask.Generators;
namespace PSRule.MSBuild.Generators;

/// <summary>
/// Generator constants for PSRule engine version.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<AssemblyTitle>PSRule.BuildTask</AssemblyTitle>
<AssemblyTitle>PSRule.MSBuild</AssemblyTitle>
<EnableNuget>false</EnableNuget>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
Expand Down
3 changes: 3 additions & 0 deletions src/PSRule.MSBuild/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PSRule MSBuild tasks

This library exposes some internal build tasks used during PSRule build process.
File renamed without changes.
1 change: 0 additions & 1 deletion src/PSRule.SDK/PSRule.SDK.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<AssemblyName>Microsoft.PSRule.SDK</AssemblyName>
<PackageId>Microsoft.PSRule.SDK</PackageId>
Expand Down
5 changes: 1 addition & 4 deletions src/PSRule.Tool/PSRule.Tool.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<AssemblyName>Microsoft.PSRule.Tool</AssemblyName>
<PackageId>Microsoft.PSRule.Tool</PackageId>
Expand All @@ -16,12 +15,10 @@
<PackAsTool>true</PackAsTool>
<ToolCommandName>ps-rule</ToolCommandName>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RuntimeIdentifiers>win-x64;linux-x64;linux-musl-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<!-- <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> -->
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading

0 comments on commit 2a844a7

Please sign in to comment.