Compare commits
No commits in common. "cce6e009604fdae0eec45f326dea5dbac38087a6" and "7a81026ca527f26c415a3ece102ed0df4e162ac9" have entirely different histories.
cce6e00960
...
7a81026ca5
@ -37,69 +37,65 @@ public void Run(BuildArgs args)
|
|||||||
CollectAssetFiles(absContentPath, absContentPath, ref contentFiles);
|
CollectAssetFiles(absContentPath, absContentPath, ref contentFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentFiles.Count > 0)
|
string importPath = $"{args.ProjectPath}/{PathUtil.ImportFolderName}";
|
||||||
|
|
||||||
|
ParallelOptions parallelOptions = new ParallelOptions
|
||||||
{
|
{
|
||||||
string importPath = $"{args.ProjectPath}/{PathUtil.ImportFolderName}";
|
MaxDegreeOfParallelism = contentFiles.Count
|
||||||
|
};
|
||||||
ParallelOptions parallelOptions = new ParallelOptions
|
Parallel.ForEach(contentFiles, parallelOptions, relativeFile =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
MaxDegreeOfParallelism = contentFiles.Count
|
string inFile = $"{args.ProjectPath}/{PathUtil.ContentFolderName}/{relativeFile}";
|
||||||
};
|
|
||||||
|
|
||||||
Parallel.ForEach(contentFiles, parallelOptions, relativeFile =>
|
if (!File.Exists(inFile))
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine($"Asset file '{relativeFile}' not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string outFile = $"{importPath}/{relativeFile}{PathUtil.ImportedFileExtension}";
|
||||||
|
|
||||||
|
FileInfo inFileInfo = new FileInfo(inFile);
|
||||||
|
FileInfo outFileInfo = new FileInfo(outFile);
|
||||||
|
|
||||||
|
if (!FileUtil.IsNewer(inFileInfo, outFileInfo))
|
||||||
|
{
|
||||||
|
// File has not changed since last build, no need to build this one.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string outDir = Path.GetDirectoryName(outFile);
|
||||||
|
if (!Directory.Exists(outDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(outDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
string ext = Path.GetExtension(inFile).ToLower();
|
||||||
|
if (importers.TryGetValue(ext, out IImporter importer))
|
||||||
|
{
|
||||||
|
importer.Import(inFile, outFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawFileImporter.Import(inFile, outFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine(relativeFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
try
|
Console.Error.WriteLine($"Import error on asset '{relativeFile}': {e.Message}");
|
||||||
{
|
}
|
||||||
string inFile = $"{args.ProjectPath}/{PathUtil.ContentFolderName}/{relativeFile}";
|
});
|
||||||
|
|
||||||
if (!File.Exists(inFile))
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"Asset file '{relativeFile}' not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string outFile = $"{importPath}/{relativeFile}{PathUtil.ImportedFileExtension}";
|
|
||||||
|
|
||||||
FileInfo inFileInfo = new FileInfo(inFile);
|
|
||||||
FileInfo outFileInfo = new FileInfo(outFile);
|
|
||||||
|
|
||||||
if (!FileUtil.IsNewer(inFileInfo, outFileInfo))
|
|
||||||
{
|
|
||||||
// File has not changed since last build, no need to build this one.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string outDir = Path.GetDirectoryName(outFile);
|
|
||||||
if (!Directory.Exists(outDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(outDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
string ext = Path.GetExtension(inFile).ToLower();
|
|
||||||
if (importers.TryGetValue(ext, out IImporter importer))
|
|
||||||
{
|
|
||||||
importer.Import(inFile, outFile);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rawFileImporter.Import(inFile, outFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine(relativeFile);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine($"Import error on asset '{relativeFile}': {e.Message}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine($"Build content completed in {stopwatch.Elapsed.TotalSeconds:F2} seconds");
|
Console.WriteLine($"Build content completed in {stopwatch.Elapsed.TotalSeconds:F2} seconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyLibs(string projectPath)
|
private void CopyLibs(string projectPath)
|
||||||
{
|
{
|
||||||
string libDir = $"{AppDomain.CurrentDomain.BaseDirectory}/../../Native/";
|
string libDir = $"{Directory.GetCurrentDirectory()}/../../Native/";
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
libDir += "x64";
|
libDir += "x64";
|
||||||
|
Loading…
Reference in New Issue
Block a user