[mono][wasm] Include NativeLibrary items to the NativeFileReference items#101532
[mono][wasm] Include NativeLibrary items to the NativeFileReference items#101532lewing merged 4 commits intodotnet:mainfrom
Conversation
| { | ||
| string projectName = $"AppUsingNativeLibrary-a"; | ||
| buildArgs = buildArgs with { ProjectName = projectName }; | ||
| buildArgs = ExpandBuildArgs(buildArgs, extraItems: "<NativeLibrary Include=\"native-lib.o\" />"); |
There was a problem hiding this comment.
| buildArgs = ExpandBuildArgs(buildArgs, extraItems: "<NativeLibrary Include=\"native-lib.o\" />"); | |
| buildArgs = ExpandBuildArgs(buildArgs, extraItems: "<NativeLibrary Include=\"native-lib.o\" />\n<NativeLibrary Include=\"DoesNotExist.o\" \>"); |
There was a problem hiding this comment.
This will fail the build, right? It would be ideal to have it conditional as theory data
There was a problem hiding this comment.
We need to make it not fail the build since NativeLibrary does not mind if the file doesn't exist
| { | ||
| string projectName = $"AppUsingNativeLibrary-a"; | ||
| buildArgs = buildArgs with { ProjectName = projectName }; | ||
| buildArgs = ExpandBuildArgs(buildArgs, extraItems: "<NativeLibrary Include=\"native-lib.o\" />"); |
There was a problem hiding this comment.
This will fail the build, right? It would be ideal to have it conditional as theory data
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <NativeFileReference Include="@(NativeLibrary->'%(Identity)')" Condition="'@(NativeLibrary->Count())' != '0'" /> |
There was a problem hiding this comment.
| <NativeFileReference Include="@(NativeLibrary->'%(Identity)')" Condition="'@(NativeLibrary->Count())' != '0'" /> | |
| <_ExistingNativeLibrary Include="@(NativeLibrary->Exists())" /> | |
| <NativeFileReference Include="@(_ExistingNativeLibrary->'%(Identity)')" /> |
We need something that does effectively this (or a cleaner expression of this)
There was a problem hiding this comment.
Would it make sense to move the condition and items copying into some target executed just before we need these items? So that the lib can be created or copied by some user's target?
EDIT: Hmm. That would a change in evaluation if we need native build
There was a problem hiding this comment.
Moved under _InitializeCommonProperties
With this it works when NativeLibrary is added under user's target.
lewing
left a comment
There was a problem hiding this comment.
For the sake of compatibility we should probably ignore missing NativeLibrary entries.
…tems (dotnet#101532) * Include NativeLibary and add test case * Move to common place * Ignore missing NativeLibraries * Move items copying into target
…tems (dotnet#101532) * Include NativeLibary and add test case * Move to common place * Ignore missing NativeLibraries * Move items copying into target
…tems (dotnet#101532) * Include NativeLibary and add test case * Move to common place * Ignore missing NativeLibraries * Move items copying into target
Fixes #96864