Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross assembly support #30

Merged
merged 10 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
491 changes: 491 additions & 0 deletions ReactiveGenerator.Tests/CrossAssemblyTests.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: MainLib.DerivedClass.INPC.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
public partial class DerivedClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
PropertyChanged?.Invoke(this, args);
}
}
}

},
{
FileName: MainLib.DerivedClass.ReactiveProperties.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
/// <summary>
/// A partial class implementation for MainLib.DerivedClass.
/// </summary>
public partial class DerivedClass
{
private static readonly PropertyChangedEventArgs _reactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(ReactiveProp));

public partial string ReactiveProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_reactivePropChangedEventArgs);
}
}
}
}
}

},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: MainLib.DerivedClass.INPC.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
public partial class DerivedClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
PropertyChanged?.Invoke(this, args);
}
}
}

},
{
FileName: MainLib.DerivedClass.ReactiveProperties.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
/// <summary>
/// A partial class implementation for MainLib.DerivedClass.
/// </summary>
public partial class DerivedClass
{
private static readonly PropertyChangedEventArgs _derivedPropChangedEventArgs = new PropertyChangedEventArgs(nameof(DerivedProp));

public partial string DerivedProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_derivedPropChangedEventArgs);
}
}
}
}
}

},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: MainLib.DerivedClass.ReactiveProperties.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
/// <summary>
/// A partial class implementation for MainLib.DerivedClass.
/// </summary>
public partial class DerivedClass
{
private static readonly PropertyChangedEventArgs _virtualPropChangedEventArgs = new PropertyChangedEventArgs(nameof(VirtualProp));
private static readonly PropertyChangedEventArgs _derivedPropChangedEventArgs = new PropertyChangedEventArgs(nameof(DerivedProp));

public partial string VirtualProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_virtualPropChangedEventArgs);
}
}
}

public partial string DerivedProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_derivedPropChangedEventArgs);
}
}
}
}
}

},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
Sources: [
{
FileName: IgnoreReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class IgnoreReactiveAttribute : Attribute
{
public IgnoreReactiveAttribute() { }
}
},
{
FileName: MainLib.DerivedClass.ReactiveProperties.g.cs,
Source:
// <auto-generated/>
#nullable enable

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace MainLib
{
/// <summary>
/// A partial class implementation for MainLib.DerivedClass.
/// </summary>
public partial class DerivedClass
{
private static readonly PropertyChangedEventArgs _inheritedReactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(InheritedReactiveProp));
private static readonly PropertyChangedEventArgs _explicitReactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(ExplicitReactiveProp));

public partial string InheritedReactiveProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_inheritedReactivePropChangedEventArgs);
}
}
}

public partial string ExplicitReactiveProp
{
get => field;
set
{
if (!Equals(field, value))
{
field = value;
OnPropertyChanged(_explicitReactivePropChangedEventArgs);
}
}
}
}
}

},
{
FileName: ReactiveAttribute.g.cs,
Source:
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
sealed class ReactiveAttribute : Attribute
{
public ReactiveAttribute() { }
}
}
],
Diagnostics: null
}
Loading
Loading