libs working
This commit is contained in:
@@ -163,7 +163,7 @@ static void CleanDirectory(string dirName)
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteNublib(string outputPath, string archivePath, ModuleGraph.Manifest manifest)
|
||||
static void WriteNublib(string outputPath, string archivePath, Manifest manifest)
|
||||
{
|
||||
using var fs = new FileStream(outputPath, FileMode.Create);
|
||||
using var zip = new ZipArchive(fs, ZipArchiveMode.Create);
|
||||
@@ -174,6 +174,8 @@ static void WriteNublib(string outputPath, string archivePath, ModuleGraph.Manif
|
||||
WriteIndented = true,
|
||||
});
|
||||
|
||||
File.WriteAllText(".build/manifest.json", serialized);
|
||||
|
||||
var manifestEntry = zip.CreateEntry("manifest.json");
|
||||
using (var writer = new StreamWriter(manifestEntry.Open()))
|
||||
{
|
||||
@@ -195,11 +197,11 @@ static NublibLoadResult ReadNublib(string nublibPath)
|
||||
|
||||
var manifestEntry = zip.GetEntry("manifest.json") ?? throw new FileNotFoundException("Manifest not found in nublib", "manifest.json");
|
||||
|
||||
ModuleGraph.Manifest manifest;
|
||||
Manifest manifest;
|
||||
using (var reader = new StreamReader(manifestEntry.Open()))
|
||||
{
|
||||
var json = reader.ReadToEnd();
|
||||
manifest = JsonSerializer.Deserialize<ModuleGraph.Manifest>(json) ?? throw new InvalidDataException("Failed to deserialize manifest.json");
|
||||
manifest = JsonSerializer.Deserialize<Manifest>(json) ?? throw new InvalidDataException("Failed to deserialize manifest.json");
|
||||
}
|
||||
|
||||
var archiveEntry = zip.Entries.FirstOrDefault(e => e.Name.EndsWith(".a")) ?? throw new FileNotFoundException("Archive not found in nublib", "*.a");
|
||||
@@ -214,4 +216,4 @@ static NublibLoadResult ReadNublib(string nublibPath)
|
||||
return new NublibLoadResult(manifest, tempArchivePath);
|
||||
}
|
||||
|
||||
public record NublibLoadResult(ModuleGraph.Manifest Manifest, string ArchivePath);
|
||||
public record NublibLoadResult(Manifest Manifest, string ArchivePath);
|
||||
|
||||
Reference in New Issue
Block a user