13 Commits

Author SHA1 Message Date
Matteo Cominetti 7240e1b9f0 dialog proj
.NET Core / Build solution (push) Has been cancelled
Publish nightly builds / Build and pack (push) Has been cancelled
Publish nightly builds / Merge packages and publish nightly (push) Has been cancelled
2023-03-22 19:25:17 +01:00
Matteo Cominetti 5cde64bb37 Include referenced projects nugets 2023-03-22 19:02:18 +01:00
Matteo Cominetti 410959bfd4 Include Material.Styles in nuget 2023-03-22 18:42:14 +01:00
Matteo Cominetti b82deffc0e feat: updates Avalonia to 10.18 2023-03-22 18:32:29 +01:00
SKProCH 13d79e4868 Updated target framework to net6.0 for demo, updated dependencies [no nightly] 2022-12-16 02:01:55 +03:00
SKProCH f21fde754d Add theme toggling by pressing Material icon in the left drawer 2022-12-16 01:53:03 +03:00
SKProCH 41a22eb8b9 Change .editorconfig [no nightly] 2022-12-16 01:47:38 +03:00
SKProCH 7dcf401d79 Add .editorconfig [no nightly] 2022-12-04 14:48:27 +03:00
SKProCH 05756273e1 Merge pull request #199 from kirichenec/inherit-theme-fix
fix: Inherited theme on Windows11 was reversed
2022-12-04 14:40:41 +03:00
kirichenec 4e57cdcbcb fix: Inherited theme on Windows11 was reversed 2022-12-03 15:18:04 +03:00
SKProCH a8e6c38a14 Merge pull request #194 from Mrxx99/feature/demoapp-icon [no nightly]
Added Window icon for Material.Demo app (Taskbar)
2022-11-19 15:03:42 +03:00
mrxx99 1e6fe92d40 added window icon for Material.Demo app 2022-11-18 23:59:03 +01:00
SKProCH 9331799471 Add touch support for DataGrid #192 2022-11-11 13:12:22 +03:00
39 changed files with 403 additions and 898 deletions
+168
View File
@@ -0,0 +1,168 @@
# editorconfig.org
# top-most EditorConfig file
root = true
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
# ReSharper properties
resharper_place_simple_initializer_on_single_line = true
resharper_wrap_before_arrow_with_expressions = false
# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# trim_trailing_whitespace = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# prefer var
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true:suggestion
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case
# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
# use accessibility modifiers
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
space_within_single_line_array_initializer_braces = true
# Xaml files
[*.{xaml,axaml}]
indent_size = 2
# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
# Xml build files
[*.builds]
indent_size = 2
# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2
# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2
[*.json]
indent_size = 2
# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf
+22
View File
@@ -0,0 +1,22 @@
name: .NET Core
on:
push:
branches-ignore:
- 'master'
pull_request:
branches:
- '**:**'
jobs:
build:
runs-on: ubuntu-latest
name: Build solution
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.*
- name: Build with dotnet
run: dotnet build --configuration Release
-44
View File
@@ -1,44 +0,0 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_main --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------
name: main
on: [push, pull_request]
jobs:
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: Run './build.cmd Compile PublishNugetPackage'
run: ./build.cmd Compile PublishNugetPackage
env:
NuGetKey: ${{ secrets.NUGET_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
with:
name: nuget
path: Material.Avalonia/bin/artifacts/nuget
+62
View File
@@ -0,0 +1,62 @@
name: Publish nightly builds
on:
push:
branches: [ dev ]
jobs:
build:
name: Build and pack
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'no nightly')"
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.*
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack --configuration Release /p:PatchNumber=$GITHUB_RUN_NUMBER-nightly
- name: Collect packages
run: |
mkdir artifacts
cp Config.Numerge.json artifacts/
mkdir -p artifacts/input/
find . -name \*.nupkg -exec cp {} artifacts/input/ \;
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/
numerge:
name: Merge packages and publish nightly
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout Numerge
uses: actions/checkout@v2.3.4
with:
repository: CreateLab/Numerge
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*
- name: Build Numerge
run: dotnet build
- name: Download packages
uses: actions/download-artifact@v2.0.8
with:
name: artifacts
path: artifacts
- name: Merge packages
run: |
mkdir artifacts/output/
dotnet run --project Numerge.Console artifacts/Config.Numerge.json artifacts/input/ artifacts/output/
- name: Publish to Nuget
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.NUGET_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish to GitHub Packages
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/AvaloniaCommunity/index.json --skip-duplicate
+61
View File
@@ -0,0 +1,61 @@
name: Publish release
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
name: Build and pack
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.*
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack --configuration Release
- name: Collect packages
run: |
mkdir artifacts
cp Config.Numerge.json artifacts/
mkdir -p artifacts/input/
find . -name \*.nupkg -exec cp {} artifacts/input/ \;
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/
numerge:
runs-on: ubuntu-latest
name: Merge packages and publish release
needs: [build]
steps:
- name: Checkout Numerge
uses: actions/checkout@v2.3.4
with:
repository: CreateLab/Numerge
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*
- name: Build Numerge
run: dotnet build
- name: Download packages
uses: actions/download-artifact@v2.0.8
with:
name: artifacts
path: artifacts
- name: Merge packages
run: |
mkdir artifacts/output/
dotnet run --project Numerge.Console artifacts/Config.Numerge.json artifacts/input/ artifacts/output/
- name: Publish to Nuget
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.NUGET_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish to GitHub Packages
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/AvaloniaCommunity/index.json --skip-duplicate
-3
View File
@@ -1,3 +0,0 @@
[submodule "build/Numerge"]
path = build/Numerge
url = https://github.com/kekekeks/Numerge.git
-124
View File
@@ -1,124 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NuGetKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreateIntermediateNugetPackages",
"CreateNugetPackage",
"PublishNugetPackage",
"ZipFiles"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreateIntermediateNugetPackages",
"CreateNugetPackage",
"PublishNugetPackage",
"ZipFiles"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
},
"Version": {
"type": "string",
"description": "version"
}
}
}
}
}
-4
View File
@@ -1,4 +0,0 @@
{
"$schema": "./build.schema.json",
"Solution": "Material.Avalonia.sln"
}
-4
View File
@@ -17,16 +17,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Material.DataGrid", "Materi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Material.Dialog", "Material.Dialog\Material.Dialog.csproj", "{4F5F7FFD-B6E2-4C36-B250-D6B8169A0B1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Release|Any CPU.ActiveCfg = Release|Any CPU
+15 -28
View File
@@ -2,45 +2,27 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Title>Material.Avalonia</Title>
<Title>Speckle.Material.Avalonia</Title>
<Authors>Larymar,SKProCH,Appleneko2001</Authors>
<Description>This repository is a set of styles that will help you customize your application in an appropriate material design.</Description>
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</PackageProjectUrl>
<RepositoryUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</RepositoryUrl>
<Description>Fork of Material.Avalonia</Description>
<PackageProjectUrl>https://github.com/specklesystems/Speckle.Material.Avalonia</PackageProjectUrl>
<RepositoryUrl>https://github.com/specklesystems/Speckle.Material.Avalonia</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<LangVersion>8</LangVersion>
<PackageTags>avalonia xaml material design theme colour color ui ux material-design google-material</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>FavIcon.png</PackageIcon>
<Version>3.0.0-avalonia10-preview2</Version>
<PackageReleaseNotes>
Most likely latest version with Avalonia 0.10.x support
Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep version names clear)
- Bump Avalonia version dependency to 0.10.13
- Implement adapting to system base theme mode on Windows
- Improve/redesign Expander, TextBlock, Separator and other styles
- Create ContentExpandControl, used for animate resizing
- Add TransitioningContentControl style support
- Allow use Avalonia.Diagnostics to dialogs when using DEBUG profile
- Attach TextBlock properties to NumericUpDown
- Add padding to alert dialog and text field dialog
- Fix AutoCorrectPositionConverter #172
- Add default value for Slider, correct dots positioning
- Change resources apply logic to avoid colors apply delay while application starting
- Correct HsbConverter.ToColor method
- Add static part names pool
- Add auto-expand feature on NavigationDrawer
- Update contrast color algorithm
- Add InputMethod.IsInputMethodEnabled for TextBox
</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Speckle.Material.Avalonia</PackageId>
<Version>3.0.3</Version>
</PropertyGroup>
<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="/" />
<None Include="../wiki/FavIcon.png" Pack="true" PackagePath="/" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
@@ -48,10 +30,15 @@ Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Teronis.MSBuild.Packaging.ProjectBuildInPackage" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj" />
<ProjectReference Include="..\Material.Dialog\Material.Dialog.csproj" PrivateAssets="all" />
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj" PrivateAssets="all" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -17,6 +17,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
</ItemGroup>
</Project>
+15 -3
View File
@@ -237,7 +237,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Classes="Modern"
@@ -272,7 +276,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Grid.Column="2" Grid.Row="1" />
@@ -306,7 +314,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Classes="Mini"
+2 -2
View File
@@ -21,8 +21,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
</ItemGroup>
<ItemGroup>
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

+4 -2
View File
@@ -11,6 +11,7 @@
xmlns:models="clr-namespace:Material.Demo.Models"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Width="1280" Height="720" MinWidth="720"
Icon="/Assets/FavIcon_128x.png"
Title="Material.Demo">
<Window.Styles>
<Style Selector="showMeTheXaml|XamlDisplay">
@@ -56,7 +57,8 @@
<controls:ColorZone Mode="Accent" Height="180">
<StackPanel>
<Image Width="120" Height="120" HorizontalAlignment="Center" VerticalAlignment="Top"
Source="avares://Material.Demo/Assets/FavIcon_200x.png" Margin="0,0,0,-8" />
Source="avares://Material.Demo/Assets/FavIcon_200x.png" Margin="0,0,0,-8"
PointerPressed="MaterialIcon_OnPointerPressed" />
<TextBlock Classes="Headline6" Text="Material Design" HorizontalAlignment="Center" />
<TextBlock Classes="Subtitle1" Text="with AvaloniaUI" HorizontalAlignment="Center" />
</StackPanel>
@@ -221,4 +223,4 @@
</Window>
</Window>
+26 -35
View File
@@ -8,29 +8,24 @@ using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Material.Styles.Controls;
using Material.Styles.Models;
using Material.Styles.Themes;
using Material.Styles.Themes.Base;
namespace Material.Demo
{
public class MainWindow : Window
{
#region Control fields
private ToggleButton NavDrawerSwitch;
namespace Material.Demo {
public class MainWindow : Window {
private readonly List<SnackbarModel> helloSnackBars = new();
private ListBox DrawerList;
private Carousel PageCarousel;
private ScrollViewer mainScroller;
private NavigationDrawer LeftDrawer;
private ScrollViewer mainScroller;
private ToggleButton NavDrawerSwitch;
private Carousel PageCarousel;
#endregion
public MainWindow()
{
public MainWindow() {
InitializeComponent();
this.AttachDevTools(KeyGesture.Parse("Shift+F12"));
}
private void InitializeComponent()
{
private void InitializeComponent() {
AvaloniaXamlLoader.Load(this);
#region Control getter and event binding
@@ -48,58 +43,54 @@ namespace Material.Demo
LeftDrawer = this.Get<NavigationDrawer>(nameof(LeftDrawer));
#endregion
}
private void DrawerList_KeyUp(object sender, KeyEventArgs e)
{
private void DrawerList_KeyUp(object sender, KeyEventArgs e) {
if (e.Key == Key.Space || e.Key == Key.Enter)
DrawerSelectionChanged(sender, null);
}
public void DrawerSelectionChanged(object sender, RoutedEventArgs? args)
{
public void DrawerSelectionChanged(object sender, RoutedEventArgs? args) {
if (sender is not ListBox listBox)
return;
if (!listBox.IsFocused && !listBox.IsKeyboardFocusWithin)
return;
try
{
try {
PageCarousel.SelectedIndex = listBox.SelectedIndex;
mainScroller.Offset = Vector.Zero;
mainScroller.VerticalScrollBarVisibility =
listBox.SelectedIndex == 5 ? ScrollBarVisibility.Disabled : ScrollBarVisibility.Auto;
}
catch
{
catch {
// ignored
}
LeftDrawer.OptionalCloseLeftDrawer();
}
private void TemplatedControl_OnTemplateApplied(object? sender, TemplateAppliedEventArgs e)
{
private void TemplatedControl_OnTemplateApplied(object? sender, TemplateAppliedEventArgs e) {
SnackbarHost.Post("Welcome to demo of Material.Avalonia!");
}
private readonly List<SnackbarModel> helloSnackBars = new();
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
{
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
var helloSnackBar = new SnackbarModel("Hello, user!", TimeSpan.Zero);
SnackbarHost.Post(helloSnackBar);
helloSnackBars.Add(helloSnackBar);
}
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
{
foreach (var snackbarModel in helloSnackBars)
{
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
foreach (var snackbarModel in helloSnackBars) {
SnackbarHost.Remove(snackbarModel);
}
SnackbarHost.Post("See ya next time, user!");
}
private void MaterialIcon_OnPointerPressed(object? sender, PointerPressedEventArgs e) {
var materialTheme = Application.Current.LocateMaterialTheme<MaterialTheme>();
materialTheme.BaseTheme = materialTheme.BaseTheme == BaseThemeMode.Light ? BaseThemeMode.Dark : BaseThemeMode.Light;
}
}
}
}
+8 -9
View File
@@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
<PackageReference Include="Material.Icons.Avalonia" Version="1.0.2" />
<PackageReference Include="ShowMeTheXaml.Avalonia.Generator" Version="1.1.0" />
<PackageReference Include="DialogHost.Avalonia" Version="0.6.0-rc1" />
<PackageReference Include="Avalonia" Version="0.10.18"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18"/>
<PackageReference Include="Avalonia.Desktop" Version="0.10.18"/>
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18"/>
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10"/>
<PackageReference Include="ShowMeTheXaml.Avalonia.Generator" Version="1.2.0"/>
<PackageReference Include="DialogHost.Avalonia" Version="0.6.0-rc1"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Material.Avalonia\Material.Avalonia.csproj" />
+2 -3
View File
@@ -3,7 +3,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Class="Material.Demo.Pages.TreeViewsDemo">
@@ -30,7 +29,7 @@
<TreeViewItem>
<TreeViewItem.Header>
<Grid ColumnDefinitions="Auto, 8, *">
<avalonia:MaterialIcon Kind="DesktopMac" />
<avalonia:MaterialIcon Kind="Apple" />
<TextBlock Text="Apple MacOS" Grid.Column="2" />
</Grid>
</TreeViewItem.Header>
@@ -127,4 +126,4 @@
</controls:Card>
</WrapPanel>
</StackPanel>
</UserControl>
</UserControl>
+2 -2
View File
@@ -15,8 +15,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -23,7 +23,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
</ItemGroup>
</Project>
+7 -3
View File
@@ -50,12 +50,16 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Material.Colors\Material.Colors.csproj" />
<ProjectReference Include="..\Material.Ripple\Material.Ripple.csproj" />
<ProjectReference Include="..\Material.Colors\Material.Colors.csproj" PrivateAssets="all" />
<ProjectReference Include="..\Material.Ripple\Material.Ripple.csproj" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Teronis.MSBuild.Packaging.ProjectBuildInPackage" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
+7 -5
View File
@@ -29,6 +29,8 @@ public static class SystemThemeProbe {
[DllImport("advapi32.dll", EntryPoint = "RegQueryValueEx")]
private static extern int RegQueryValueEx_DllImport(UIntPtr hKey, string lpValueName, int lpReserved, out uint lpType, byte[] lpData, ref int lpcbData);
private static readonly UIntPtr HKEY_CURRENT_USER = (UIntPtr)0x80000001;
private static readonly string REGISTRY_THEME_ENTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
private static readonly string REGISTRY_THEME_ENTRY_KEY = "AppsUseLightTheme";
/// <summary>
/// Retrieving windows base theme from registry
@@ -45,11 +47,11 @@ public static class SystemThemeProbe {
var infoBytes = new byte[infoDataLength];
// I implemented it via P/Invoke cuz i dont want to see additional package reference to Microsoft.Win32.Registry in Material.Avalonia
var o0 = RegOpenKeyEx_DllImport(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, 0x1, out var hKeyVal);
if (o0 != 0) throw new Exception("Something went wrong when opening \"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize\" registry entry");
var o1 = RegQueryValueEx_DllImport(hKeyVal, "AppsUseLightTheme", 0, out _, infoBytes, ref infoDataLength);
if (o1 != 0) throw new Exception("Something went wrong when reading \"AppsUseLightTheme\" registry entry value");
var o0 = RegOpenKeyEx_DllImport(HKEY_CURRENT_USER, REGISTRY_THEME_ENTRY_PATH, 0, 0x1, out var hKeyVal);
if (o0 != 0) throw new Exception($"Something went wrong when opening \"{REGISTRY_THEME_ENTRY_PATH}\" registry entry");
var o1 = RegQueryValueEx_DllImport(hKeyVal, REGISTRY_THEME_ENTRY_KEY, 0, out _, infoBytes, ref infoDataLength);
if (o1 != 0) throw new Exception($"Something went wrong when reading \"{REGISTRY_THEME_ENTRY_KEY}\" registry entry value");
return BitConverter.ToBoolean(infoBytes, 0) ? BaseThemeMode.Dark : BaseThemeMode.Light;
return BitConverter.ToBoolean(infoBytes, 0) ? BaseThemeMode.Light : BaseThemeMode.Dark;
}
}
-7
View File
@@ -1,7 +0,0 @@
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?
@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
-69
View File
@@ -1,69 +0,0 @@
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
# CONFIGURATION
###########################################################################
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
###########################################################################
# EXECUTION
###########################################################################
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}
# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
-62
View File
@@ -1,62 +0,0 @@
#!/usr/bin/env bash
bash --version 2>&1 | head -n 1
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="Current"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
###########################################################################
# EXECUTION
###########################################################################
function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
else
# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"
# If global.json exists, load expected version
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
if [[ "$DOTNET_VERSION" == "" ]]; then
unset DOTNET_VERSION
fi
fi
# Install by channel or version
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
if [[ -z ${DOTNET_VERSION+x} ]]; then
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
fi
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
-11
View File
@@ -1,11 +0,0 @@
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
-64
View File
@@ -1,64 +0,0 @@
using System;
using Nuke.Common;
using Nuke.Common.Tools.DotNet;
using Numerge;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
partial class Build : NukeBuild {
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Compile);
protected Target Clean => _ => _
.Executes(() =>
{
Parameters.BuildDirs.ForEach(DeleteDirectory);
Parameters.BuildDirs.ForEach(EnsureCleanDirectory);
EnsureCleanDirectory(Parameters.ArtifactsDir);
EnsureCleanDirectory(Parameters.NugetIntermediateRoot);
EnsureCleanDirectory(Parameters.NugetRoot);
EnsureCleanDirectory(Parameters.ZipRoot);
});
protected Target Compile => _ => _
.DependsOn(Clean)
.Executes(() =>
{
DotNetBuild(settings => ApplySetting(settings, buildSettings =>
buildSettings.SetProjectFile(Parameters.MSBuildSolution)));
});
protected Target CreateIntermediateNugetPackages => _ => _
.DependsOn(Compile)
.Executes(() =>
{
DotNetPack(settings => ApplySetting(settings, packSettings =>
packSettings.SetProject(Parameters.MSBuildSolution)
.SetOutputDirectory(Parameters.NugetIntermediateRoot))
);
});
protected Target CreateNugetPackage => _ => _
.DependsOn(CreateIntermediateNugetPackages)
.Produces(RootDirectory / "Material.Avalonia" / "bin" / "artifacts" / "nuget")
.Executes(() =>
{
var config = MergeConfiguration.LoadFile(RootDirectory / "build" / "numerge.config");
EnsureCleanDirectory(Parameters.NugetRoot);
if (!NugetPackageMerger.Merge(Parameters.NugetIntermediateRoot, Parameters.NugetRoot,
config, new NumergeNukeLogger()))
throw new Exception("Package merge failed");
});
protected Target ZipFiles => _ => _
.After(CreateNugetPackage, Compile)
.Executes(() =>
{
var data = Parameters;
Zip(data.ZipNuGetArtifacts, data.NugetRoot);
});
}
-160
View File
@@ -1,160 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Nuke.Common;
using Nuke.Common.CI.AzurePipelines;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using Serilog;
partial class Build {
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Parameter("version")]
public string Version { get; set; }
protected BuildParameters Parameters { get; set; }
[Solution(GenerateProjects = true)]
readonly Solution Solution;
protected override void OnBuildInitialized() {
Parameters = new BuildParameters(this);
Log.Information("Building version {0} of Material.Avalonia ({1}) using version {2} of Nuke.",
Parameters.Version,
Parameters.Configuration,
typeof(NukeBuild).Assembly.GetName().Version.ToString());
if (Parameters.IsLocalBuild) {
Log.Information("Repository Name: " + Parameters.RepositoryName);
Log.Information("Repository Branch: " + Parameters.RepositoryBranch);
}
Log.Information("Configuration: " + Parameters.Configuration);
Log.Information("IsLocalBuild: " + Parameters.IsLocalBuild);
Log.Information("IsRunningOnUnix: " + Parameters.IsRunningOnUnix);
Log.Information("IsRunningOnWindows: " + Parameters.IsRunningOnWindows);
Log.Information("IsRunningOnAzure: " + Parameters.IsRunningOnGithubActions);
Log.Information("IsPullRequest: " + Parameters.IsPullRequest);
Log.Information("IsMainRepo: " + Parameters.IsMainRepo);
Log.Information("IsMasterBranch: " + Parameters.IsNightlyRelease);
Log.Information("IsReleaseBranch: " + Parameters.IsReleaseBranch);
Log.Information("IsReleasable: " + Parameters.IsReleasable);
Log.Information("IsNuGetRelease: " + Parameters.IsNuGetRelease);
void ExecWait(string preamble, string command, string args) {
Console.WriteLine(preamble);
Process.Start(new ProcessStartInfo(command, args) { UseShellExecute = false }).WaitForExit();
}
ExecWait("dotnet version:", "dotnet", "--info");
ExecWait("dotnet workloads:", "dotnet", "workload list");
Log.Information("Processor count: " + Environment.ProcessorCount);
Log.Information("Available RAM: " + GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 0x100000 + "MB");
}
DotNetConfigHelper ApplySettingCore(DotNetConfigHelper c) {
c.AddProperty("PackageVersion", Parameters.Version)
.SetConfiguration(Parameters.Configuration)
.SetVerbosity(DotNetVerbosity.Minimal);
return c;
}
DotNetBuildSettings ApplySetting(DotNetBuildSettings c, Configure<DotNetBuildSettings> configurator = null) =>
ApplySettingCore(c).Build.Apply(configurator);
DotNetPackSettings ApplySetting(DotNetPackSettings c, Configure<DotNetPackSettings> configurator = null) =>
ApplySettingCore(c).Pack.Apply(configurator);
public class BuildParameters {
public string Configuration { get; }
public string MainRepo { get; }
public string NightlyAvailableBranch { get; }
public string RepositoryName { get; }
public string RepositoryBranch { get; }
public string ReleaseConfiguration { get; }
public string ReleaseBranchPrefix { get; }
public string MSBuildSolution { get; }
public string CommitMessage { get; }
public bool IsLocalBuild { get; }
public bool IsRunningOnUnix { get; }
public bool IsRunningOnWindows { get; }
public bool IsRunningOnGithubActions { get; }
public bool IsPullRequest { get; }
public bool IsMainRepo { get; }
public bool IsNightlyRelease { get; }
public bool IsReleaseBranch { get; }
public bool IsReleasable { get; }
public bool IsNuGetRelease { get; }
public bool PublishTestResults { get; }
public string Version { get; }
public AbsolutePath ArtifactsDir { get; }
public AbsolutePath NugetIntermediateRoot { get; }
public AbsolutePath NugetRoot { get; }
public AbsolutePath ZipRoot { get; }
public string DirSuffix { get; }
public List<AbsolutePath> BuildDirs { get; }
public string FileZipSuffix { get; }
public AbsolutePath ZipNuGetArtifacts { get; }
public BuildParameters(Build b) {
// ARGUMENTS
Configuration = b.Configuration ?? "Release";
// CONFIGURATION
MainRepo = "https://github.com/AvaloniaCommunity/Material.Avalonia";
NightlyAvailableBranch = "refs/heads/dev";
ReleaseBranchPrefix = "refs/heads/release/";
ReleaseConfiguration = "Release";
MSBuildSolution = RootDirectory / "Material.Avalonia.sln";
// PARAMETERS
IsLocalBuild = NukeBuild.IsLocalBuild;
IsRunningOnUnix = Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX;
IsRunningOnWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
IsRunningOnGithubActions = Host is GitHubActions;
if (IsRunningOnGithubActions) {
RepositoryName = GitHubActions.Instance.ServerUrl + GitHubActions.Instance.Repository;
RepositoryBranch = GitHubActions.Instance.Ref;
IsPullRequest = GitHubActions.Instance.Ref.StartsWith("refs/pull", StringComparison.OrdinalIgnoreCase);
CommitMessage = GitHubActions.Instance.GitHubEvent["head_commit"]!.Value<string>("message");
}
IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, RepositoryName);
IsNightlyRelease = IsMainRepo
&& RepositoryBranch?.StartsWith(NightlyAvailableBranch, StringComparison.OrdinalIgnoreCase) == true
&& !CommitMessage.Contains("no nightly");
IsReleaseBranch = RepositoryBranch?.StartsWith(ReleaseBranchPrefix, StringComparison.OrdinalIgnoreCase) == true;
IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration);
IsNuGetRelease = IsMainRepo && IsReleasable && IsReleaseBranch;
// VERSION
Version = b.Version ?? b.Solution.Material_Avalonia.GetProperty(nameof(Version));
if (IsRunningOnGithubActions) {
if (IsNightlyRelease) {
// Use AssemblyVersion with Build as version
Version += "." + GitHubActions.Instance.RunNumber + "-nightly";
}
PublishTestResults = true;
}
// DIRECTORIES
ArtifactsDir = RootDirectory / "Material.Avalonia" / "bin" / "artifacts";
NugetRoot = ArtifactsDir / "nuget";
NugetIntermediateRoot = RootDirectory / "Material.Avalonia" / "bin" / "build-intermediate" / "nuget";
ZipRoot = ArtifactsDir / "zip";
BuildDirs = RootDirectory.GlobDirectories(RootDirectory, "**bin").Concat(RootDirectory.GlobDirectories("**obj")).ToList();
DirSuffix = Configuration;
FileZipSuffix = Version + ".zip";
ZipNuGetArtifacts = ZipRoot / ("Material.Avalonia-NuGet-" + FileZipSuffix);
}
}
}
-16
View File
@@ -1,16 +0,0 @@
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;
[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
public static Configuration Release = new Configuration { Value = nameof(Release) };
public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
}
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.props file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.targets file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>
-57
View File
@@ -1,57 +0,0 @@
using System.Globalization;
using JetBrains.Annotations;
using Nuke.Common.Tools.DotNet;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
public class DotNetConfigHelper
{
public DotNetBuildSettings Build;
public DotNetPackSettings Pack;
public DotNetTestSettings Test;
public DotNetConfigHelper(DotNetBuildSettings s)
{
Build = s;
}
public DotNetConfigHelper(DotNetPackSettings s)
{
Pack = s;
}
public DotNetConfigHelper(DotNetTestSettings s)
{
Test = s;
}
public DotNetConfigHelper AddProperty(string key, bool value) =>
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
public DotNetConfigHelper AddProperty(string key, string value)
{
Build = Build?.AddProperty(key, value);
Pack = Pack?.AddProperty(key, value);
Test = Test?.AddProperty(key, value);
return this;
}
public DotNetConfigHelper SetConfiguration(string configuration)
{
Build = Build?.SetConfiguration(configuration);
Pack = Pack?.SetConfiguration(configuration);
Test = Test?.SetConfiguration(configuration);
return this;
}
public DotNetConfigHelper SetVerbosity(DotNetVerbosity verbosity)
{
Build = Build?.SetVerbosity(verbosity);
Pack = Pack?.SetVerbosity(verbosity);
Test = Test?.SetVerbosity(verbosity);
return this;
}
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s);
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s);
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s);
}
-49
View File
@@ -1,49 +0,0 @@
using Nuke.Common;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Tools.DotNet;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.Xunit.XunitTasks;
using static Nuke.Common.Tools.VSWhere.VSWhereTasks;
/// <summary>
/// Representing targets for github pipeline for main repository
/// </summary>
[GitHubActions("main", GitHubActionsImage.UbuntuLatest, AutoGenerate = true, Submodules = GitHubActionsSubmodules.Recursive,
InvokedTargets = new[] { nameof(Compile), nameof(PublishNugetPackage) },
ImportSecrets = new[] { nameof(NuGetKey) }, EnableGitHubToken = true,
On = new[] {
GitHubActionsTrigger.Push,
GitHubActionsTrigger.PullRequest
})]
partial class Build {
[Parameter] [Secret] readonly string NuGetKey;
/// <summary>
/// Publishing artifacts for main Material.Avalonia repo
/// </summary>
Target PublishNugetPackage => _ => _
.Unlisted()
.DependsOn(CreateNugetPackage)
.OnlyWhenStatic(() => IsServerBuild)
.OnlyWhenDynamic(
() => Parameters.IsMainRepo,
() => Parameters.IsReleasable)
.Executes(() =>
{
GitHubActions.Instance.Token.NotNullOrEmpty("Github token should be not null or empty to publish packages");
DotNetNuGetPush(settings => settings
.SetSource("https://nuget.pkg.github.com/AvaloniaCommunity/index.json")
.SetApiKey(GitHubActions.Instance.Token)
.EnableSkipDuplicate());
NuGetKey.NotNullOrEmpty("NuGet api key should be not null or empty to publish packages");
DotNetNuGetPush(settings => settings
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(NuGetKey)
.EnableSkipDuplicate());
});
}
Submodule build/Numerge deleted from fb92f917cd
-11
View File
@@ -1,11 +0,0 @@
using Numerge;
class NumergeNukeLogger : INumergeLogger {
public void Log(NumergeLogLevel level, string message) {
if (level == NumergeLogLevel.Error)
Serilog.Log.Error(message);
else if (level == NumergeLogLevel.Warning)
Serilog.Log.Warning(message);
else
Serilog.Log.Information(message);
}
}
-53
View File
@@ -1,53 +0,0 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using Nuke.Common.IO;
partial class Build {
private void Zip(AbsolutePath target, params string[] paths) => Zip(target, paths.AsEnumerable());
private void Zip(AbsolutePath target, IEnumerable<string> paths) {
var targetPath = target.ToString();
bool finished = false, atLeastOneFileAdded = false;
try {
using (var targetStream = File.Create(targetPath))
using (var archive = new System.IO.Compression.ZipArchive(targetStream, ZipArchiveMode.Create)) {
void AddFile(string path, string relativePath) {
var e = archive.CreateEntry(relativePath.Replace("\\", "/"), CompressionLevel.Optimal);
using (var entryStream = e.Open())
using (var fileStream = File.OpenRead(path))
fileStream.CopyTo(entryStream);
atLeastOneFileAdded = true;
}
foreach (var path in paths) {
if (Directory.Exists(path)) {
var dirInfo = new DirectoryInfo(path);
var rootPath = Path.GetDirectoryName(dirInfo.FullName);
foreach (var fsEntry in dirInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories)) {
if (fsEntry is FileInfo) {
var relPath = Path.GetRelativePath(rootPath, fsEntry.FullName);
AddFile(fsEntry.FullName, relPath);
}
}
}
else if (File.Exists(path)) {
var name = Path.GetFileName(path);
AddFile(path, name);
}
}
}
finished = true;
}
finally {
try {
if (!finished || !atLeastOneFileAdded)
File.Delete(targetPath);
}
catch {
//Ignore
}
}
}
}
-22
View File
@@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.2.1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Numerge/**/*.*" />
<Compile Include="Numerge/Numerge/**/*.cs" />
</ItemGroup>
</Project>
-27
View File
@@ -1,27 +0,0 @@
<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/CodeInspection/Highlighting/InspectionSeverities/=HeapView_002EDelegateAllocation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>