Skip to content

Commit

Permalink
tuple support in net461
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpar committed Aug 28, 2024
1 parent 5bcaa26 commit be5e620
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>

<Import Project="Generated.targets" />
Expand Down
30 changes: 30 additions & 0 deletions Src/Basic.Reference.Assemblies.Net461/Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4476,6 +4476,11 @@ public static class ExtraReferenceInfos
/// The <see cref="ReferenceInfo"/> for System.Threading.Tasks.Extensions.dll
/// </summary>
public static ReferenceInfo SystemThreadingTasksExtensions => new ReferenceInfo("System.Threading.Tasks.Extensions.dll", Resources.SystemThreadingTasksExtensions, Net461.ExtraReferences.SystemThreadingTasksExtensions, global::System.Guid.Parse("bc890e4e-a34f-463c-8fd9-60f43c8beb88"));

/// <summary>
/// The <see cref="ReferenceInfo"/> for System.ValueTuple.dll
/// </summary>
public static ReferenceInfo SystemValueTuple => new ReferenceInfo("System.ValueTuple.dll", Resources.SystemValueTuple, Net461.ExtraReferences.SystemValueTuple, global::System.Guid.Parse("1aa5ee86-d143-43bd-94ec-c0749ff98222"));
private static ImmutableArray<ReferenceInfo> _all;
public static ImmutableArray<ReferenceInfo> All
{
Expand All @@ -4486,6 +4491,7 @@ public static ImmutableArray<ReferenceInfo> All
_all =
[
SystemThreadingTasksExtensions,
SystemValueTuple,
];
}
return _all;
Expand Down Expand Up @@ -4517,6 +4523,23 @@ public static PortableExecutableReference SystemThreadingTasksExtensions
}
}

private static PortableExecutableReference? _SystemValueTuple;

/// <summary>
/// The <see cref="PortableExecutableReference"/> for System.ValueTuple.dll
/// </summary>
public static PortableExecutableReference SystemValueTuple
{
get
{
if (_SystemValueTuple is null)
{
_SystemValueTuple = AssemblyMetadata.CreateFromImage(Resources.SystemValueTuple).GetReference(filePath: "System.ValueTuple.dll", display: "System.ValueTuple (net461)");
}
return _SystemValueTuple;
}
}

private static ImmutableArray<PortableExecutableReference> _all;
public static ImmutableArray<PortableExecutableReference> All
{
Expand All @@ -4527,6 +4550,7 @@ public static ImmutableArray<PortableExecutableReference> All
_all =
[
SystemThreadingTasksExtensions,
SystemValueTuple,
];
}
return _all;
Expand Down Expand Up @@ -5649,6 +5673,12 @@ public static class Resources
public static byte[] SystemThreadingTasksExtensions => ResourceLoader.GetOrCreateResource(ref _SystemThreadingTasksExtensions, "net461.System.Threading.Tasks.Extensions");
private static byte[]? _SystemThreadingTasksExtensions;

/// <summary>
/// The image bytes for System.ValueTuple.dll
/// </summary>
public static byte[] SystemValueTuple => ResourceLoader.GetOrCreateResource(ref _SystemValueTuple, "net461.System.ValueTuple");
private static byte[]? _SystemValueTuple;


}
}
Expand Down
4 changes: 4 additions & 0 deletions Src/Basic.Reference.Assemblies.Net461/Generated.targets
Original file line number Diff line number Diff line change
Expand Up @@ -740,5 +740,9 @@
<LogicalName>net461.System.Threading.Tasks.Extensions</LogicalName>
<Link>Resources\net461\System.Threading.Tasks.Extensions.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(NuGetPackageRoot)\system.valuetuple\4.5.0\lib\net461\System.ValueTuple.dll" WithCulture="false">
<LogicalName>net461.System.ValueTuple</LogicalName>
<Link>Resources\net461\System.ValueTuple.dll</Link>
</EmbeddedResource>
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion Src/Generate/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ void Net461()
var content = GetGeneratedContent(
"Net461",
[@"microsoft.netframework.referenceassemblies.net461\1.0.3\build\.NETFramework\v4.6.1"],
[@"system.threading.tasks.extensions\4.5.4\lib\net461"]);
[
@"system.threading.tasks.extensions\4.5.4\lib\net461",
@"system.valuetuple\4.5.0\lib\net461"
]);
var targetDir = Path.Combine(srcPath, "Basic.Reference.Assemblies.Net461");
File.WriteAllText(Path.Combine(targetDir, "Generated.cs"), content.CodeContent, encoding);
File.WriteAllText(Path.Combine(targetDir, "Generated.targets"), content.TargetsContent, encoding);
Expand Down

0 comments on commit be5e620

Please sign in to comment.