Skip to content

Commit

Permalink
Merge branch 'main' into release-test/messaging-mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 18, 2024
2 parents f906d60 + 7d6b071 commit 78cb8f7
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 62 deletions.
4 changes: 2 additions & 2 deletions mk/xamarin-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ if test -d "$DEPENDENCY_PATH"; then
fi

else
echo "*** [$DEPENDENCY_NAME] git $DEPENDENCY_AUTH clone $DEPENDENCY_MODULE --recursive $DEPENDENCY_DIRECTORY -b $DEPENDENCY_BRANCH --origin $DEPENDENCY_REMOTE"
echo "*** [$DEPENDENCY_NAME] git" "${DEPENDENCY_AUTH[@]}" "clone $DEPENDENCY_MODULE --recursive $DEPENDENCY_DIRECTORY -b $DEPENDENCY_BRANCH --origin $DEPENDENCY_REMOTE"
mkdir -p "$(dirname "$DEPENDENCY_PATH")"
cd "$(dirname "$DEPENDENCY_PATH")"
git $DEPENDANCY_AUTH clone "$DEPENDENCY_MODULE" --recursive "$DEPENDENCY_DIRECTORY" -b "$DEPENDENCY_BRANCH" --origin "$DEPENDENCY_REMOTE"
git "$DEPENDENCY_AUTH" "$DEPENDENCY_MODULE" --recursive "$DEPENDENCY_DIRECTORY" -b "$DEPENDENCY_BRANCH" --origin "$DEPENDENCY_REMOTE"
cd "$DEPENDENCY_DIRECTORY"
fi

Expand Down
2 changes: 1 addition & 1 deletion src/rgen/Microsoft.Macios.Generator/DataModel/Accessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public bool Equals (Accessor other)
var attrsComparer = new AttributesEqualityComparer ();
if (!attrsComparer.Equals (Attributes, other.Attributes))
return false;
var modifiersComparer = new ModifiersComparer ();
var modifiersComparer = new ModifiersEqualityComparer ();
return modifiersComparer.Equals (Modifiers, other.Modifiers);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

namespace Microsoft.Macios.Generator.DataModel;

class AccessorsEqualityComparer : IEqualityComparer<ImmutableArray<Accessor>> {
public bool Equals (ImmutableArray<Accessor> x, ImmutableArray<Accessor> y)
class AccessorsEqualityComparer : EqualityComparer<ImmutableArray<Accessor>> {
public override bool Equals (ImmutableArray<Accessor> x, ImmutableArray<Accessor> y)
{
// property accessor kinds cannot be duplicated due to the definition of the language, create two dictionaries
// using the kind as a key and then re-use our dictionary comparer
Expand All @@ -16,7 +16,7 @@ public bool Equals (ImmutableArray<Accessor> x, ImmutableArray<Accessor> y)
return comparer.Equals (xDictionary, yDictionary);
}

public int GetHashCode (ImmutableArray<Accessor> obj)
public override int GetHashCode (ImmutableArray<Accessor> obj)
{
var hashCode = new HashCode ();
foreach (var accessor in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public int Compare (AttributeCodeChange x, AttributeCodeChange y)
return 0;
}
}
class AttributesEqualityComparer : IEqualityComparer<ImmutableArray<AttributeCodeChange>> {
class AttributesEqualityComparer : EqualityComparer<ImmutableArray<AttributeCodeChange>> {

public bool Equals (ImmutableArray<AttributeCodeChange> x, ImmutableArray<AttributeCodeChange> y)
public override bool Equals (ImmutableArray<AttributeCodeChange> x, ImmutableArray<AttributeCodeChange> y)
{
if (x.Length != y.Length)
return false;
Expand All @@ -46,7 +46,7 @@ public bool Equals (ImmutableArray<AttributeCodeChange> x, ImmutableArray<Attrib
return true;
}

public int GetHashCode (ImmutableArray<AttributeCodeChange> obj)
public override int GetHashCode (ImmutableArray<AttributeCodeChange> obj)
{
var hash = new HashCode ();
foreach (var change in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@

namespace Microsoft.Macios.Generator.DataModel;

class DeclarationCodeChangesEqualityComparer : IEqualityComparer<(BaseTypeDeclarationSyntax Declaration, CodeChanges
class DeclarationCodeChangesEqualityComparer : EqualityComparer<(BaseTypeDeclarationSyntax Declaration, CodeChanges
Changes)> {
readonly CodeChangesEqualityComparer comparer = new ();

public bool Equals ((BaseTypeDeclarationSyntax Declaration, CodeChanges Changes) x,
/// <inheritdoc/>
public override bool Equals ((BaseTypeDeclarationSyntax Declaration, CodeChanges Changes) x,
(BaseTypeDeclarationSyntax Declaration, CodeChanges Changes) y)
{
return comparer.Equals (x.Changes, y.Changes);
}

public int GetHashCode ((BaseTypeDeclarationSyntax Declaration, CodeChanges Changes) obj)
/// <inheritdoc/>
public override int GetHashCode ((BaseTypeDeclarationSyntax Declaration, CodeChanges Changes) obj)
=> comparer.GetHashCode (obj.Changes);
}

/// <summary>
/// Custom code changes comparer used for the Roslyn code generation to invalidate caching.
/// </summary>
class CodeChangesEqualityComparer : IEqualityComparer<CodeChanges> {
class CodeChangesEqualityComparer : EqualityComparer<CodeChanges> {
/// <inheritdoc />
public bool Equals (CodeChanges x, CodeChanges y)
public override bool Equals (CodeChanges x, CodeChanges y)
{
// things that mean a code change is the same:
// - the fully qualified symbol is the same
Expand Down Expand Up @@ -74,7 +76,7 @@ public bool Equals (CodeChanges x, CodeChanges y)
}

/// <inheritdoc />
public int GetHashCode (CodeChanges obj)
public override int GetHashCode (CodeChanges obj)
{
return HashCode.Combine (obj.FullyQualifiedSymbol, obj.EnumMembers);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public bool Equals (Constructor other)
var attrsComparer = new AttributesEqualityComparer ();
if (!attrsComparer.Equals (Attributes, other.Attributes))
return false;
var modifiersComparer = new ModifiersComparer ();
var modifiersComparer = new ModifiersEqualityComparer ();
if (!modifiersComparer.Equals (Modifiers, other.Modifiers))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

namespace Microsoft.Macios.Generator.DataModel;

class ConstructorsEqualityComparer : IEqualityComparer<ImmutableArray<Constructor>> {
public bool Equals (ImmutableArray<Constructor> x, ImmutableArray<Constructor> y)
class ConstructorsEqualityComparer : EqualityComparer<ImmutableArray<Constructor>> {
/// <inheritdoc/>
public override bool Equals (ImmutableArray<Constructor> x, ImmutableArray<Constructor> y)
{
// group the constructors based on the number of parameters. We create two dictionaries, that will have
// the number of params as the key, and a list of constructors as the value
Expand All @@ -19,7 +20,8 @@ public bool Equals (ImmutableArray<Constructor> x, ImmutableArray<Constructor> y
return dictionaryComparer.Equals (xConstructors, yConstructors);
}

public int GetHashCode (ImmutableArray<Constructor> obj)
/// <inheritdoc/>
public override int GetHashCode (ImmutableArray<Constructor> obj)
{
var hashCode = new HashCode ();
foreach (var ctr in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

namespace Microsoft.Macios.Generator.DataModel;

class EnumMembersEqualityComparer : IEqualityComparer<ImmutableArray<EnumMember>> {
class EnumMembersEqualityComparer : EqualityComparer<ImmutableArray<EnumMember>> {

public bool Equals (ImmutableArray<EnumMember> x, ImmutableArray<EnumMember> y)
/// <inheritdoc/>
public override bool Equals (ImmutableArray<EnumMember> x, ImmutableArray<EnumMember> y)
{
if (x.Length != y.Length)
return false;
Expand All @@ -20,7 +21,8 @@ public bool Equals (ImmutableArray<EnumMember> x, ImmutableArray<EnumMember> y)
return true;
}

public int GetHashCode (ImmutableArray<EnumMember> obj)
/// <inheritdoc/>
public override int GetHashCode (ImmutableArray<EnumMember> obj)
{
var hash = new HashCode ();
foreach (var change in obj) {
Expand Down
2 changes: 1 addition & 1 deletion src/rgen/Microsoft.Macios.Generator/DataModel/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public bool Equals (Event other)
if (!attrsComparer.Equals (Attributes, other.Attributes))
return false;

var modifiersComparer = new ModifiersComparer ();
var modifiersComparer = new ModifiersEqualityComparer ();
if (!modifiersComparer.Equals (Modifiers, other.Modifiers))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

namespace Microsoft.Macios.Generator.DataModel;

class EventEqualityComparer : IEqualityComparer<ImmutableArray<Event>> {
class EventEqualityComparer : EqualityComparer<ImmutableArray<Event>> {

public bool Equals (ImmutableArray<Event> x, ImmutableArray<Event> y)
/// <inheritdoc/>
public override bool Equals (ImmutableArray<Event> x, ImmutableArray<Event> y)
{
// properties are unique by their name, that means that we can build two dicts and comparethem
var xDictionary = Enumerable.ToDictionary (x, property => property.Name);
Expand All @@ -17,7 +18,8 @@ public bool Equals (ImmutableArray<Event> x, ImmutableArray<Event> y)
return comparer.Equals (xDictionary, yDictionary);
}

public int GetHashCode (ImmutableArray<Event> obj)
/// <inheritdoc/>
public override int GetHashCode (ImmutableArray<Event> obj)
{
var hash = new HashCode ();
foreach (var property in obj) {
Expand Down
2 changes: 1 addition & 1 deletion src/rgen/Microsoft.Macios.Generator/DataModel/Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public bool Equals (Method other)
var attrsComparer = new AttributesEqualityComparer ();
if (!attrsComparer.Equals (Attributes, other.Attributes))
return false;
var modifiersComparer = new ModifiersComparer ();
var modifiersComparer = new ModifiersEqualityComparer ();
if (!modifiersComparer.Equals (Modifiers, other.Modifiers))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Microsoft.Macios.Generator.DataModel;

class MethodsEqualityComparer : IEqualityComparer<ImmutableArray<Method>> {
class MethodsEqualityComparer : EqualityComparer<ImmutableArray<Method>> {
/// <inheritdoc/>
public bool Equals (ImmutableArray<Method> x, ImmutableArray<Method> y)
public override bool Equals (ImmutableArray<Method> x, ImmutableArray<Method> y)
{
// to compare two lists, we need to do the following:
// 1. Group all the methods by return type + name + param count, this way we
Expand All @@ -27,7 +27,7 @@ public bool Equals (ImmutableArray<Method> x, ImmutableArray<Method> y)
}

/// <inheritdoc/>
public int GetHashCode (ImmutableArray<Method> obj)
public override int GetHashCode (ImmutableArray<Method> obj)
{
var hashCode = new HashCode ();
foreach (var ctr in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

namespace Microsoft.Macios.Generator.DataModel;

public class ModifiersComparer : IEqualityComparer<ImmutableArray<SyntaxToken>> {
public bool Equals (ImmutableArray<SyntaxToken> x, ImmutableArray<SyntaxToken> y)
public class ModifiersEqualityComparer : EqualityComparer<ImmutableArray<SyntaxToken>> {
/// <inheritdoc/>
public override bool Equals (ImmutableArray<SyntaxToken> x, ImmutableArray<SyntaxToken> y)
{
if (x.Length != y.Length)
return false;
Expand All @@ -21,7 +22,8 @@ public bool Equals (ImmutableArray<SyntaxToken> x, ImmutableArray<SyntaxToken> y
return true;
}

public int GetHashCode (ImmutableArray<SyntaxToken> obj)
/// <inheritdoc/>
public override int GetHashCode (ImmutableArray<SyntaxToken> obj)
{
var hash = new HashCode ();
foreach (var token in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

namespace Microsoft.Macios.Generator.DataModel;

class ParameterEqualityComparer : IEqualityComparer<ImmutableArray<Parameter>> {
class ParameterEqualityComparer : EqualityComparer<ImmutableArray<Parameter>> {

/// <inheritdoc/>
public bool Equals (ImmutableArray<Parameter> x, ImmutableArray<Parameter> y)
public override bool Equals (ImmutableArray<Parameter> x, ImmutableArray<Parameter> y)
{
// we know as a fact that parameter names have to be unique, otherwise we could not
// compile the code. So make sure that all the parameters with the same name are the same
Expand All @@ -20,7 +20,7 @@ public bool Equals (ImmutableArray<Parameter> x, ImmutableArray<Parameter> y)
}

/// <inheritdoc/>
public int GetHashCode (ImmutableArray<Parameter> obj)
public override int GetHashCode (ImmutableArray<Parameter> obj)
{
var hashCode = new HashCode ();
foreach (var constructor in obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

namespace Microsoft.Macios.Generator.DataModel;

class PropertiesEqualityComparer : IEqualityComparer<ImmutableArray<Property>> {
public bool Equals (ImmutableArray<Property> x, ImmutableArray<Property> y)
class PropertiesEqualityComparer : EqualityComparer<ImmutableArray<Property>> {
/// <inheritdoc/>
public override bool Equals (ImmutableArray<Property> x, ImmutableArray<Property> y)
{
// properties are unique by their name, that means that we can build two dicts and comparethem
var xDictionary = Enumerable.ToDictionary (x, property => property.Name);
Expand All @@ -16,7 +17,8 @@ public bool Equals (ImmutableArray<Property> x, ImmutableArray<Property> y)
return comparer.Equals (xDictionary, yDictionary);
}

public int GetHashCode (ImmutableArray<Property> obj)
/// <inheritdoc/>
public override int GetHashCode (ImmutableArray<Property> obj)
{
var hash = new HashCode ();
foreach (var property in obj) {
Expand Down
2 changes: 1 addition & 1 deletion src/rgen/Microsoft.Macios.Generator/DataModel/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public bool Equals (Property other)
if (!attrsComparer.Equals (Attributes, other.Attributes))
return false;

var modifiersComparer = new ModifiersComparer ();
var modifiersComparer = new ModifiersEqualityComparer ();
if (!modifiersComparer.Equals (Modifiers, other.Modifiers))
return false;

Expand Down
8 changes: 5 additions & 3 deletions src/rgen/Microsoft.Macios.Generator/DictionaryComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace Microsoft.Macios.Generator;

public class DictionaryComparer<TKey, TValue> (IEqualityComparer<TValue>? valueComparer = null)
: IEqualityComparer<IDictionary<TKey, TValue>>
: EqualityComparer<IDictionary<TKey, TValue>>
where TKey : notnull {
readonly IEqualityComparer<TValue> valueComparer = valueComparer ?? EqualityComparer<TValue>.Default;

public bool Equals (IDictionary<TKey, TValue>? x, IDictionary<TKey, TValue>? y)
/// <inheritdoc/>
public override bool Equals (IDictionary<TKey, TValue>? x, IDictionary<TKey, TValue>? y)
{
if (x is null && y is null)
return true;
Expand All @@ -24,7 +25,8 @@ public bool Equals (IDictionary<TKey, TValue>? x, IDictionary<TKey, TValue>? y)
return x.All (pair => valueComparer.Equals (pair.Value, y [pair.Key]));
}

public int GetHashCode (IDictionary<TKey, TValue> obj)
/// <inheritdoc/>
public override int GetHashCode (IDictionary<TKey, TValue> obj)
{
var hash = new HashCode ();
foreach (var (key, value) in obj) {
Expand Down
8 changes: 5 additions & 3 deletions src/rgen/Microsoft.Macios.Generator/ListComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.Macios.Generator;

public class ListComparer<T> : IEqualityComparer<List<T>> {
public class ListComparer<T> : EqualityComparer<List<T>> {
readonly IComparer<T> comparer;
readonly IEqualityComparer<T> valueComparer;

Expand All @@ -13,7 +13,8 @@ public ListComparer (IComparer<T> sortComparer, IEqualityComparer<T>? equalityCo
valueComparer = equalityComparer ?? EqualityComparer<T>.Default;
}

public bool Equals (List<T>? x, List<T>? y)
/// <inheritdoc/>
public override bool Equals (List<T>? x, List<T>? y)
{
// bases cases for null or diff size
if (x is null && y is null)
Expand All @@ -37,7 +38,8 @@ public bool Equals (List<T>? x, List<T>? y)
return true;
}

public int GetHashCode (List<T> obj)
/// <inheritdoc/>
public override int GetHashCode (List<T> obj)
{
var hash = new HashCode ();
foreach (var element in obj) {
Expand Down
Loading

9 comments on commit 78cb8f7

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ [CI Build] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ [CI Build] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ [CI Build] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 0 tests failed, 102 tests passed.

Failures

❌ dotnettests tests (macOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_macos (no summary found).

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 7 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 7 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 78cb8f729c225d08ce3f1c73faf065a6469049bc [CI build]

Please sign in to comment.