Skip to content
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

Fix an invalid char to string conversion #1396

Closed
wants to merge 12 commits into from
357 changes: 175 additions & 182 deletions .nuke/build.schema.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"$schema": "./build.schema.json",
"$schema": "build.schema.json",
"Solution": "nuke-common.sln",
"SignPathOrganizationId": "0fdaf334-6910-41f4-83d2-e58e4cccb087",
"SignPathProjectSlug": "nuke",
"SignPathPolicySlug": "release-signing"
"SignPathSettings": {
"OrganizationId": "0fdaf334-6910-41f4-83d2-e58e4cccb087",
"ProjectSlug": "nuke",
"PolicySlug": "release-signing"
}
}
18 changes: 3 additions & 15 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,9 @@ project {
unchecked = "False",
display = ParameterDisplay.NORMAL)
text (
"env.SignPathOrganizationId",
label = "SignPathOrganizationId",
value = "0fdaf334-6910-41f4-83d2-e58e4cccb087",
allowEmpty = true,
display = ParameterDisplay.NORMAL)
text (
"env.SignPathPolicySlug",
label = "SignPathPolicySlug",
value = "release-signing",
allowEmpty = true,
display = ParameterDisplay.NORMAL)
text (
"env.SignPathProjectSlug",
label = "SignPathProjectSlug",
value = "nuke",
"env.SignPathSettings",
label = "SignPathSettings",
value = "",
allowEmpty = true,
display = ParameterDisplay.NORMAL)
text (
Expand Down
84 changes: 84 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Security.KeyVault.Certificates" Version="4.6.0" />
<PackageVersion Include="Azure.Security.KeyVault.Keys" Version="4.6.0" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.7.2" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="HtmlAgilityPack" Version="1.11.61" />
<PackageVersion Include="Humanizer" Version="2.14.1" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="NJsonSchema" Version="10.9.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.Packaging" Version="6.10.1" />
<PackageVersion Include="Octokit" Version="13.0.1" />
<PackageVersion Include="Serilog" Version="4.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact.Reader" Version="4.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.Json" Version="8.0.3" />
<PackageVersion Include="YamlDotNet" Version="15.3.0" />
<PackageVersion Include="matkoch.spectre.console" Version="0.46.0" />
</ItemGroup>

<!-- Testing -->
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="TeamCity.VSTest.TestAdapter" Version="1.0.40" />
<PackageVersion Include="Verify.Xunit" Version="25.0.2" />
<PackageVersion Include="Verify.DiffPlex" Version="2.3.0" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
</ItemGroup>

<!-- Roslyn (Nuke.SourceGenerator + Nuke.GlobalTool) -->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
</ItemGroup>

<!-- MSBuild (Nuke.ProjectModel + Nuke.MSBuildTasks) -->
<ItemGroup>
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.8" />

<PackageVersion Include="Microsoft.Build" Version="17.10.4" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.10.4" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.10.4" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.10.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageVersion Update="Microsoft.Build" Version="17.5.0" />
<PackageVersion Update="Microsoft.Build.Framework" Version="17.5.0" />
<PackageVersion Update="Microsoft.Build.Tasks.Core" Version="17.5.0" />
<PackageVersion Update="Microsoft.Build.Utilities.Core" Version="17.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageVersion Update="Microsoft.Build" Version="16.9.0" />
<PackageVersion Update="Microsoft.Build.Framework" Version="16.9.0" />
<PackageVersion Update="Microsoft.Build.Tasks.Core" Version="16.9.0" />
<PackageVersion Update="Microsoft.Build.Utilities.Core" Version="16.9.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>.\..</NukeRootDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>

<!-- Test properties for MSBuild integration -->
Expand Down
2 changes: 1 addition & 1 deletion docs/03-common/06-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Please refer to the [MinVer documentation](https://github.com/adamralph/minver#u

```powershell title="Tool Installation"
# terminal-command
nuke :add-package MinVer
nuke :add-package minver-cli
```

```csharp title="Build.cs"
Expand Down
3 changes: 2 additions & 1 deletion nuke-common.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright $CURRENT_YEAR$ Maintainers of NUKE.&#xD;
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright ${CurrentDate.Year} Maintainers of NUKE.&#xD;
Distributed under the MIT License.&#xD;
https://github.com/nuke-build/nuke/blob/master/LICENSE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;</s:String>
Expand All @@ -17,4 +17,5 @@ https://github.com/nuke-build/nuke/blob/master/LICENSE</s:String>
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileA321B7F1C678C84CAFFD23C2D9D03A36/RelativePriority/@EntryValue">3</s:Double>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileA68CFA51EFE4364DA61BFD270E021A11/@KeyIndexDefined">True</s:Boolean>
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileA68CFA51EFE4364DA61BFD270E021A11/RelativePriority/@EntryValue">1</s:Double>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
20 changes: 10 additions & 10 deletions source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<PackageReference Include="coverlet.msbuild" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.40"/>
<PackageReference Include="Verify.Xunit" Version="25.0.2" />
<PackageReference Include="Verify.DiffPlex" Version="2.3.0" />
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"/>
<PackageReference Include="coverlet.msbuild" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="GitHubActionsTestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="TeamCity.VSTest.TestAdapter" />
<PackageReference Include="Verify.Xunit" />
<PackageReference Include="Verify.DiffPlex" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
Expand Down
50 changes: 40 additions & 10 deletions source/Nuke.Build.Shared/CompletionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,47 @@ public static IReadOnlyDictionary<string, string[]> GetItemsFromSchema(AbsoluteP

public static IReadOnlyDictionary<string, string[]> GetItemsFromSchema(JsonDocument schema, IEnumerable<string> profileNames)
{
string[] GetEnumValues(JsonElement property)
=> property.TryGetProperty("enum", out var enumProperty)
? enumProperty.EnumerateArray().Select(x => x.GetString()).ToArray()
: property.TryGetProperty("items", out var itemsProperty)
? GetEnumValues(itemsProperty)
: null;

var properties = schema.RootElement.GetProperty("definitions").GetProperty("build").GetProperty("properties")
.EnumerateObject().OfType<JsonProperty>();
return properties.ToDictionary(x => x.Name, x => GetEnumValues(x.Value))
var definitions = schema.RootElement.GetProperty("definitions").EnumerateObject().ToDictionary(x => x.Name, x => x);

var parameterProperties = schema.RootElement.GetProperty("definitions").TryGetProperty("NukeBuild", out var nukebuildProperty)
? nukebuildProperty.GetProperty("properties").EnumerateObject()
.Concat(schema.RootElement.TryGetProperty("properties", out var properties) ? properties.EnumerateObject() : [])
: definitions["build"].Value.GetProperty("properties").EnumerateObject();

return parameterProperties
.Select(x => (x.Name, Values: GetValues(x)))
.Where(x => x.Values != null)
.ToDictionary(x => x.Name, x => x.Values)
.SetKeyValue(Constants.LoadedLocalProfilesParameterName, profileNames.ToArray()).AsReadOnly();

string[] GetValues(JsonProperty property)
{
if (property.Value.TryGetProperty("type", out var typeProperty))
{
var types = typeProperty.ValueKind != JsonValueKind.Array
? [typeProperty.GetString()]
: typeProperty.EnumerateArray().Select(x => x.GetString()).ToArray();
if (types.ContainsAnyOrdinalIgnoreCase(["string", "boolean", "integer"]))
{
return property.Value.TryGetProperty("enum", out var enumProperty)
? enumProperty.EnumerateArray().Select(x => x.GetString()).ToArray()
: [];
}

if (types.Single() == "array")
return GetValues(property.Value.EnumerateObject().Single(x => x.Name == "items"));

if (types.Single() == "object")
return null;
}
else if (property.Value.TryGetProperty("$ref", out var refProperty))
{
var definition = definitions.GetValueOrDefault(refProperty.GetString().NotNull().Split('/').LastOrDefault());
return GetValues(definition);
}

throw new NotSupportedException();
}
}

// ReSharper disable once CognitiveComplexity
Expand Down
2 changes: 1 addition & 1 deletion source/Nuke.Build.Shared/Nuke.Build.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
Configuration: [
Debug,
Release
],
NoLogo: [],
Profile: [
dev
],
Target: [
Restore,
Compile
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
BooleanParam: [],
ComponentInheritedParam: [],
Continue: [],
CustomEnumerationArrayParam: [
Debug,
Release
],
CustomEnumerationParam: [
Debug,
Release
],
Help: [],
Host: [
Rider,
Terminal,
VisualStudio,
VSCode
],
IntegerArrayParam: [],
NoLogo: [],
NullableBooleanParam: [],
Partition: [],
Plan: [],
Profile: [],
RegularParam: [],
Root: [],
SecretParam: [],
Skip: [],
StringArrayParam: [],
Target: [],
Verbosity: [
Verbose,
Normal,
Minimal,
Quiet
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
Continue: [],
Help: [],
Host: [
Rider,
Terminal,
VisualStudio,
VSCode
],
NoLogo: [],
Partition: [],
Plan: [],
Profile: [
dev
],
Root: [],
Skip: [
ExplicitTarget,
ImplementedTarget,
InheritedTarget,
RegularTarget
],
Target: [
ExplicitTarget,
ImplementedTarget,
InheritedTarget,
RegularTarget
],
Verbosity: [
Verbose,
Normal,
Minimal,
Quiet
]
}
Loading
Loading