Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<ArtifactsPackageVersion>19.239.34907-buildid28083504</ArtifactsPackageVersion>
<BuildXLPackageVersion>0.1.0-20240606.3</BuildXLPackageVersion>
<BuildXLPackageVersion>0.1.0-20241212.3</BuildXLPackageVersion>
<MSBuildPackageVersion>17.9.5</MSBuildPackageVersion>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -40,14 +40,14 @@
<PackageVersion Include="protobuf-net" Version="3.2.26" />
<PackageVersion Include="protobuf-net.Core" Version="3.2.26" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.1.1" />
<PackageVersion Include="RocksDbNative" Version="8.1.1-20240419.2" />
<PackageVersion Include="RocksDbSharp" Version="8.1.1-20240419.2" />
<PackageVersion Include="RocksDbNative" Version="8.1.1-20241011.2" />
<PackageVersion Include="RocksDbSharp" Version="8.1.1-20241011.2" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Private.ServiceModel" Version="4.10.3" />
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="8.0.0" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion build/MSBuildExtensionPackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
</ItemGroup>

<ItemGroup>
<!-- Somewhat hard-code this as there isn't a good way to identify it -->
<!-- Somewhat hard-code these as there isn't a good way to identify them -->
<BuildOutputInPackage Include="@(None-&gt;WithMetadataValue('Link', 'native\amd64\rocksdb.dll'))" TargetPath="%(None.Link)" />
<BuildOutputInPackage Include="@(None-&gt;WithMetadataValue('Link', 'runtimes\win-x64\native\msalruntime.dll'))" TargetPath="%(None.Link)" />
</ItemGroup>
</Target>

Expand Down
17 changes: 10 additions & 7 deletions src/AzureBlobStorage/MSBuildCacheAzureBlobStoragePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using BuildXL.Cache.MemoizationStore.Interfaces.Caches;
using BuildXL.Cache.MemoizationStore.Interfaces.Sessions;
using BuildXL.Cache.MemoizationStore.Sessions;
using BuildXL.Utilities.Tracing;
using Microsoft.Build.Experimental.ProjectCache;
using Microsoft.MSBuildCache.Caching;

Expand Down Expand Up @@ -81,7 +82,7 @@ protected override async Task<ICacheClient> CreateCacheClientAsync(PluginLoggerB

logger.LogMessage($"Using cache universe '{Settings.CacheUniverse}' as '{cacheUniverse}'.");

IAzureStorageCredentials credentials = CreateAzureStorageCredentials(Settings, cancellationToken);
IAzureStorageCredentials credentials = CreateAzureStorageCredentials(context, Settings, cancellationToken);

#pragma warning disable CA2000 // Dispose objects before losing scope. Expected to be disposed by TwoLevelCache
ICache remoteCache = CreateRemoteCache(new OperationContext(context, cancellationToken), cacheUniverse, Settings.RemoteCacheIsReadOnly, credentials);
Expand Down Expand Up @@ -110,7 +111,7 @@ protected override async Task<ICacheClient> CreateCacheClientAsync(PluginLoggerB
Settings.AsyncCacheMaterialization);
}

private IAzureStorageCredentials CreateAzureStorageCredentials(AzureBlobStoragePluginSettings settings, CancellationToken cancellationToken)
private IAzureStorageCredentials CreateAzureStorageCredentials(Context context, AzureBlobStoragePluginSettings settings, CancellationToken cancellationToken)
{
switch (settings.CredentialsType)
{
Expand All @@ -121,11 +122,9 @@ private IAzureStorageCredentials CreateAzureStorageCredentials(AzureBlobStorageP
throw new InvalidOperationException($"{nameof(AzureBlobStoragePluginSettings.BlobUri)} is required when using {nameof(AzureBlobStoragePluginSettings.CredentialsType)}={settings.CredentialsType}");
}

// InteractiveClientStorageCredentials expects the directory to exist.
// TODO: Remove after the bug fix makes it into BXL.
Directory.CreateDirectory(settings.InteractiveAuthTokenDirectory);

return new InteractiveClientStorageCredentials(settings.InteractiveAuthTokenDirectory, settings.BlobUri, cancellationToken);
using StandardConsole console = new(colorize: false, animateTaskbar: false, supportsOverwriting: false, pathTranslator: null);
InteractiveClientTokenCredential tokenCredential = new(context, settings.InteractiveAuthTokenDirectory, GetHashForTokenIdentifier(settings.BlobUri), console, cancellationToken);
return new UriAzureStorageTokenCredential(tokenCredential, settings.BlobUri);
}
case AzureStorageCredentialsType.ConnectionString:
{
Expand Down Expand Up @@ -201,4 +200,8 @@ private static async Task<ICacheSession> StartCacheSessionAsync(Context context,

return session;
}

private static ContentHash GetHashForTokenIdentifier(Uri uri) => GetHashForTokenIdentifier(uri.ToString());

private static ContentHash GetHashForTokenIdentifier(string identifier) => HashInfoLookup.GetContentHasher(HashType.SHA256).GetContentHash(Encoding.UTF8.GetBytes(identifier));
}