Skip to content

Commit

Permalink
refactor: use XAMLStyler in ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jun 6, 2024
1 parent 94066f5 commit c4ae614
Show file tree
Hide file tree
Showing 26 changed files with 217 additions and 11,525 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"xamlstyler.console": {
"version": "3.2404.2",
"commands": [
"xstyler"
]
}
}
}
6 changes: 4 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"CreateRelease",
"Publish",
"Restore",
"SignArtifacts"
"SignArtifacts",
"XamlStyler"
]
}
},
Expand All @@ -123,7 +124,8 @@
"CreateRelease",
"Publish",
"Restore",
"SignArtifacts"
"SignArtifacts",
"XamlStyler"
]
}
},
Expand Down
12 changes: 7 additions & 5 deletions XamlStyler/Options/XAMLStyler.json → Settings.XAMLStyler
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"IndentSize": 4,
"AttributesTolerance": 2,
"KeepFirstAttributeOnSameLine": true,
"MaxAttributeCharatersPerLine": 0,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush",
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush, Pen",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
Expand All @@ -14,12 +14,14 @@
"x:Class",
"xmlns, xmlns:x",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title, Header",
"TargetType, BasedOn, Style",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
"Background, Foreground, FontFamily, FontSize, LineHeight, FontWeight, FontStyle, FontStretch",
"*:*, *",
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
"PageSource, PageIndex, Color, Opacity, Offset, TargetName, Property, Value, StartPoint, EndPoint",
"*:Freeze, mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
"Storyboard.*, From, To, Duration"
],
Expand All @@ -34,7 +36,7 @@
"ReorderCanvasChildren": false,
"ReorderSetters": 3,
"FormatMarkupExtension": true,
"NoNewLineMarkupExtensions": "x:Bind, Binding, TemplateBinding, x:Static, DynamicResource, ComponentResourceKey, iconPacks:Modern, iconPacks:Material",
"NoNewLineMarkupExtensions": "x:Bind, Binding, TemplateBinding, x:Static, DynamicResource, ComponentResourceKey, RelativeSource",
"ThicknessSeparator": 1,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": false,
Expand Down
Binary file removed XamlStyler/CommandLine.dll
Binary file not shown.
1,390 changes: 0 additions & 1,390 deletions XamlStyler/CommandLine.xml

This file was deleted.

Binary file removed XamlStyler/Irony.dll
Binary file not shown.
753 changes: 0 additions & 753 deletions XamlStyler/Irony.xml

This file was deleted.

Binary file removed XamlStyler/Newtonsoft.Json.dll
Binary file not shown.
9,112 changes: 0 additions & 9,112 deletions XamlStyler/Newtonsoft.Json.xml

This file was deleted.

41 changes: 0 additions & 41 deletions XamlStyler/Options/DefaultSettings.json

This file was deleted.

41 changes: 0 additions & 41 deletions XamlStyler/Settings.XamlStyler

This file was deleted.

Binary file removed XamlStyler/XamlStyler.Core.dll
Binary file not shown.
1 change: 0 additions & 1 deletion XamlStyler/format_all_xaml.cmd

This file was deleted.

Binary file removed XamlStyler/xstyler.exe
Binary file not shown.
6 changes: 0 additions & 6 deletions XamlStyler/xstyler.exe.config

This file was deleted.

37 changes: 21 additions & 16 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,11 @@ protected override void OnBuildInitialized()
Log.Information("NuGet Version: {NuGetVersion}", GitVersion.NuGetVersion);
}

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[Solution(GenerateProjects = true, SuppressBuildProjectCheck = false)]
readonly Solution Solution;
[GitRepository]
readonly GitRepository GitRepository;
[GitVersion(Framework = "net6.0", NoFetch = true)]
readonly GitVersion GitVersion;
[Solution(GenerateProjects = true, SuppressBuildProjectCheck = false)] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion(Framework = "net6.0", NoFetch = true)] readonly GitVersion GitVersion;

AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath OutputDirectory => RootDirectory / "artifacts";
Expand All @@ -105,15 +101,24 @@ protected override void OnBuildInitialized()
});

Target Restore => _ => _
.DependsOn(Clean)
.Executes(() =>
{
DotNetToolRestore();
DotNetRestore(s => s
.SetProjectFile(Solution));
});

Target Compile => _ => _
Target XamlStyler => _ => _
.DependsOn(Restore)
.DependsOn(Clean)
.Executes(() =>
{
DotNet($"xstyler --recursive --directory \"{SourceDirectory}\" --config \"{RootDirectory / "Settings.XAMLStyler"}\"");
});

Target Compile => _ => _
.DependsOn(XamlStyler)
.Executes(() =>
{
DotNetBuild(s => s
Expand Down Expand Up @@ -223,12 +228,12 @@ private void UploadReleaseAssetToGithub(IGitHubClient client, Release release, A
Log.Information("Done Uploading {FileName} to the release", asset.Name);
}

[Parameter("GitHub Api key")][Secret] string GithubToken = null;
[Parameter][Secret] readonly string AzureKeyVaultUrl;
[Parameter][Secret] readonly string AzureKeyVaultClientId;
[Parameter][Secret] readonly string AzureKeyVaultTenantId;
[Parameter][Secret] readonly string AzureKeyVaultClientSecret;
[Parameter][Secret] readonly string AzureKeyVaultCertificate;
[Parameter("GitHub Api key")] [Secret] string GithubToken = null;
[Parameter] [Secret] readonly string AzureKeyVaultUrl;
[Parameter] [Secret] readonly string AzureKeyVaultClientId;
[Parameter] [Secret] readonly string AzureKeyVaultTenantId;
[Parameter] [Secret] readonly string AzureKeyVaultClientSecret;
[Parameter] [Secret] readonly string AzureKeyVaultCertificate;

void SignFiles(IEnumerable<string> files, string description, string descriptionUrl)
{
Expand Down
26 changes: 13 additions & 13 deletions src/IconPacks.Browser/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@
</ResourceDictionary.MergedDictionaries>

<!-- Brushes -->
<SolidColorBrush x:Key="IconPackBrowser.Brushes.PanelBackground" Opacity="0.15" Color="#808080" />
<SolidColorBrush x:Key="IconPackBrowser.Brushes.PanelBackground" Color="#808080" Opacity="0.15" />

<!-- Styles -->
<Style x:Key="UnderlinedTextBlockStyle"
BasedOn="{StaticResource {x:Type TextBlock}}"
TargetType="{x:Type TextBlock}">
TargetType="{x:Type TextBlock}"
BasedOn="{StaticResource {x:Type TextBlock}}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.ListBoxItem}" TargetType="{x:Type ListBoxItem}">
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource MahApps.Styles.ListBoxItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<Style x:Key="CustomMetroCircleButtonStyle"
BasedOn="{StaticResource MahApps.Styles.Button.Circle}"
TargetType="{x:Type Button}">
TargetType="{x:Type Button}"
BasedOn="{StaticResource MahApps.Styles.Button.Circle}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Gray3}" />
<Setter Property="BorderThickness" Value="2" />
Expand All @@ -57,8 +57,8 @@
<Ellipse Fill="{TemplateBinding Background}" StrokeThickness="0" />
<Ellipse x:Name="ellipsebg"
Fill="{DynamicResource MahApps.Brushes.ThemeForeground}"
Opacity="0"
StrokeThickness="0" />
StrokeThickness="0"
Opacity="0" />
<Ellipse x:Name="ellipse"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=BorderThickness.Left}" />
Expand Down Expand Up @@ -92,21 +92,21 @@
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.Expander}" TargetType="Expander">
<Style TargetType="Expander" BasedOn="{StaticResource MahApps.Styles.Expander}">
<Setter Property="IsExpanded" Value="True" />
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.MetroHeader}" TargetType="mah:MetroHeader">
<Style TargetType="mah:MetroHeader" BasedOn="{StaticResource MahApps.Styles.MetroHeader}">
<Setter Property="Padding" Value="2 0 2 4" />
<Setter Property="mah:HeaderedControlHelper.HeaderMargin" Value="2 2 2 4" />
<Setter Property="mah:HeaderedControlHelper.HeaderFontSize" Value="{DynamicResource MahApps.Font.Size.Content}" />
<Setter Property="mah:HeaderedControlHelper.HeaderMargin" Value="2 2 2 4" />
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.ColorPicker}" TargetType="mah:ColorPicker">
<Style TargetType="mah:ColorPicker" BasedOn="{StaticResource MahApps.Styles.ColorPicker}">
<Setter Property="BorderThickness" Value="0" />
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.ComboBox}" TargetType="ComboBox">
<Style TargetType="ComboBox" BasedOn="{StaticResource MahApps.Styles.ComboBox}">
<Setter Property="BorderThickness" Value="0" />
</Style>

Expand Down
4 changes: 2 additions & 2 deletions src/IconPacks.Browser/Controls/CopyToClipboardTextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox MaxHeight="60"
FontFamily="{Binding ElementName=ucCopyToClipboardTextBox, Path=FontFamily}"
mah:TextBoxHelper.SelectAllOnFocus="True"
BorderThickness="0"
FontFamily="{Binding ElementName=ucCopyToClipboardTextBox, Path=FontFamily}"
IsReadOnly="True"
Text="{Binding ElementName=ucCopyToClipboardTextBox, Path=TextToCopy, Mode=OneWay}"
TextWrapping="Wrap"
Expand All @@ -30,7 +30,7 @@
Content="{iconPacks:Octicons Kind=Copy}"
ToolTip="Copy">
<Button.Style>
<Style BasedOn="{StaticResource MahApps.Styles.Button.Chromeless}" TargetType="{x:Type Button}">
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.Chromeless}">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
Expand Down
24 changes: 12 additions & 12 deletions src/IconPacks.Browser/Controls/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
SelectedColorTemplate="{StaticResource IconPacksBroser.Templates.ColorPicker.Accent}"
StandardColorPaletteItemsSource="{x:Static vm:SettingsViewModel.AccentColors}">
<mah:ColorPicker.StandardColorPaletteStyle>
<Style BasedOn="{StaticResource MahApps.Styles.ColorPalette.ColorPickerDropDown}" TargetType="{x:Type mah:ColorPalette}">
<Style TargetType="{x:Type mah:ColorPalette}" BasedOn="{StaticResource MahApps.Styles.ColorPalette.ColorPickerDropDown}">
<Setter Property="ItemContainerStyle" Value="{DynamicResource MahApps.Styles.ListBoxItem}" />
<Setter Property="ItemTemplate" Value="{DynamicResource IconPacksBroser.Templates.ColorPicker.Accent}" />
<Setter Property="ItemsPanel">
Expand All @@ -87,21 +87,21 @@
<StackPanel>
<mah:MetroHeader Header="Directory for custom export templates">
<StackPanel>
<TextBox mah:TextBoxHelper.Watermark="Build-In Templates"
Style="{StaticResource IconPacksBrowser.Styles.TextBox.Hyperlink}"
<TextBox Style="{StaticResource IconPacksBrowser.Styles.TextBox.Hyperlink}"
mah:TextBoxHelper.Watermark="Build-In Templates"
Text="{Binding Source={x:Static prop:Settings.Default}, Path=ExportTemplatesDir}" />
<Button Margin="0 5 0 0"
<Button Style="{DynamicResource MahApps.Styles.Button.Chromeless}"
Margin="0 5 0 0"
Command="{Binding SelectTemplateFolderCommand}"
Content="Select a custom template folder"
Style="{DynamicResource MahApps.Styles.Button.Chromeless}" />
<Button Margin="0 5 0 0"
Content="Select a custom template folder" />
<Button Style="{DynamicResource MahApps.Styles.Button.Chromeless}"
Margin="0 5 0 0"
Command="{Binding ClearTemplatesDirCommand}"
Content="Reset template folder to default"
Style="{DynamicResource MahApps.Styles.Button.Chromeless}" />
<Button Margin="0 5 0 0"
Content="Reset template folder to default" />
<Button Style="{DynamicResource MahApps.Styles.Button.Chromeless}"
Margin="0 5 0 0"
Command="{Binding CopyOriginalTemplatesCommand}"
Content="Copy original templates to custom folder"
Style="{DynamicResource MahApps.Styles.Button.Chromeless}" />
Content="Copy original templates to custom folder" />
</StackPanel>
</mah:MetroHeader>
</StackPanel>
Expand Down
Loading

0 comments on commit c4ae614

Please sign in to comment.