Changed csharp script compilation algorithm to be best effort.
This commit is contained in:
@@ -335,10 +335,10 @@ public sealed class ModConfigService : IModConfigService
|
|||||||
.Select(fp => ContentPath.FromRaw(srcPackage,
|
.Select(fp => ContentPath.FromRaw(srcPackage,
|
||||||
$"%ModDir%/{Path.GetRelativePath(srcPackage.Dir, fp)}".CleanUpPathCrossPlatform()))
|
$"%ModDir%/{Path.GetRelativePath(srcPackage.Dir, fp)}".CleanUpPathCrossPlatform()))
|
||||||
.Concat(sharedFiles).ToImmutableArray(),
|
.Concat(sharedFiles).ToImmutableArray(),
|
||||||
FriendlyName = IAssemblyLoaderService.InternalsAwareAssemblyName,
|
FriendlyName = IAssemblyLoaderService.InternalsAwareAssemblyName, // give the best chance of success (InternalsAware + Publicizer)
|
||||||
IncompatiblePackages = ImmutableArray<Identifier>.Empty,
|
IncompatiblePackages = ImmutableArray<Identifier>.Empty,
|
||||||
RequiredPackages = ImmutableArray<Identifier>.Empty,
|
RequiredPackages = ImmutableArray<Identifier>.Empty,
|
||||||
UseInternalAccessName = true,
|
UseInternalAccessName = false, //compile as public and then fallback to internals
|
||||||
IsScript = true,
|
IsScript = true,
|
||||||
IsReferenceModeOnly = false
|
IsReferenceModeOnly = false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -677,6 +677,8 @@ public class PluginManagementService : IAssemblyManagementService
|
|||||||
// overwrite result with good compilation
|
// overwrite result with good compilation
|
||||||
if (res2.IsSuccess)
|
if (res2.IsSuccess)
|
||||||
{
|
{
|
||||||
|
var reasonsStr = res.Reasons.Aggregate("", (accum, reason) => accum + "\n" + reason.Message);
|
||||||
|
_logger.LogWarning($"Attempted compilation of {scripts.Key} for package {contentPackRes.Key.Name} succeeded. Original errors were: \n {reasonsStr}");
|
||||||
res = res2;
|
res = res2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user