public ISet <UFile> RetrieveCompilationInputFiles() { if (sourceFiles == null) { var collector = new SourceFilesCollector(); sourceFiles = collector.GetCompilationInputFiles(Asset); } return(sourceFiles); }
/// <summary> /// Ensures that the sources of an <see cref="Asset"/> exist. /// </summary> /// <param name="result">The <see cref="AssetCompilerResult"/> in which to output log of potential errors.</param> /// <param name="asset">The asset to check.</param> /// <param name="assetAbsolutePath">The absolute path of the asset on the disk</param> /// <returns><c>true</c> if the source file exists, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">Any of the argument is <c>null</c>.</exception> protected static bool EnsureSourcesExist(AssetCompilerResult result, T asset, UFile assetAbsolutePath) { if (result == null) { throw new ArgumentNullException(nameof(result)); } if (asset == null) { throw new ArgumentNullException(nameof(asset)); } if (assetAbsolutePath == null) { throw new ArgumentNullException(nameof(assetAbsolutePath)); } var collector = new SourceFilesCollector(); var sourceMembers = collector.GetSourceMembers(asset); foreach (var member in sourceMembers) { if (string.IsNullOrEmpty(member.Value)) { result.Error($"Source is null for Asset [{asset}] in property [{member.Key}]"); return(false); } // Get absolute path of asset source on disk var assetDirectory = assetAbsolutePath.GetParent(); var assetSource = UPath.Combine(assetDirectory, member.Value); // Ensure the file exists if (!File.Exists(assetSource)) { result.Error($"Unable to find the source file '{assetSource}' for Asset [{asset}]"); return(false); } } return(true); }