Skip to content

Commit 4adbe2a

Browse files
authored
Add local and connector sln check (#154)
* Add local and connector sln check * add props change * fmt
1 parent fcc2207 commit 4adbe2a

File tree

6 files changed

+159
-2
lines changed

6 files changed

+159
-2
lines changed

Build/Build.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="Bullseye" />
1111
<PackageReference Include="Glob" />
12+
<PackageReference Include="Microsoft.Build" />
1213
<PackageReference Include="SimpleExec" />
1314
</ItemGroup>
1415
</Project>

Build/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
const string RESTORE_TOOLS = "restore-tools";
1616
const string BUILD_SERVER_VERSION = "build-server-version";
1717
const string CLEAN_LOCKS = "clean-locks";
18+
const string CHECK_SOLUTIONS = "check-solutions";
1819

1920
//need to pass arguments
2021
/*var arguments = new List<string>();
@@ -125,9 +126,11 @@ void RemoveDirectory(string d)
125126
}
126127
);
127128

129+
Target(CHECK_SOLUTIONS, Solutions.CompareConnectorsToLocal);
130+
128131
Target(
129132
TEST,
130-
DependsOn(BUILD),
133+
DependsOn(BUILD, CHECK_SOLUTIONS),
131134
Glob.Files(".", "**/*.Tests.csproj"),
132135
file =>
133136
{

Build/Solutions.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using Microsoft.Build.Construction;
2+
3+
namespace Build;
4+
5+
public static class Solutions
6+
{
7+
private static bool ValidProjects(KeyValuePair<string, ProjectInSolution> projectInSolution) =>
8+
projectInSolution.Value.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat;
9+
10+
public static void CompareConnectorsToLocal()
11+
{
12+
var localSln = SolutionFile.Parse(Path.Combine(Environment.CurrentDirectory, "Local.sln"));
13+
var connectorsSln = SolutionFile.Parse(Path.Combine(Environment.CurrentDirectory, "Speckle.Connectors.sln"));
14+
var localProjects = localSln.ProjectsByGuid.Where(ValidProjects).ToDictionary();
15+
16+
foreach ((string? _, ProjectInSolution? value) in connectorsSln.ProjectsByGuid.Where(ValidProjects))
17+
{
18+
var localProject = localProjects.Values.FirstOrDefault(x => x.ProjectName == value.ProjectName);
19+
if (localProject is null)
20+
{
21+
throw new InvalidOperationException($"Could not find in LOCAL solution: {value.ProjectName}");
22+
}
23+
24+
if (value.ProjectName != localProject.ProjectName)
25+
{
26+
throw new InvalidOperationException(
27+
"Projects with different names have same Guid in solution: "
28+
+ value.ProjectName
29+
+ " and "
30+
+ localProject.ProjectName
31+
);
32+
}
33+
localProjects.Remove(localProjects.Single(x => x.Value.ProjectName == value.ProjectName).Key);
34+
}
35+
36+
void CheckAndRemoveKnown(string projectName)
37+
{
38+
var localProject = localProjects.Values.FirstOrDefault(x => x.ProjectName == projectName);
39+
if (localProject is null)
40+
{
41+
throw new InvalidOperationException($"Could not find in LOCAL solution: {projectName}");
42+
}
43+
localProjects.Remove(localProjects.Single(x => x.Value.ProjectName == projectName).Key);
44+
}
45+
46+
CheckAndRemoveKnown("Speckle.Objects");
47+
CheckAndRemoveKnown("Speckle.Sdk");
48+
CheckAndRemoveKnown("Speckle.Sdk.Logging");
49+
if (localProjects.Count != 0)
50+
{
51+
throw new InvalidOperationException(
52+
"Could not find in CONNECTOR solution: " + localProjects.First().Value.ProjectName
53+
);
54+
}
55+
}
56+
}

Build/packages.lock.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
"resolved": "1.1.9",
1515
"contentHash": "AfK5+ECWYTP7G3AAdnU8IfVj+QpGjrh9GC2mpdcJzCvtQ4pnerAGwHsxJ9D4/RnhDUz2DSzd951O/lQjQby2Sw=="
1616
},
17+
"Microsoft.Build": {
18+
"type": "Direct",
19+
"requested": "[17.10.4, )",
20+
"resolved": "17.10.4",
21+
"contentHash": "ZmGA8vhVXFzC4oo48ybQKlEybVKd0Ntfdr+Enqrn5ES1R6e/krIK9hLk0W33xuT0/G6QYd3YdhJZh+Xle717Ag==",
22+
"dependencies": {
23+
"Microsoft.Build.Framework": "17.10.4",
24+
"Microsoft.NET.StringTools": "17.10.4",
25+
"System.Collections.Immutable": "8.0.0",
26+
"System.Configuration.ConfigurationManager": "8.0.0",
27+
"System.Reflection.Metadata": "8.0.0",
28+
"System.Reflection.MetadataLoadContext": "8.0.0",
29+
"System.Security.Principal.Windows": "5.0.0",
30+
"System.Threading.Tasks.Dataflow": "8.0.0"
31+
}
32+
},
1733
"Microsoft.SourceLink.GitHub": {
1834
"type": "Direct",
1935
"requested": "[8.0.0, )",
@@ -42,15 +58,77 @@
4258
"resolved": "0.9.6",
4359
"contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w=="
4460
},
61+
"Microsoft.Build.Framework": {
62+
"type": "Transitive",
63+
"resolved": "17.10.4",
64+
"contentHash": "4qXCwNOXBR1dyCzuks9SwTwFJQO/xmf2wcMislotDWJu7MN/r3xDNoU8Ae5QmKIHPaLG1xmfDkYS7qBVzxmeKw=="
65+
},
4566
"Microsoft.Build.Tasks.Git": {
4667
"type": "Transitive",
4768
"resolved": "8.0.0",
4869
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
4970
},
71+
"Microsoft.NET.StringTools": {
72+
"type": "Transitive",
73+
"resolved": "17.10.4",
74+
"contentHash": "wyABaqY+IHCMMSTQmcc3Ca6vbmg5BaEPgicnEgpll+4xyWZWlkQqUwafweUd9VAhBb4jqplMl6voUHQ6yfdUcg=="
75+
},
5076
"Microsoft.SourceLink.Common": {
5177
"type": "Transitive",
5278
"resolved": "8.0.0",
5379
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
80+
},
81+
"System.Collections.Immutable": {
82+
"type": "Transitive",
83+
"resolved": "8.0.0",
84+
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
85+
},
86+
"System.Configuration.ConfigurationManager": {
87+
"type": "Transitive",
88+
"resolved": "8.0.0",
89+
"contentHash": "JlYi9XVvIREURRUlGMr1F6vOFLk7YSY4p1vHo4kX3tQ0AGrjqlRWHDi66ImHhy6qwXBG3BJ6Y1QlYQ+Qz6Xgww==",
90+
"dependencies": {
91+
"System.Diagnostics.EventLog": "8.0.0",
92+
"System.Security.Cryptography.ProtectedData": "8.0.0"
93+
}
94+
},
95+
"System.Diagnostics.EventLog": {
96+
"type": "Transitive",
97+
"resolved": "8.0.0",
98+
"contentHash": "fdYxcRjQqTTacKId/2IECojlDSFvp7LP5N78+0z/xH7v/Tuw5ZAxu23Y6PTCRinqyu2ePx+Gn1098NC6jM6d+A=="
99+
},
100+
"System.Reflection.Metadata": {
101+
"type": "Transitive",
102+
"resolved": "8.0.0",
103+
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
104+
"dependencies": {
105+
"System.Collections.Immutable": "8.0.0"
106+
}
107+
},
108+
"System.Reflection.MetadataLoadContext": {
109+
"type": "Transitive",
110+
"resolved": "8.0.0",
111+
"contentHash": "SZxrQ4sQYnIcdwiO3G/lHZopbPYQ2lW0ioT4JezgccWUrKaKbHLJbAGZaDfkYjWcta1pWssAo3MOXLsR0ie4tQ==",
112+
"dependencies": {
113+
"System.Collections.Immutable": "8.0.0",
114+
"System.Reflection.Metadata": "8.0.0"
115+
}
116+
},
117+
"System.Security.Cryptography.ProtectedData": {
118+
"type": "Transitive",
119+
"resolved": "8.0.0",
120+
"contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
121+
},
122+
"System.Security.Principal.Windows": {
123+
"type": "Transitive",
124+
"resolved": "5.0.0",
125+
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
126+
},
127+
"System.Threading.Tasks.Dataflow": {
128+
"type": "CentralTransitive",
129+
"requested": "[6.0.0, )",
130+
"resolved": "8.0.0",
131+
"contentHash": "7V0I8tPa9V7UxMx/+7DIwkhls5ouaEMQx6l/GwGm1Y8kJQ61On9B/PxCXFLbgu5/C47g0BP2CUYs+nMv1+Oaqw=="
54132
}
55133
}
56134
}

Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<PackageVersion Include="Esri.ArcGISPro.Extensions30" Version="3.2.0.49743" />
88
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
99
<PackageVersion Include="Glob" Version="1.1.9" />
10+
<PackageVersion Include="Microsoft.Build" Version="17.10.4" />
1011
<PackageVersion Include="Moq" Version="4.20.70" />
1112
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
1213
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
@@ -29,4 +30,4 @@
2930
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
3031
<GlobalPackageReference Include="Speckle.InterfaceGenerator" Version="0.9.6" />
3132
</ItemGroup>
32-
</Project>
33+
</Project>

Local.sln

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Autocad2
180180
EndProject
181181
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Autocad2022", "Converters\Autocad\Speckle.Converters.Autocad2022\Speckle.Converters.Autocad2022.csproj", "{62F50A22-8BBF-497A-B599-F858DFF1D31C}"
182182
EndProject
183+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Converters.AutocadShared.DependencyInjection", "Converters\Autocad\Speckle.Converters.AutocadShared.DependencyInjection\Speckle.Converters.AutocadShared.DependencyInjection.shproj", "{6E7D959F-8383-4DC2-BFC2-FCEA4ECC60B3}"
184+
EndProject
185+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.Autocad2024", "Connectors\Autocad\Speckle.Connectors.Autocad2024\Speckle.Connectors.Autocad2024.csproj", "{27AFBC57-F493-4B51-BEE0-0C364B6A6A13}"
186+
EndProject
187+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.DUI.Tests", "DUI3\Speckle.Connectors.DUI.Tests\Speckle.Connectors.DUI.Tests.csproj", "{5F91F0E5-E7FD-48C1-87C5-0913C55FF094}"
188+
EndProject
189+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Revit2022.Tests", "Converters\Revit\Speckle.Converters.Revit2022.Tests\Speckle.Converters.Revit2022.Tests.csproj", "{C34D0246-6C16-4E81-AE57-2CE70F81484B}"
190+
EndProject
183191
Global
184192
GlobalSection(SolutionConfigurationPlatforms) = preSolution
185193
Local|Any CPU = Local|Any CPU
@@ -281,6 +289,12 @@ Global
281289
{960A9ED3-8377-4FBB-B781-77A4ECCCBB89}.Local|Any CPU.Build.0 = Local|Any CPU
282290
{62F50A22-8BBF-497A-B599-F858DFF1D31C}.Local|Any CPU.ActiveCfg = Local|Any CPU
283291
{62F50A22-8BBF-497A-B599-F858DFF1D31C}.Local|Any CPU.Build.0 = Local|Any CPU
292+
{27AFBC57-F493-4B51-BEE0-0C364B6A6A13}.Local|Any CPU.ActiveCfg = Local|Any CPU
293+
{27AFBC57-F493-4B51-BEE0-0C364B6A6A13}.Local|Any CPU.Build.0 = Local|Any CPU
294+
{5F91F0E5-E7FD-48C1-87C5-0913C55FF094}.Local|Any CPU.ActiveCfg = Local|Any CPU
295+
{5F91F0E5-E7FD-48C1-87C5-0913C55FF094}.Local|Any CPU.Build.0 = Local|Any CPU
296+
{C34D0246-6C16-4E81-AE57-2CE70F81484B}.Local|Any CPU.ActiveCfg = Local|Any CPU
297+
{C34D0246-6C16-4E81-AE57-2CE70F81484B}.Local|Any CPU.Build.0 = Local|Any CPU
284298
EndGlobalSection
285299
GlobalSection(SolutionProperties) = preSolution
286300
HideSolutionNode = FALSE
@@ -360,6 +374,10 @@ Global
360374
{EAAD080D-49AF-49BF-B8BD-A18CEB210734} = {B9CE43B9-31C9-4F02-A92C-658681AD75C6}
361375
{960A9ED3-8377-4FBB-B781-77A4ECCCBB89} = {B9CE43B9-31C9-4F02-A92C-658681AD75C6}
362376
{62F50A22-8BBF-497A-B599-F858DFF1D31C} = {B9CE43B9-31C9-4F02-A92C-658681AD75C6}
377+
{6E7D959F-8383-4DC2-BFC2-FCEA4ECC60B3} = {6186EF63-4978-4FA9-9893-7074F9FD0BA4}
378+
{27AFBC57-F493-4B51-BEE0-0C364B6A6A13} = {844572F4-7281-49B4-BD92-722607606C98}
379+
{5F91F0E5-E7FD-48C1-87C5-0913C55FF094} = {FD4D6594-D81E-456F-8F2E-35B09E04A755}
380+
{C34D0246-6C16-4E81-AE57-2CE70F81484B} = {0AF38BA3-65A0-481B-8CBB-B82E406E1575}
363381
EndGlobalSection
364382
GlobalSection(ExtensibilityGlobals) = postSolution
365383
SolutionGuid = {EE253116-7070-4E9A-BCE8-2911C251B8C8}

0 commit comments

Comments
 (0)