From 92ef4de0d21974266c359155991c8b3b82bd16e8 Mon Sep 17 00:00:00 2001 From: Lukas Kurz Date: Wed, 3 Apr 2024 23:03:06 +0200 Subject: [PATCH] Cross-Platform Compilation (#142) --- .github/workflows/codeql.yml | 9 +- .github/workflows/test.yml | 2 +- .../Serialization/ValueSet.Schema.cs | 107 ++++++++++++++++++ .../{ValueSet.bond => ValueSet.bond.txt} | 0 4 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.Schema.cs rename lib/ShortDev.Microsoft.ConnectedDevices/Serialization/{ValueSet.bond => ValueSet.bond.txt} (100%) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7817f7..d2be1b0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,18 +24,18 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'true' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: 'microsoft' java-version: '11' @@ -44,7 +44,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: '8.0.x' - include-prerelease: true - name: Install Workloads run: | @@ -54,6 +53,6 @@ jobs: run: dotnet build src -c Debug --interactive /p:EnforceCodeStyleInBuild=true /p:AnalysisLevel=latest-all - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8bee494..4327786 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: jobs: cdp: name: ShortDev.Microsoft.ConnectedDevices.Test - runs-on: windows-latest + runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.Schema.cs b/lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.Schema.cs new file mode 100644 index 0000000..a4bd760 --- /dev/null +++ b/lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.Schema.cs @@ -0,0 +1,107 @@ +// + +namespace ShortDev.Microsoft.ConnectedDevices.Serialization; + +public enum PropertyType +{ + PropertyType_Empty = unchecked((int)0), + PropertyType_Int32 = unchecked((int)4), + PropertyType_UInt32 = unchecked((int)5), + PropertyType_UInt64 = unchecked((int)7), + PropertyType_String = unchecked((int)39), + PropertyType_GuidArray = unchecked((int)15), + PropertyType_UInt8Array = unchecked((int)20), + PropertyType_UInt32Array = unchecked((int)24), + PropertyType_UInt64Array = unchecked((int)26), + PropertyType_StringArray = unchecked((int)40), +} + +[global::Bond.Schema] +public partial class UUID +{ + [global::Bond.Id(0)] + public uint Data1 { get; set; } + + [global::Bond.Id(1)] + public ushort Data2 { get; set; } + + [global::Bond.Id(2)] + public ushort Data3 { get; set; } + + [global::Bond.Id(3)] + public ulong Data4 { get; set; } + + public UUID() + : this("ShortDev.Microsoft.ConnectedDevices.Serialization.UUID", "UUID") + { } + + protected UUID(string fullName, string name) + { + + } +} + +[global::Bond.Schema] +public partial class PropertyValue +{ + [global::Bond.Id(0), global::Bond.Required] + public PropertyType Type { get; set; } + + [global::Bond.Id(103)] + public int Int32Value { get; set; } + + [global::Bond.Id(104)] + public uint UInt32Value { get; set; } + + [global::Bond.Id(106)] + public ulong UInt64Value { get; set; } + + [global::Bond.Id(114)] + public List GuidArrayValue { get; set; } + + [global::Bond.Id(119)] + public string StringValue { get; set; } + + [global::Bond.Id(200)] + public List UInt8ArrayValue { get; set; } + + [global::Bond.Id(204)] + public List UInt32ArrayValue { get; set; } + + [global::Bond.Id(206)] + public List UInt64ArrayValue { get; set; } + + [global::Bond.Id(219)] + public List StringArrayValue { get; set; } + + public PropertyValue() + : this("ShortDev.Microsoft.ConnectedDevices.Serialization.PropertyValue", "PropertyValue") + { } + + protected PropertyValue(string fullName, string name) + { + Type = PropertyType.PropertyType_Empty; + GuidArrayValue = new List(); + StringValue = ""; + UInt8ArrayValue = new List(); + UInt32ArrayValue = new List(); + UInt64ArrayValue = new List(); + StringArrayValue = new List(); + } +} + +[global::Bond.Schema] +public partial class ValueSet +{ + [global::Bond.Id(1), global::Bond.Type(typeof(Dictionary))] + public Dictionary Entries { get; set; } + + public ValueSet() + : this("ShortDev.Microsoft.ConnectedDevices.Serialization.ValueSet", "ValueSet") + { } + + protected ValueSet(string fullName, string name) + { + Entries = new Dictionary(); + } +} diff --git a/lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.bond b/lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.bond.txt similarity index 100% rename from lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.bond rename to lib/ShortDev.Microsoft.ConnectedDevices/Serialization/ValueSet.bond.txt