Skip to content

Commit 5fb13a9

Browse files
Merge branch 'main' into referencedAssemblyNames
2 parents 324fddf + a6ccdaa commit 5fb13a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+717
-484
lines changed

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "0.29.2",
6+
"version": "0.30.6",
77
"commands": [
88
"dotnet-csharpier"
99
],
@@ -17,7 +17,7 @@
1717
"rollForward": false
1818
},
1919
"dotnet-reportgenerator-globaltool": {
20-
"version": "5.3.11",
20+
"version": "5.4.4",
2121
"commands": [
2222
"reportgenerator"
2323
],

.github/workflows/build.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121
- name: Setup .NET
22-
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
22+
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
2323
with:
24-
dotnet-version: 8.0.404
24+
dotnet-version: 9.0.200
2525
- name: Install tools
2626
run: dotnet tool restore
2727
- name: Check formatting
@@ -33,13 +33,13 @@ jobs:
3333
- name: Checkout
3434
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3535
- name: Setup .NET
36-
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
36+
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
3737
with:
38-
dotnet-version: 8.0.404
38+
dotnet-version: 9.0.200
3939
- name: Run tests
4040
run: dotnet test -c Debug --collect:"XPlat Code Coverage" --settings coverlet.runsettings ArchUnitNETTests/
4141
- name: Upload coverage reports to Codecov
42-
uses: codecov/codecov-action@v4.6.0
42+
uses: codecov/codecov-action@v5.3.1
4343
with:
4444
token: ${{ secrets.CODECOV_TOKEN }}
4545
run-tests:
@@ -52,9 +52,9 @@ jobs:
5252
- name: Checkout
5353
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5454
- name: Setup .NET
55-
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
55+
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
5656
with:
57-
dotnet-version: 8.0.404
57+
dotnet-version: 9.0.200
5858
- name: Run tests
5959
run: dotnet test -c Debug
6060
publish-docs:
@@ -138,9 +138,9 @@ jobs:
138138
- name: Checkout
139139
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
140140
- name: Setup .NET
141-
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
141+
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
142142
with:
143-
dotnet-version: 8.0.404
143+
dotnet-version: 9.0.200
144144
- name: Build
145145
run: dotnet build -c Release
146146
- name: Pack

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
- name: Checkout repository
2424
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2525
- name: Initialize CodeQL
26-
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
26+
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
2727
with:
2828
languages: ${{ matrix.language }}
2929
- name: Autobuild
30-
uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
30+
uses: github/codeql-action/autobuild@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
3131
- name: Perform CodeQL Analysis
32-
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
32+
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
3333
with:
3434
category: "/language:${{matrix.language}}"

ArchUnit.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoaderTestAssembly", "TestA
3232
EndProject
3333
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OtherLoaderTestAssembly", "TestAssemblies\OtherLoaderTestAssembly\OtherLoaderTestAssembly.csproj", "{5A24529B-1794-4080-ADCC-77440BA0A0B3}"
3434
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilteredDirectoryLoaderTestAssembly", "TestAssemblies\FilteredDirectoryLoaderTestAssembly\FilteredDirectoryLoaderTestAssembly.csproj", "{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B}"
36+
EndProject
3537
Global
3638
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3739
Debug|Any CPU = Debug|Any CPU
@@ -94,6 +96,10 @@ Global
9496
{5A24529B-1794-4080-ADCC-77440BA0A0B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
9597
{5A24529B-1794-4080-ADCC-77440BA0A0B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
9698
{5A24529B-1794-4080-ADCC-77440BA0A0B3}.Release|Any CPU.Build.0 = Release|Any CPU
99+
{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
100+
{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B}.Debug|Any CPU.Build.0 = Debug|Any CPU
101+
{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B}.Release|Any CPU.ActiveCfg = Release|Any CPU
102+
{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B}.Release|Any CPU.Build.0 = Release|Any CPU
97103
EndGlobalSection
98104
GlobalSection(SolutionProperties) = preSolution
99105
HideSolutionNode = FALSE
@@ -104,5 +110,6 @@ Global
104110
{FBCD91F2-4DB9-44AC-8214-6F2FFF9178D5} = {B1191F18-91CB-4387-B775-A5EB64D3AC30}
105111
{0243F2D4-AC89-4561-A936-D647B6BB821F} = {B1191F18-91CB-4387-B775-A5EB64D3AC30}
106112
{5A24529B-1794-4080-ADCC-77440BA0A0B3} = {B1191F18-91CB-4387-B775-A5EB64D3AC30}
113+
{E6CB8C69-25F5-4C94-8EA3-D56E444EB46B} = {B1191F18-91CB-4387-B775-A5EB64D3AC30}
107114
EndGlobalSection
108115
EndGlobal

ArchUnitNET.MSTestV2Tests/ArchUnitNET.MSTestV2Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<Company>TNG Technology Consulting GmbH</Company>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

ArchUnitNET.NUnitTests/ArchUnitNET.NUnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<Company>TNG Technology Consulting GmbH</Company>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

ArchUnitNET/Domain/Class.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public Class(Class @class)
6969
public bool IsCompilerGenerated => Type.IsCompilerGenerated;
7070
public string Name => Type.Name;
7171
public string FullName => Type.FullName;
72+
public string AssemblyQualifiedName => Type.AssemblyQualifiedName;
7273

7374
public Namespace Namespace => Type.Namespace;
7475
public Assembly Assembly => Type.Assembly;

ArchUnitNET/Domain/Enum.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public Enum(IType type)
2222
public IType Type { get; }
2323
public string Name => Type.Name;
2424
public string FullName => Type.FullName;
25+
public string AssemblyQualifiedName => Type.AssemblyQualifiedName;
2526

2627
[CanBeNull]
2728
public Class BaseClass =>

ArchUnitNET/Domain/Extensions/ArchitectureExtensions.cs

Lines changed: 32 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,16 @@ [NotNull] Type type
5050
return architecture.GetInterfaceOfType(type);
5151
}
5252

53-
try
53+
var foundType = AllTypes(architecture)
54+
.WhereAssemblyQualifiedNameIs(type.AssemblyQualifiedName);
55+
if (foundType != null)
5456
{
55-
var foundType = AllTypes(architecture).WhereFullNameIs(type.FullName);
56-
if (foundType != null)
57-
{
58-
return foundType;
59-
}
60-
61-
throw new TypeDoesNotExistInArchitecture(
62-
$"Type {type.FullName} does not exist in provided architecture."
63-
);
64-
}
65-
catch (MultipleOccurrencesInSequenceException)
66-
{
67-
throw new NotSupportedException(
68-
$"Type {type.FullName} found multiple times in provided architecture. Please use extern "
69-
+ "alias to reference assemblies that have the same fully-qualified type names."
70-
);
57+
return foundType;
7158
}
59+
60+
throw new TypeDoesNotExistInArchitecture(
61+
$"Type {type.FullName} does not exist in provided architecture."
62+
);
7263
}
7364

7465
[NotNull]
@@ -77,25 +68,16 @@ public static Class GetClassOfType(
7768
[NotNull] Type type
7869
)
7970
{
80-
try
71+
var cls = AllClasses(architecture)
72+
.WhereAssemblyQualifiedNameIs(type.AssemblyQualifiedName);
73+
if (cls != null)
8174
{
82-
var cls = AllClasses(architecture).WhereFullNameIs(type.FullName);
83-
if (cls != null)
84-
{
85-
return cls;
86-
}
87-
88-
throw new TypeDoesNotExistInArchitecture(
89-
$"Type {type.FullName} does not exist in provided architecture or is no class."
90-
);
91-
}
92-
catch (MultipleOccurrencesInSequenceException)
93-
{
94-
throw new NotSupportedException(
95-
$"Type {type.FullName} found multiple times in provided architecture. Please use extern "
96-
+ "alias to reference assemblies that have the same fully-qualified type names."
97-
);
75+
return cls;
9876
}
77+
78+
throw new TypeDoesNotExistInArchitecture(
79+
$"Type {type.FullName} does not exist in provided architecture or is no class."
80+
);
9981
}
10082

10183
[NotNull]
@@ -104,25 +86,16 @@ public static Interface GetInterfaceOfType(
10486
[NotNull] Type type
10587
)
10688
{
107-
try
89+
var intf = AllInterfaces(architecture)
90+
.WhereAssemblyQualifiedNameIs(type.AssemblyQualifiedName);
91+
if (intf != null)
10892
{
109-
var intf = AllInterfaces(architecture).WhereFullNameIs(type.FullName);
110-
if (intf != null)
111-
{
112-
return intf;
113-
}
114-
115-
throw new TypeDoesNotExistInArchitecture(
116-
$"Type {type.FullName} does not exist in provided architecture or is no interface."
117-
);
118-
}
119-
catch (MultipleOccurrencesInSequenceException)
120-
{
121-
throw new NotSupportedException(
122-
$"Type {type.FullName} found multiple times in provided architecture. Please use extern "
123-
+ "alias to reference assemblies that have the same fully-qualified type names."
124-
);
93+
return intf;
12594
}
95+
96+
throw new TypeDoesNotExistInArchitecture(
97+
$"Type {type.FullName} does not exist in provided architecture or is no interface."
98+
);
12699
}
127100

128101
[NotNull]
@@ -131,25 +104,16 @@ public static Attribute GetAttributeOfType(
131104
[NotNull] Type type
132105
)
133106
{
134-
try
107+
var attribute = AllAttributes(architecture)
108+
.WhereAssemblyQualifiedNameIs(type.AssemblyQualifiedName);
109+
if (attribute != null)
135110
{
136-
var attribute = AllAttributes(architecture).WhereFullNameIs(type.FullName);
137-
if (attribute != null)
138-
{
139-
return attribute;
140-
}
141-
142-
throw new TypeDoesNotExistInArchitecture(
143-
$"Type {type.FullName} does not exist in provided architecture or is no attribute."
144-
);
145-
}
146-
catch (MultipleOccurrencesInSequenceException)
147-
{
148-
throw new NotSupportedException(
149-
$"Type {type.FullName} found multiple times in provided architecture. Please use extern "
150-
+ "alias to reference assemblies that have the same fully-qualified type names."
151-
);
111+
return attribute;
152112
}
113+
114+
throw new TypeDoesNotExistInArchitecture(
115+
$"Type {type.FullName} does not exist in provided architecture or is no attribute."
116+
);
153117
}
154118

155119
[NotNull]

ArchUnitNET/Domain/Extensions/NamingExtensions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,17 @@ public static TType WhereFullNameIs<TType>(this IEnumerable<TType> source, strin
102102

103103
return withFullName.FirstOrDefault();
104104
}
105+
106+
[CanBeNull]
107+
public static TType WhereAssemblyQualifiedNameIs<TType>(
108+
this IEnumerable<TType> source,
109+
string assemblyQualifiedName
110+
)
111+
where TType : IHasAssemblyQualifiedName
112+
{
113+
return source.FirstOrDefault(type =>
114+
type.AssemblyQualifiedName == assemblyQualifiedName
115+
);
116+
}
105117
}
106118
}

0 commit comments

Comments
 (0)