Skip to content

Commit 60d4dad

Browse files
committed
Added tests and bug fixes for things found by tests.
* Added new tests for DIBuilder (Biggest impact of nullability changes) - These tests have necessitated diving deep into the LLVM implementation to determine if null is truly allowed or not, with some surprising explicit allow cases. * Fixed bugs in nullability of parameter declarations and arg validation. - General pattern is for things to be not nullable if possible, and allow null for in params as needed but have a default for out or returns whenever plausible. * In particular, strings as out or return will be string.Empty instead of null, unless LLVM defines a semantic difference between the null and empty values. (So far there's no known case of that) * Simplified DOCFX projects by leveraging the under documented PackageReference 'GeneratePathProperty' to identify the root path of the package with a property
1 parent 3a9a382 commit 60d4dad

File tree

16 files changed

+1524
-201
lines changed

16 files changed

+1524
-201
lines changed

Ubiquity.NET.ruleset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590
<Rule Id="RECS0129" Action="None" />
591591
<Rule Id="RECS0145" Action="None" />
592592
<Rule Id="RECS0147" Action="Warning" />
593-
<Rule Id="RECS0154" Action="Info" />
593+
<Rule Id="RECS0154" Action="None" />
594594
</Rules>
595595
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
596596
<Rule Id="SA0001" Action="Hidden" />

docfx/current/Ubiquity.NET.Llvm.Docfx.API.csproj

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,20 @@
88
</ItemGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="docfx.console" PrivateAssets="all">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
13-
</PackageReference>
14-
<PackageReference Include="memberpage" PrivateAssets="All" />
15-
<PackageReference Include="msdn.4.5.2" PrivateAssets="All" />
11+
<PackageReference Include="docfx.console" PrivateAssets="All" />
12+
<PackageReference Include="memberpage" PrivateAssets="All" GeneratePathProperty="true" />
13+
<PackageReference Include="msdn.4.5.2" PrivateAssets="All" GeneratePathProperty="true" />
1614
</ItemGroup>
1715

18-
<ItemGroup>
19-
<None Update="docfx.json">
20-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
21-
</None>
22-
</ItemGroup>
23-
24-
<!-- Custom task to Compare versions -->
25-
<UsingTask TaskName="VersionCheck" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
26-
<ParameterGroup>
27-
<ActualVersion ParameterType="System.String" Required="true" />
28-
<MaximumSupportedVersion ParameterType="System.String" Required="true" />
29-
<IsValidVersion ParameterType="System.Boolean" Output="true" />
30-
</ParameterGroup>
31-
<Task>
32-
<Using Namespace="System" />
33-
<Code Type="Fragment" Language="cs">
34-
<![CDATA[
35-
IsValidVersion = Version.Parse(ActualVersion) < Version.Parse(MaximumSupportedVersion);
36-
]]>
37-
</Code>
38-
</Task>
39-
</UsingTask>
40-
41-
<!--
42-
This target dynamically resolves the installed location of the NuGet Packages used and applies
43-
appropriate parameters to the DocFx command to use them. Otherwise the docfx.json would need to
44-
have a hard coded path, which doesn't work with multiple users of a version controlled project.
45-
-->
46-
<Target Name="GetDocfxPackagePaths" BeforeTargets="DocBuild" DependsOnTargets="ResolvePackageDependenciesDesignTime">
47-
<ItemGroup>
48-
<docfxpkg Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='docfx.console'" />
49-
<memberpage Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='memberpage'" />
50-
<Msdn4_5_2 Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='msdn.4.5.2'" />
51-
</ItemGroup>
52-
<PropertyGroup>
53-
<DocfxConsolePath>%(docfxpkg.ResolvedPath)</DocfxConsolePath>
54-
<MemberPagePath>%(memberpage.ResolvedPath)</MemberPagePath>
55-
<MsdnXRefPath>%(msdn4_5_2.ResolvedPath)</MsdnXRefPath>
56-
<IsSupportedMSBuild>false</IsSupportedMSBuild>
57-
</PropertyGroup>
58-
<VersionCheck Condition="$(MSBuildVersion)!=''" MaximumSupportedVersion="17.0.999" ActualVersion="$(MSBuildVersion)">
59-
<Output TaskParameter="IsValidVersion" PropertyName="IsSupportedMSBuild" />
60-
</VersionCheck>
61-
<Error Code="DOCFX:0001" ContinueOnError="false" Condition="!$(IsSupportedMSBuild)" Text="As of DOCFX 2.40 docfx cannot generate metadata for CSPROJ files using MSBuild &gt; 16.0.xx (Current MSBuild is $(MSBuildVersion))" />
62-
</Target>
63-
64-
<Target Name="SetDocFxParameters" BeforeTargets="DocGenerateMetadata" DependsOnTargets="GetDocfxPackagePaths">
16+
<Target Name="SetDocFxParameters" BeforeTargets="DocGenerateMetadata">
6517
<ItemGroup>
6618
<DocFxCrossRefMap Include="llvm-xref.yml" />
67-
<DocFxCrossRefMap Include="$(MsdnXrefPath)\content\msdn.4.5.2.zip" />
68-
<DocFxCrossRefMap Include="$(MsdnXrefPath)\content\namespaces.4.5.2.zip" />
19+
<DocFxCrossRefMap Include="$(Pkgmsdn_4_5_2)\content\msdn.4.5.2.zip" />
20+
<DocFxCrossRefMap Include="$(Pkgmsdn_4_5_2)\content\namespaces.4.5.2.zip" />
6921
</ItemGroup>
7022
<ItemGroup>
7123
<DocFxTemplate Include="statictoc" />
72-
<DocFxTemplate Include="$(MemberPagePath)\content" />
24+
<DocFxTemplate Include="$(Pkgmemberpage)\content" />
7325
<DocFxTemplate Include="$(BuildRootDir)docfx\templates\Ubiquity" />
7426
</ItemGroup>
7527
<PropertyGroup>

docfx/index/Ubiquity.NET.Llvm.Docfx.Index.csproj

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,12 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="docfx.console" PrivateAssets="all">
9-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
10-
</PackageReference>
11-
<PackageReference Include="memberpage" PrivateAssets="All" />
8+
<PackageReference Include="docfx.console" PrivateAssets="All" GeneratePathProperty="true" />
9+
<PackageReference Include="memberpage" PrivateAssets="All" GeneratePathProperty="true" />
10+
<PackageReference Include="msdn.4.5.2" PrivateAssets="All" GeneratePathProperty="true" />
1211
</ItemGroup>
1312

14-
<!-- Custom task to Compare versions -->
15-
<UsingTask TaskName="VersionCheck" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
16-
<ParameterGroup>
17-
<ActualVersion ParameterType="System.String" Required="true" />
18-
<MaximumSupportedVersion ParameterType="System.String" Required="true" />
19-
<IsValidVersion ParameterType="System.Boolean" Output="true" />
20-
</ParameterGroup>
21-
<Task>
22-
<Using Namespace="System" />
23-
<Code Type="Fragment" Language="cs">
24-
<![CDATA[
25-
IsValidVersion = Version.Parse(ActualVersion) < Version.Parse(MaximumSupportedVersion);
26-
]]>
27-
</Code>
28-
</Task>
29-
</UsingTask>
30-
31-
<!--
32-
This target dynamically resolves the installed location of the NuGet Packages used and applies
33-
appropriate parameters to the DocFx command to use them. Otherwise the docfx.json would need to
34-
have a hard coded path, which doesn't work with multiple users of a version controlled project.
35-
-->
36-
<Target Name="GetDocfxPackagePaths" BeforeTargets="DocBuild" DependsOnTargets="ResolvePackageDependenciesDesignTime">
37-
<ItemGroup>
38-
<docfxpkg Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='docfx.console'" />
39-
<memberpage Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='memberpage'" />
40-
<Msdn4_5_2 Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)'=='msdn.4.5.2'" />
41-
</ItemGroup>
42-
<PropertyGroup>
43-
<DocfxConsolePath>%(docfxpkg.ResolvedPath)</DocfxConsolePath>
44-
<MemberPagePath>%(memberpage.ResolvedPath)</MemberPagePath>
45-
<IsSupportedMSBuild>false</IsSupportedMSBuild>
46-
</PropertyGroup>
47-
<VersionCheck Condition="$(MSBuildVersion)!=''" MaximumSupportedVersion="17.0.999" ActualVersion="$(MSBuildVersion)">
48-
<Output TaskParameter="IsValidVersion" PropertyName="IsSupportedMSBuild" />
49-
</VersionCheck>
50-
<Error Code="DOCFX:0001" ContinueOnError="false" Condition="!$(IsSupportedMSBuild)" Text="As of DOCFX 2.40 docfx cannot generate metadata for CSPROJ files using MSBuild &gt; 16.0.xx (Current MSBuild is $(MSBuildVersion))" />
51-
</Target>
52-
53-
<Target Name="SetDocFxParameters" BeforeTargets="DocGenerateMetadata" DependsOnTargets="GetDocfxPackagePaths">
13+
<Target Name="SetDocFxParameters" BeforeTargets="DocGenerateMetadata">
5414
<ItemGroup>
5515
<DocFxCrossRefMap Include="versions-xref.yml" />
5616
</ItemGroup>
@@ -60,7 +20,7 @@
6020
<DocParameters>$(DocParameters) --globalMetadata="{_buildVersion:\"$(FullBuildNumber)\"}"</DocParameters>
6121
<DocParameters>$(DocParameters) --intermediateFolder="$(IntermediateOutputPath.TrimEnd('\'))"</DocParameters>
6222
<DocParameters>$(DocParameters) --xref="@(DocFxCrossRefMap->'%(FullPath)',',')"</DocParameters>
63-
<DocTemplate>statictoc,$(MemberPagePath)\content,$(BuildRootDir)docfx\templates\Ubiquity</DocTemplate>
23+
<DocTemplate>statictoc,$(Pkgmemberpage)\content,$(BuildRootDir)docfx\templates\Ubiquity</DocTemplate>
6424
</PropertyGroup>
6525
</Target>
6626
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30021.99
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LlvmBindingsGenerator", "LlvmBindingsGenerator.csproj", "{9A14EF74-BDF8-4D00-803A-A48A14828526}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{9A14EF74-BDF8-4D00-803A-A48A14828526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{9A14EF74-BDF8-4D00-803A-A48A14828526}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{9A14EF74-BDF8-4D00-803A-A48A14828526}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{9A14EF74-BDF8-4D00-803A-A48A14828526}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3C6B306B-6805-4AAA-A735-D285C826A434}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)