Skip to content

Commit

Permalink
Fix Global Usings One Per Project (#3648)
Browse files Browse the repository at this point in the history
Issues with a single file where invalid usings exist.

<!-- Please be sure to read the
[Contribute](https://github.com/reactiveui/reactiveui#contribute)
section of the README -->

**What kind of change does this PR introduce?**
<!-- Bug fix, feature, docs update, ... -->

Fix

**What is the current behavior?**
<!-- You can also link to an open issue here. -->

A single GlobalUsing file is used

**What is the new behavior?**
<!-- If this is a feature change -->

Multiple GlobalUsing files are used to remove the issue where usings are
included that are invalid for some projects

**What might this PR break?**

none expected

**Please check if the PR fulfills these requirements**
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

**Other information**:
  • Loading branch information
ChrisPulman committed Oct 30, 2023
1 parent 0a61f2a commit ba197d4
Show file tree
Hide file tree
Showing 113 changed files with 331 additions and 221 deletions.
4 changes: 0 additions & 4 deletions src/Directory.build.props
Expand Up @@ -70,10 +70,6 @@
<None Include="$(MSBuildThisFileDirectory)..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.Contains('Fody')) != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)GlobalUsings.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
Expand Down
16 changes: 16 additions & 0 deletions src/ReactiveUI.AndroidSupport/GlobalUsings.cs
@@ -0,0 +1,16 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Splat;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.ComponentModel;
global using global::System.Diagnostics.CodeAnalysis;
global using global::System.Linq;
global using global::System.Reactive;
global using global::System.Reactive.Linq;
global using global::System.Reactive.Subjects;
global using global::System.Reactive.Threading.Tasks;
global using global::System.Threading.Tasks;
5 changes: 1 addition & 4 deletions src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.App;
using Android.Content;
using Android.Runtime;
Expand Down Expand Up @@ -194,4 +191,4 @@ protected override void Dispose(bool disposing)

base.Dispose(disposing);
}
}
}
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace ReactiveUI.AndroidSupport;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace ReactiveUI.AndroidSupport;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.App;
using Android.Content;
using Android.Support.V4.App;
Expand Down
1 change: 0 additions & 1 deletion src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;

using Android.Support.V4.View;
using Android.Views;
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.Runtime;
using Android.Support.V7.Preferences;

Expand Down
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;

using Android.Support.V7.Widget;
using Android.Views;
Expand Down
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Serialization;

Expand Down
16 changes: 16 additions & 0 deletions src/ReactiveUI.AndroidX/GlobalUsings.cs
@@ -0,0 +1,16 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Splat;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.ComponentModel;
global using global::System.Diagnostics.CodeAnalysis;
global using global::System.Linq;
global using global::System.Reactive;
global using global::System.Reactive.Linq;
global using global::System.Reactive.Subjects;
global using global::System.Reactive.Threading.Tasks;
global using global::System.Threading.Tasks;
5 changes: 1 addition & 4 deletions src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.App;
using Android.Content;
using Android.Runtime;
Expand Down Expand Up @@ -196,4 +193,4 @@ protected override void Dispose(bool disposing)

base.Dispose(disposing);
}
}
}
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace ReactiveUI.AndroidX;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidX/ReactiveFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace ReactiveUI.AndroidX;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.App;
using Android.Content;

Expand Down
1 change: 0 additions & 1 deletion src/ReactiveUI.AndroidX/ReactivePagerAdapter.cs
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;

using Android.Views;

Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.AndroidX/ReactivePreferenceFragment.cs
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

using Android.Runtime;

using AndroidX.Preference;
Expand Down
1 change: 0 additions & 1 deletion src/ReactiveUI.AndroidX/ReactiveRecyclerViewAdapter.cs
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;

using AndroidX.RecyclerView.Widget;

Expand Down
2 changes: 0 additions & 2 deletions src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Serialization;

Expand Down
15 changes: 15 additions & 0 deletions src/ReactiveUI.Blazor/GlobalUsings.cs
@@ -0,0 +1,15 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::System;
global using global::System.Collections.Generic;
global using global::System.ComponentModel;
global using global::System.Diagnostics.CodeAnalysis;
global using global::System.Linq;
global using global::System.Reactive;
global using global::System.Reactive.Concurrency;
global using global::System.Reactive.Disposables;
global using global::System.Reactive.Linq;
global using global::System.Reactive.Subjects;
4 changes: 1 addition & 3 deletions src/ReactiveUI.Blazor/ReactiveComponentBase.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

using Microsoft.AspNetCore.Components;
Expand Down Expand Up @@ -134,4 +132,4 @@ protected virtual void Dispose(bool disposing)
_disposedValue = true;
}
}
}
}
2 changes: 0 additions & 2 deletions src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

using Microsoft.AspNetCore.Components;
Expand Down
1 change: 0 additions & 1 deletion src/ReactiveUI.Blazor/ReactiveLayoutComponentBase.cs
Expand Up @@ -3,7 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

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

using Microsoft.AspNetCore.Components;
Expand Down
7 changes: 7 additions & 0 deletions src/ReactiveUI.Blend/GlobalUsings.cs
@@ -0,0 +1,7 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::System;
global using global::System.Reactive.Linq;
7 changes: 7 additions & 0 deletions src/ReactiveUI.Drawing/GlobalUsings.cs
@@ -0,0 +1,7 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Splat;
global using global::System;
17 changes: 17 additions & 0 deletions src/ReactiveUI.Maui/GlobalUsings.cs
@@ -0,0 +1,17 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Splat;
global using global::System;
global using global::System.ComponentModel;
global using global::System.Linq;
global using global::System.Linq.Expressions;
global using global::System.Reactive;
global using global::System.Reactive.Concurrency;
global using global::System.Reactive.Disposables;
global using global::System.Reactive.Linq;
global using global::System.Reactive.Subjects;
global using global::System.Threading;
global using global::System.Threading.Tasks;
9 changes: 9 additions & 0 deletions src/ReactiveUI.Splat.Tests/GlobalUsings.cs
@@ -0,0 +1,9 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Splat;
global using global::System.Collections.Generic;
global using global::System.Linq;
global using global::System.Reactive.Linq;
11 changes: 11 additions & 0 deletions src/ReactiveUI.Testing.Tests/GlobalUsings.cs
@@ -0,0 +1,11 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::System;
global using global::System.Collections.Generic;
global using global::System.Reactive;
global using global::System.Reactive.Linq;
global using global::System.Reactive.Subjects;
global using global::System.Threading.Tasks;
2 changes: 0 additions & 2 deletions src/ReactiveUI.Testing.Tests/TestFixture.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace ReactiveUI.Testing.Tests
{
/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions src/ReactiveUI.Testing/GlobalUsings.cs
@@ -0,0 +1,12 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::System;
global using global::System.Collections.Generic;
global using global::System.Reactive;
global using global::System.Reactive.Concurrency;
global using global::System.Reactive.Disposables;
global using global::System.Threading;
global using global::System.Threading.Tasks;
4 changes: 0 additions & 4 deletions src/ReactiveUI.Tests/API/ApiApprovalTests.cs
Expand Up @@ -3,12 +3,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

using VerifyXunit;

using Xunit;

namespace ReactiveUI.Tests.API
{
/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/ReactiveUI.Tests/Activation/ActivatingViewModelTests.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Xunit;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs
Expand Up @@ -3,8 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Xunit;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
Expand Up @@ -7,8 +7,6 @@

using ReactiveUI.Tests.Winforms;

using Xunit;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/ReactiveUI.Tests/Activation/ViewModelActivatorTests.cs
Expand Up @@ -5,8 +5,6 @@

using DynamicData;

using Xunit;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
Expand Up @@ -9,8 +9,6 @@

using ReactiveUI.Testing;

using Xunit;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down

0 comments on commit ba197d4

Please sign in to comment.