[Theory]
[SkipOnPlatform(TestPlatforms.Browser, "Inconsistent and unpredictable results.")] // TODO - Why does 'TypeWithReadWriteCollectionAndNoCtorOnCollection' only cause an exception sometimes, but not all the time? What's special about wasm here?
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/82967", TestPlatforms.Wasi)]
[InlineData(typeof(NoDataContractWithoutParameterlessConstructor), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")]
[InlineData(typeof(DataContractWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")]
[InlineData(typeof(SerializableWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")]
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime.Serialization.Json\tests\System.Runtime.Serialization.Json.Tests.csproj" />
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Globalization\tests\System.Globalization.Tests.csproj" />
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Globalization\tests\Invariant\Invariant.Tests.csproj" />
+ <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.IO.Packaging\tests\System.IO.Packaging.Tests.csproj" />
+ <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Data.DataSetExtensions\tests\System.Data.DataSetExtensions.Tests.csproj" />
+ <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime.Serialization.Xml\tests\System.Runtime.Serialization.Xml.Tests.csproj" />
+ <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime.Serialization.Xml\tests\ReflectionOnly\System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TestNativeAot)' == 'true'">
InvariantGlobalization="$(InvariantGlobalization)"
SatelliteAssemblies="@(_WasmSatelliteAssemblies)"
IcuDataFileNames="@(WasmIcuDataFileNames)"
+ FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)"
ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)"
NativeAssets="@(WasmNativeAsset)"
DebugLevel="$(WasmDebugLevel)"
public class WasmAppBuilder : WasmAppBuilderBaseTask
{
- public ITaskItem[]? FilesToIncludeInFileSystem { get; set; }
public ITaskItem[]? RemoteSources { get; set; }
public bool IncludeThreadsWorker {get; set; }
public int PThreadPoolSize {get; set; }
}
});
- if (FilesToIncludeInFileSystem != null)
+ if (FilesToIncludeInFileSystem.Length > 0)
{
string supportFilesDir = Path.Combine(AppDir, "supportFiles");
Directory.CreateDirectory(supportFilesDir);
Utils.CopyIfDifferent(tmpMonoConfigPath, monoConfigPath, useHash: false);
_fileWrites.Add(monoConfigPath);
- if (ExtraFilesToDeploy != null)
+ foreach (ITaskItem item in ExtraFilesToDeploy!)
{
- foreach (ITaskItem item in ExtraFilesToDeploy!)
- {
- string src = item.ItemSpec;
- string dst;
-
- string tgtPath = item.GetMetadata("TargetPath");
- if (!string.IsNullOrEmpty(tgtPath))
- {
- dst = Path.Combine(AppDir!, tgtPath);
- string? dstDir = Path.GetDirectoryName(dst);
- if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir))
- Directory.CreateDirectory(dstDir!);
- }
- else
- {
- dst = Path.Combine(AppDir!, Path.GetFileName(src));
- }
+ string src = item.ItemSpec;
+ string dst;
- if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy"))
- return false;
+ string tgtPath = item.GetMetadata("TargetPath");
+ if (!string.IsNullOrEmpty(tgtPath))
+ {
+ dst = Path.Combine(AppDir!, tgtPath);
+ string? dstDir = Path.GetDirectoryName(dst);
+ if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir))
+ Directory.CreateDirectory(dstDir!);
}
+ else
+ {
+ dst = Path.Combine(AppDir!, Path.GetFileName(src));
+ }
+
+ if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy"))
+ return false;
}
UpdateRuntimeConfigJson();
public int DebugLevel { get; set; }
public ITaskItem[] SatelliteAssemblies { get; set; } = Array.Empty<ITaskItem>();
public bool InvariantGlobalization { get; set; }
+ public ITaskItem[] FilesToIncludeInFileSystem { get; set; } = Array.Empty<ITaskItem>();
public ITaskItem[] ExtraFilesToDeploy { get; set; } = Array.Empty<ITaskItem>();
public string? DefaultHostConfig { get; set; }
}
}
+ // TODO: Files on disk are not solved for IsSingleFileBundle yet
foreach (ITaskItem item in NativeAssets)
{
string dest = Path.Combine(AppDir, Path.GetFileName(item.ItemSpec));
FileCopyChecked(args.fullPath, Path.Combine(directory, name), "SatelliteAssemblies");
});
- foreach (ITaskItem item in ExtraFilesToDeploy!)
- {
- string src = item.ItemSpec;
- string dst;
+ if (!DeployFiles(ExtraFilesToDeploy, nameof(ExtraFilesToDeploy)))
+ return false;
+ if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem)))
+ return false;
- string tgtPath = item.GetMetadata("TargetPath");
- if (!string.IsNullOrEmpty(tgtPath))
- {
- dst = Path.Combine(AppDir!, tgtPath);
- string? dstDir = Path.GetDirectoryName(dst);
- if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir))
- Directory.CreateDirectory(dstDir!);
- }
- else
+ Directory.CreateDirectory(Path.Combine(AppDir, "tmp"));
+
+ UpdateRuntimeConfigJson();
+ return !Log.HasLoggedErrors;
+
+ bool DeployFiles(ITaskItem[] fileItems, string label)
+ {
+ foreach (ITaskItem item in fileItems)
{
- dst = Path.Combine(AppDir!, Path.GetFileName(src));
+ string src = item.ItemSpec;
+ string dst;
+
+ string tgtPath = item.GetMetadata("TargetPath");
+ if (!string.IsNullOrEmpty(tgtPath))
+ {
+ dst = Path.Combine(AppDir!, tgtPath);
+ string? dstDir = Path.GetDirectoryName(dst);
+ if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir))
+ Directory.CreateDirectory(dstDir!);
+ }
+ else
+ {
+ dst = Path.Combine(AppDir!, Path.GetFileName(src));
+ }
+
+ if (!FileCopyChecked(src, dst, label))
+ return false;
}
- if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy"))
- return false;
+ return true;
}
- UpdateRuntimeConfigJson();
- return !Log.HasLoggedErrors;
}
protected override void AddToRuntimeConfig(JsonObject wasmHostProperties, JsonArray runtimeArgsArray, JsonArray perHostConfigs)