Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] Read AssetTraitValue to get culture for resource during webcil transformation #89600

Merged
merged 11 commits into from
Aug 8, 2023

Conversation

maraf
Copy link
Member

@maraf maraf commented Jul 27, 2023

  • The ReferenceCopyLocalPaths provide Culture metadata
  • Static web assets provide culture in AssetTraitValue
  • Add WBT for Blazor with resources in two cultures

Fixes #89234

@maraf maraf added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm labels Jul 27, 2023
@maraf maraf added this to the 8.0.0 milestone Jul 27, 2023
@maraf maraf requested review from radical and pavelsavara July 27, 2023 21:51
@maraf maraf self-assigned this Jul 27, 2023
@ghost
Copy link

ghost commented Jul 27, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details
  • The ReferenceCopyLocalPaths provide Culture metadata
  • Static web assets provide culture in AssetTraitValue

Fixes #89234

Author: maraf
Assignees: maraf
Labels:

arch-wasm, area-Build-mono, os-browser

Milestone: 8.0.0

@maraf maraf requested a review from lambdageek July 27, 2023 21:52
@@ -70,7 +70,10 @@ public override bool Execute()
var webcilWriter = Microsoft.WebAssembly.Build.Tasks.WebcilConverter.FromPortableExecutable(inputPath: filePath, outputPath: tmpWebcil, logger: Log);
webcilWriter.ConvertToWebcil();

string candicatePath = Path.Combine(OutputPath, candidate.GetMetadata("Culture"));
string candicatePath = candidate.GetMetadata("AssetTraitName") == "Culture"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test that fails without this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting to see it... We have test with resources + Wasm SDK + publish

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: candicatePath -> candidatePath

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the paths received here coming from? For satellite assemblies aren't they already in some $culture/$assemblyname.dll? Why do we need to do this special thing?

Copy link
Member Author

@maraf maraf Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a task that generates webcil converted libs. It computes a path where to store the intermediate files and using computing unique path for culture specific resource dlls was broken. The metedata comes from static web assets

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WBT test that I thought it might test the scenario TestAppScenarios.SatelliteLoadingTests has only a single culture resource and so it works. The other WBT with resources doesn't use Blazor/Wasm SDK

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what the task is passed:

..../wbt/blz_resources_Debug_ulil2stc.hgf_煉/obj/Debug/net8.0/es-ES/blz_resources_Debug_ulil2stc.hgf_煉.resources.dll
        AssetKind=Build
        AssetRole=Related
        AssetTraitName=Culture
        AssetTraitValue=es-ES
        Culture=es-ES
        RelatedAsset=...../wbt/blz_resources_Debug_ulil2stc.hgf_煉/bin/Debug/net8.0/wwwroot/_framework/blz_resources_Debug_ulil2stc.hgf_煉.dll
        RelativePath=_framework/es-ES/blz_resources_Debug_ulil2stc.hgf_煉.resources.dll
        TargetPath=es-ES\blz_resources_Debug_ulil2stc.hgf_煉.resources.dll

You can directly use TargetPath, which would respect where rest of the build is expecting the file to be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that's why it is needed only in this task, and not in other places.

@maraf maraf requested a review from radical July 28, 2023 10:09
Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
In a follow up PR ConvertDllsToWebCil should be fixed to not depend on things specific to static webassets, thus it should use the TargetPath metadata from the candidate, and not AssetTraitName.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.net 8 publish failed with error "An item with the same key has already been added"
3 participants