Skip to content

Commit

Permalink
fix: Fix remaining dependency issues from rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Jan 4, 2024
1 parent 5589825 commit 4da819a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
6 changes: 5 additions & 1 deletion Src/Support/Google.Apis.Auth/Google.Apis.Auth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ This package includes auth components like user-credential, authorization code f
<Reference Include="System.Net.Http" />
<PackageReference Include="System.Management" Version="7.0.2" />
</ItemGroup>


<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="System.Management" Version="7.0.2" />
</ItemGroup>

<ItemGroup>
<Compile Update="OAuth2/AwsExternalAccountCredential.*.cs">
<DependentUpon>OAuth2/AwsExternalAccountCredential.cs</DependentUpon>
Expand Down
15 changes: 4 additions & 11 deletions Src/Support/Google.Apis.Auth/OAuth2/ComputeCredential.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,12 @@ private static async Task<bool> IsGoogleBiosAsync()

bool IsWindows()
{
#if NET45
#if NET462
// RuntimeInformation.IsOsPlatform is not available for NET45.
// We are probably on Windows, unless we are using Mono which means we might be
// elsewhere. But we don't have a reliable way to determine that, so let's
// return false, always.
// Note that this check will go away after
// https://github.com/googleapis/google-api-dotnet-client/issues/2561.
// Note that this check can go away after we update to 4.7.1 or higher.
return false;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
Expand All @@ -394,13 +393,12 @@ bool IsWindows()

bool IsLinux()
{
#if NET45
#if NET462
// RuntimeInformation.IsOsPlatform is not available for NET45.
// There's a chance we are on Linux if we are using Mono.
// But we don't have a reliable way to determine that, so let's
// return false, always.
// Note that this check will go away after
// https://github.com/googleapis/google-api-dotnet-client/issues/2561.
// Note that this check can go away after we update to 4.7.1 or higher.
return false;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
Expand All @@ -410,10 +408,6 @@ bool IsLinux()
bool IsWindowsGoogleBios()
{
Logger.Info("Checking BIOS values on Windows.");
#if NET45 || NETSTANDARD1_3
Logger.Debug("System.Management is not supported in net45 and netstandard1.3");
return false;
#else
System.Management.ManagementClass biosClass = new ("Win32_BIOS");
using var instances = biosClass.GetInstances();

Expand All @@ -438,7 +432,6 @@ bool IsWindowsGoogleBios()
Logger.Debug("No Win32_BIOS management object found.");
}
return isGoogle;
#endif
}

async Task<bool> IsLinuxGoogleBiosAsync()
Expand Down
11 changes: 1 addition & 10 deletions Src/Support/Google.Apis.Tests/CultureSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,5 @@ internal CultureSwitcher(CultureInfo newCulture)

public void Dispose() => SetCulture(_originalCulture);

private void SetCulture(CultureInfo culture)
{
// CultureInfo.CurrentCulture is the preferred way to set this,
// but it was read-only on .NET Framework before v4.6.
#if NET452
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
#else
CultureInfo.CurrentCulture = culture;
#endif
}
private void SetCulture(CultureInfo culture) => CultureInfo.CurrentCulture = culture;
}

0 comments on commit 4da819a

Please sign in to comment.