public static ExportResponse Run( Platform.AbstractPlatform platform, string projectDirectory, string outputDirectory, BuildData buildData) { if (platform == null) { throw new InvalidOperationException("Unrecognized platform. See usage."); } if (!Path.IsAbsolute(outputDirectory)) { outputDirectory = FileUtil.JoinPath(projectDirectory, outputDirectory); } outputDirectory = FileUtil.GetCanonicalizeUniversalPath(outputDirectory); FileOutputExporter exporter = new FileOutputExporter(outputDirectory); Dictionary <string, FileOutput> result = new Dictionary <string, FileOutput>(); ExportProperties exportProperties = buildData.ExportProperties; platform.GleanInformationFromPreviouslyExportedProject(exportProperties, outputDirectory); platform.ExportProject(result, buildData, exportProperties); exporter.ExportFiles(result); return(new ExportResponse()); }
private Dictionary <string, Pastel.PastelCompiler> GenerateLibraryParseTree( Platform.AbstractPlatform platform, Dictionary <string, object> constantFlags, InlineImportCodeLoader codeLoader, ICollection <Library> relevantLibraries, Pastel.PastelCompiler sharedScope) { using (new PerformanceSection("VmGenerator.GenerateLibraryParseTree")) { Dictionary <string, Pastel.PastelCompiler> libraries = new Dictionary <string, Pastel.PastelCompiler>(); foreach (Library library in relevantLibraries) { string libName = library.Name; Dictionary <string, object> constantsLookup = Util.MergeDictionaries <string, object>(constantFlags, library.CompileTimeConstants); Pastel.PastelCompiler compiler = new Pastel.PastelCompiler( true, sharedScope, constantsLookup, codeLoader, library.GetReturnTypesForNativeMethods(), library.GetArgumentTypesForNativeMethods()); libraries[libName] = compiler; Dictionary <string, string> supplementalCode = library.GetSupplementalTranslatedCode(false); Dictionary <string, string> pastelSupplementalCode = library.GetSupplementalTranslatedCode(true); Dictionary <string, string> translatedCode = library.GetNativeCode(); // need to load from the actual Library instance, which could have come from either CRAYON_HOME or source string registryCode = library.GetRegistryCode(); if (registryCode == null) { if (supplementalCode.Count > 0 || translatedCode.Count > 0) { throw new InvalidOperationException("The library '" + libName + "' has translated code but no function_registry.pst file."); } } else { compiler.CompileBlobOfCode("LIB:" + libName + "/function_registry.pst", registryCode); foreach (string supplementalFile in supplementalCode.Keys) { string code = supplementalCode[supplementalFile]; compiler.CompileBlobOfCode("LIB:" + libName + "/supplemental/" + supplementalFile, code); } foreach (string translatedFile in translatedCode.Keys) { string code = translatedCode[translatedFile]; compiler.CompileBlobOfCode("LIB:" + libName + "/translate/" + translatedFile, code); } compiler.Resolve(); } } return(libraries); } }
private static void ExportStandaloneVm(Dictionary <string, string> args) { using (new PerformanceSection("ExportStandaloneVm")) { string vm; string targetDirectory; if (!args.TryGetValue(FlagParser.VM, out vm) || !args.TryGetValue(FlagParser.VM_DIR, out targetDirectory)) { throw new InvalidOperationException("-vm and -vmdir flags must both have correct values."); } Platform.AbstractPlatform standaloneVmPlatform = platformProvider.GetPlatform(vm); targetDirectory = FileUtil.FinalizeTilde(targetDirectory); VmGenerator vmGenerator = new VmGenerator(); List <Library> allLibraries = new LibraryManager(platformProvider).GetAllAvailableLibraries(standaloneVmPlatform); Dictionary <string, FileOutput> result = vmGenerator.GenerateVmSourceCodeForPlatform( standaloneVmPlatform, null, null, allLibraries, VmGenerationMode.EXPORT_VM_AND_LIBRARIES); FileOutputExporter exporter = new FileOutputExporter(targetDirectory); exporter.ExportFiles(result); } }
public Library CloneWithNewPlatform(Platform.AbstractPlatform platform) { return(new Library( this.Name, System.IO.Path.Combine(this.RootDirectory, "manifest.txt"), platform)); }
private Pastel.PastelCompiler GenerateCoreVmParseTree( Platform.AbstractPlatform platform, IInlineImportCodeLoader codeLoader, Dictionary <string, object> constantFlags) { using (new PerformanceSection("VmGenerator.GenerateCoreVmParseTree")) { Pastel.PastelCompiler compiler = new Pastel.PastelCompiler( false, null, constantFlags, codeLoader, null, null); foreach (string file in INTERPRETER_BASE_FILES) { string code = codeLoader.LoadCode(file); compiler.CompileBlobOfCode(file, code); } compiler.Resolve(); return(compiler); } }
private List <Platform.LibraryForExport> GetLibrariesForExport( Platform.AbstractPlatform platform, Dictionary <string, Library> librariesByName, Dictionary <string, object> constantFlags, Pastel.PastelCompiler vm) { using (new PerformanceSection("VmGenerator.GetLibrariesForExport")) { Dictionary <string, Pastel.PastelCompiler> libraryCompilation = this.GenerateLibraryParseTree( platform, constantFlags, new InlineImportCodeLoader(), librariesByName.Values, vm); List <Platform.LibraryForExport> libraries = new List <Platform.LibraryForExport>(); Dictionary <string, Library> libraryByName = new Dictionary <string, Library>(); foreach (string libraryName in libraryCompilation.Keys.OrderBy(s => s)) { Library library = librariesByName[libraryName]; libraryByName[library.Name] = library; Platform.LibraryForExport libraryForExport = this.CreateLibraryForExport( library.Name, library.Version, libraryCompilation[library.Name], library.Resources); libraries.Add(libraryForExport); } // Now that all libraries are read and initialized, go through and resolve all deferred DLL's that required all libraries to be loaded. foreach (Platform.LibraryForExport lfe in libraries) { foreach (Platform.ExportEntity ee in lfe.ExportEntities.GetValueEnumerator()) { if (ee.DeferredFileOutputBytesLibraryName != null) { Library sourceLibrary; if (!libraryByName.TryGetValue(ee.DeferredFileOutputBytesLibraryName, out sourceLibrary)) { throw new InvalidOperationException("The library '" + lfe.Name + "' makes reference to another library '" + ee.DeferredFileOutputBytesLibraryName + "' which could not be found."); } string resourcePath = "resources/" + ee.DeferredFileOutputBytesLibraryPath; byte[] dllFile = sourceLibrary.ReadFileBytes(resourcePath); if (dllFile == null) { throw new InvalidOperationException("Could not find file: '" + resourcePath + "' in library '" + sourceLibrary.Name + "'"); } ee.FileOutput = new FileOutput() { Type = FileOutputType.Binary, BinaryContent = dllFile }; } } } return(libraries); } }
private LibraryExporter(LibraryMetadata metadata, Platform.AbstractPlatform platform) { TODO.LibrariesNeedVersionNumber(); this.Metadata = metadata; this.platformName = platform.Name; this.Resources = new LibraryResourceDatabase(this, platform); this.CompileTimeConstants = this.LoadFlagsForPlatform(platform); this.filepathsByFunctionName = new Dictionary <string, string>(); // Build a lookup dictionary of all file names that are simple function names e.g. "foo.cry" // Then go through and look up all the file names that contain . prefixes with the platform name and // overwrite the lookup value for that entry with the more specific path. // myFunction.cry // android.myFunction.cry // on Python, myFunction will be included for lib_foo_myFunction(), but on Android, android.myFunction.cry will be included instead. string[] files = new string[0]; if (FileUtil.DirectoryExists(this.Metadata.Directory + "/translate")) { files = FileUtil.DirectoryListFileNames(FileUtil.JoinPath(this.Metadata.Directory, "translate")); } Dictionary <string, string> moreSpecificFiles = new Dictionary <string, string>(); foreach (string file in files) { if (file.EndsWith(".pst")) { string functionName = file.Substring(0, file.Length - ".pst".Length); if (functionName.Contains('.')) { // Add this file to the more specific lookup, but only if it contains the current platform. if (functionName.StartsWith(platformName + ".") || functionName.Contains("." + platformName + ".")) { string[] parts = functionName.Split('.'); moreSpecificFiles[parts[parts.Length - 1]] = file; } else { // just let it get filtered away. } } else { this.filepathsByFunctionName[functionName] = file; } } } foreach (string functionName in moreSpecificFiles.Keys) { this.filepathsByFunctionName[functionName] = moreSpecificFiles[functionName]; } }
public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args) { ExportCommand command = (ExportCommand)args[0].Value; Platform.AbstractPlatform standaloneVmPlatform = command.PlatformProvider.GetPlatform(command.VmPlatform); return(new CrayonWorkerResult() { Value = standaloneVmPlatform }); }
// TODO: this ought to go away and the cache needs to move to some sort of scope whose lifetime is tied to a specific compilation scope. public static LibraryExporter Get(LibraryMetadata metadata, Platform.AbstractPlatform platform) { string key = GetLibKey(metadata, platform); if (!libraryCache.ContainsKey(key)) { libraryCache[key] = new LibraryExporter(metadata, platform); } return(libraryCache[key]); }
public void ApplyExtensibleFunctionTranslationsToTranspilerContext(Platform.AbstractPlatform platform, TranspilerContext ctx) { Dictionary <string, string> translations = this.GetExtensibleFunctionTranslations(platform); foreach (string fnNameRaw in translations.Keys) { // TODO: remove these dollar signs from the actual library code. string fnName = fnNameRaw.StartsWith("$") ? fnNameRaw.Substring(1) : fnNameRaw; ctx.ExtensibleFunctionLookup[fnName] = translations[fnNameRaw]; } }
private LibraryExporter(AssemblyMetadata metadata, Platform.AbstractPlatform platform) { TODO.LibrariesNeedVersionNumber(); this.Metadata = metadata; this.platformName = platform.Name; this.Resources = new LibraryResourceDatabase(this, platform); this.CompileTimeConstants = this.LoadFlagsForPlatform(platform); }
private static void ExportVmBundle(Dictionary <string, string> argLookup) { using (new PerformanceSection("ExportVmBundle")) { BuildContext buildContext = GetBuildContext(argLookup); Platform.AbstractPlatform platform = GetPlatformInstance(buildContext); if (platform == null) { throw new InvalidOperationException("Unrecognized platform. See usage."); } CompilationBundle compilationResult = CompilationBundle.Compile(buildContext); // Need to re-instantiate the libraries. The libraries are instantiated in a platform-context-free // for the purpose of compiling the byte code. For the VM bundle, they need to know about the platform. Library[] libraries; using (new PerformanceSection("Program.ExportVmBundle.CloneLibraries")) { libraries = compilationResult.LibrariesUsed .Select(lib => lib.CloneWithNewPlatform(platform)) .ToArray(); } ResourceDatabase resourceDatabase = PrepareResources(buildContext, compilationResult.ByteCode); string outputDirectory = buildContext.OutputFolder; if (!FileUtil.IsAbsolutePath(outputDirectory)) { outputDirectory = FileUtil.JoinPath(buildContext.ProjectDirectory, outputDirectory); } outputDirectory = FileUtil.GetCanonicalizeUniversalPath(outputDirectory); FileOutputExporter exporter = new FileOutputExporter(outputDirectory); VmGenerator vmGenerator = new VmGenerator(); Dictionary <string, FileOutput> result = vmGenerator.GenerateVmSourceCodeForPlatform( platform, compilationResult, resourceDatabase, libraries, outputDirectory, VmGenerationMode.EXPORT_SELF_CONTAINED_PROJECT_SOURCE); exporter.ExportFiles(result); if (argLookup.ContainsKey(FlagParser.LIBRARY_DEP_TREE)) { string libs = LibraryDependencyResolver.GetDependencyTreeLog(compilationResult.LibrariesUsed.ToArray()); Console.WriteLine("<LibraryDependencies>"); Console.WriteLine(libs.Trim()); Console.WriteLine("</LibraryDependencies>"); } } }
public Library ImportLibrary(Parser parser, Token throwToken, string name, List <Executable> executablesOut) { name = name.Split('.')[0]; Library library = librariesAlreadyImportedIndexByName.ContainsKey(name) ? librariesAlreadyImported[librariesAlreadyImportedIndexByName[name]] : null; if (library == null) { string libraryManifestPath = this.GetSystemLibraryPath(name, parser.BuildContext.CrayonPath, parser.BuildContext.ProjectDirectory); if (libraryManifestPath == null) { // No library found. Could just be a local namespace import. // If this is a bogus import, it'll throw in the Resolver. return(null); } string platformName = parser.BuildContext.Platform; Platform.AbstractPlatform platform = platformName == null || this.PlatformProvider == null ? null : this.PlatformProvider.GetPlatform(platformName); library = new Library(name, libraryManifestPath, platform); this.librariesAlreadyImportedIndexByName[name] = this.librariesAlreadyImported.Count; this.librariesAlreadyImported.Add(library); this.importedLibraries[name] = library; this.librariesByKey[name.ToLowerInvariant()] = library; string oldSystemLibrary = parser.CurrentSystemLibrary; parser.CurrentSystemLibrary = name; Dictionary <string, string> embeddedCode = library.GetEmbeddedCode(); foreach (string embeddedFile in embeddedCode.Keys) { string fakeName = "[" + embeddedFile + "]"; string code = embeddedCode[embeddedFile]; parser.PushLocale(ENGLISH_LOCALE_FOR_LIBRARIES); executablesOut.AddRange(parser.ParseInterpretedCode(fakeName, code, name)); parser.PopLocale(); } parser.CurrentSystemLibrary = oldSystemLibrary; } // Even if already imported, still must check to see if this import is allowed here. if (!library.IsAllowedImport(parser.CurrentSystemLibrary)) { throw new ParserException(throwToken, "This library cannot be imported from here."); } return(library); }
public Dictionary <string, string> GetExtensibleFunctionTranslations(Platform.AbstractPlatform platform) { if (this.translationsLookup == null) { this.translationsLookup = new Dictionary <string, string>(); foreach (string inheritedPlatformName in platform.InheritanceChain.Reverse()) { Dictionary <string, string> translationsForPlatform = this.Metadata.GetMethodTranslations(inheritedPlatformName); this.translationsLookup = Util.MergeDictionaries(translationsLookup, translationsForPlatform); } } return(this.translationsLookup); }
public List <Library> GetAllAvailableLibraries(Platform.AbstractPlatform platform) { Dictionary <string, string> allLibraries = GetAvailableLibraryPathsByLibraryName(null, null); List <Library> output = new List <Library>(); foreach (string name in allLibraries.Keys) { string manifestPath = allLibraries[name]; Library library = new Library(name, manifestPath, platform); output.Add(library); } return(output); }
public AbstractTranslator(Platform.AbstractPlatform platform, string tab, string newLine) { this.Platform = platform; this.NewLine = newLine; this.tabChar = tab; this.tabs = new string[20]; this.tabs[0] = ""; for (int i = 1; i < 20; ++i) { this.tabs[i] = this.tabs[i - 1] + this.tabChar; } this.TabDepth = 0; }
public void DoWorkImpl( Dictionary <string, FileOutput> fileOutput, Platform.AbstractPlatform platform, AssemblyMetadata[] allLibraries, string vmTargetDir, ExportCommand command) { new VmGenerator().GenerateVmSourceCodeForPlatform( fileOutput, platform, null, null, allLibraries, vmTargetDir, VmGenerationMode.EXPORT_VM_AND_LIBRARIES); }
public ExportBundle ExportVmBundle(ExportCommand command, BuildContext buildContext) { // TODO: Worker: platform = GetPlatform(buildContext, command) string platformId = buildContext.Platform.ToLowerInvariant(); Platform.AbstractPlatform platform = command.PlatformProvider.GetPlatform(platformId); if (platform == null) { throw new InvalidOperationException("Unrecognized platform. See usage."); } // TODO: Worker: Compile ExportBundle compilationResult = ExportBundle.Compile(buildContext); AssemblyMetadata[] libraries = compilationResult.LibraryScopesUsed.Select(scope => scope.Metadata).ToArray(); ResourceDatabase resourceDatabase = ResourceDatabaseBuilder.PrepareResources(buildContext, compilationResult.ByteCode); string outputDirectory = command.HasOutputDirectoryOverride ? command.OutputDirectoryOverride : buildContext.OutputFolder; if (!Path.IsAbsolute(outputDirectory)) { outputDirectory = FileUtil.JoinPath(buildContext.ProjectDirectory, outputDirectory); } outputDirectory = FileUtil.GetCanonicalizeUniversalPath(outputDirectory); FileOutputExporter exporter = new FileOutputExporter(outputDirectory); VmGenerator vmGenerator = new VmGenerator(); Dictionary <string, FileOutput> result = new Dictionary <string, FileOutput>(); vmGenerator.GenerateVmSourceCodeForPlatform( result, platform, compilationResult, resourceDatabase, libraries, outputDirectory, VmGenerationMode.EXPORT_SELF_CONTAINED_PROJECT_SOURCE); exporter.ExportFiles(result); // TODO: this needs to be the result of an earlier step after this is split into workers. return(compilationResult); }
private Dictionary <string, object> LoadFlagsForPlatform(Platform.AbstractPlatform platform) { Dictionary <string, object> flags = new Dictionary <string, object>(); List <string> platformChain = new List <string>() { "default" }; if (platform != null) { platformChain.AddRange(platform.InheritanceChain.Reverse()); } foreach (string platformId in platformChain) { Dictionary <string, object> mergeFlagsWith = this.LoadFlagsFromFile(platformId); flags = Util.MergeDictionaries(flags, mergeFlagsWith); } return(flags); }
private List <Platform.LibraryForExport> GetLibrariesForExportPastelFree( Platform.AbstractPlatform platform, Dictionary <string, AssemblyMetadata> librariesById) { List <Platform.LibraryForExport> output = new List <Platform.LibraryForExport>(); foreach (string libraryId in librariesById.Keys.OrderBy(k => k)) { AssemblyMetadata libraryMetadata = librariesById[libraryId]; LibraryExporter library = LibraryExporter.Get(libraryMetadata, platform); Platform.LibraryForExport libraryForExport = this.CreateLibraryForExport( libraryMetadata.ID, libraryMetadata.Version, libraryMetadata.Directory, library.Resources); output.Add(libraryForExport); } return(output); }
private PastelContext GenerateCoreVmParseTree( Platform.AbstractPlatform platform, IInlineImportCodeLoader codeLoader, Dictionary <string, object> constantFlags) { using (new PerformanceSection("VmGenerator.GenerateCoreVmParseTree")) { PastelContext context = new PastelContext(platform.Language, codeLoader); foreach (string key in constantFlags.Keys) { context.SetConstant(key, constantFlags[key]); } foreach (string file in INTERPRETER_BASE_FILES) { context.CompileFile(file); } context.FinalizeCompilation(); return(context); } }
public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args) { Dictionary <string, FileOutput> fileOutput = (Dictionary <string, FileOutput>)args[0].Value; Platform.AbstractPlatform platform = (Platform.AbstractPlatform)args[1].Value; LibraryMetadata[] allLibraries = (LibraryMetadata[])args[2].Value; string vmTargetDir = (string)args[3].Value; ExportCommand command = (ExportCommand)args[4].Value; new VmGenerator().GenerateVmSourceCodeForPlatform( fileOutput, platform, null, null, allLibraries, vmTargetDir, command.InlineImportCodeLoader, VmGenerationMode.EXPORT_VM_AND_LIBRARIES); return(new CrayonWorkerResult()); }
public JavaScriptAppChromeTranslator(Platform.AbstractPlatform platform) : base(platform) { }
public Library[] GetAllAvailableBuiltInLibraries(Platform.AbstractPlatform platform) { return(GetAvailableLibraryPathsByLibraryName(null, null) .Select(metadata => new Library(metadata, platform)) .ToArray()); }
public CSharpTranslator(Platform.AbstractPlatform platform) : base(platform, " ", "\r\n", false) { }
public Library ImportLibrary(Parser parser, Token throwToken, string name) { name = name.Split('.')[0]; string key = parser.CurrentLocale.ID + ":" + name; LibraryMetadata libraryMetadata = this.GetLibraryMetadataFromAnyPossibleKey(key); if (libraryMetadata == null) { // check for default locale libraryMetadata = this.GetLibraryMetadataFromAnyPossibleKey(name); if (libraryMetadata == null) { // No library found. Could just be a local namespace import. // If this is a bogus import, it'll throw in the Resolver. return(null); } if (libraryMetadata.SupportedLocales.Contains(parser.CurrentLocale)) { // If you import something by its default name from a supported locale, then it doesn't count. // Don't throw an error. A user should be able to define a namespace that happens to have the // same name as a library in some locale they aren't using. return(null); } } Library library = librariesAlreadyImportedIndexByKey.ContainsKey(libraryMetadata.CanonicalKey) ? librariesAlreadyImported[librariesAlreadyImportedIndexByKey[libraryMetadata.CanonicalKey]] : null; if (library == null) { string platformName = parser.BuildContext.Platform; Platform.AbstractPlatform platform = platformName == null || this.PlatformProvider == null ? null : this.PlatformProvider.GetPlatform(platformName); library = new Library(libraryMetadata, platform); CompilationScope scope = new CompilationScope(parser.BuildContext, library); library.Scope = scope; library.AddLocaleAccess(parser.CurrentLocale); this.librariesAlreadyImportedIndexByKey[libraryMetadata.CanonicalKey] = this.librariesAlreadyImported.Count; this.librariesAlreadyImported.Add(library); this.importedLibraries[name] = library; this.librariesByKey[name.ToLowerInvariant()] = library; parser.PushScope(scope); Dictionary <string, string> embeddedCode = library.GetEmbeddedCode(); foreach (string embeddedFile in embeddedCode.Keys) { string fakeName = "[" + embeddedFile + "]"; string code = embeddedCode[embeddedFile]; parser.ParseInterpretedCode(fakeName, code); } parser.PopScope(); } // Even if already imported, still must check to see if this import is allowed here. if (!library.IsAllowedImport(parser.CurrentLibrary)) { throw new ParserException(throwToken, "This library cannot be imported from here."); } return(library); }
private static string GetLibKey(LibraryMetadata metadata, Platform.AbstractPlatform platform) { return(metadata.CanonicalKey + "#" + platform.Name); }
public PythonTranslator(Platform.AbstractPlatform platform) : base(platform, " ", "\n") { this.SwitchStatements = new List <PythonFakeSwitchStatement>(); }
public CSharpAppTranslator(Platform.AbstractPlatform platform) : base(platform) { }
public Dictionary <string, FileOutput> GenerateVmSourceCodeForPlatform( Platform.AbstractPlatform platform, CompilationBundle nullableCompilationBundle, ResourceDatabase resourceDatabase, ICollection <Library> relevantLibraries, VmGenerationMode mode) { using (new PerformanceSection("VmGenerator.GenerateVmSourceCodeForPlatform")) { Options options = new Options(); Dictionary <string, object> constantFlags = platform.GetFlattenedConstantFlags() ?? new Dictionary <string, object>(); this.mode = mode; this.AddTypeEnumsToConstants(constantFlags); Pastel.PastelCompiler vm = this.GenerateCoreVmParseTree(platform, constantFlags); Dictionary <string, Library> librariesByName = relevantLibraries.ToDictionary(lib => lib.Name); List <Platform.LibraryForExport> libraries = this.GetLibrariesForExport(platform, librariesByName, constantFlags, vm); LibraryNativeInvocationTranslatorProvider libTranslationProvider = new LibraryNativeInvocationTranslatorProvider( relevantLibraries.ToDictionary(lib => lib.Name), platform); if (mode == VmGenerationMode.EXPORT_SELF_CONTAINED_PROJECT_SOURCE) { options .SetOption(ExportOptionKey.PROJECT_ID, nullableCompilationBundle.ProjectID) .SetOption(ExportOptionKey.DESCRIPTION, nullableCompilationBundle.Description) .SetOption(ExportOptionKey.VERSION, nullableCompilationBundle.Version) .SetOption(ExportOptionKey.EMBED_BYTE_CODE, nullableCompilationBundle.GuidSeed) .SetOption(ExportOptionKey.EMBED_BYTE_CODE, true) .SetOption(ExportOptionKey.DEFAULT_TITLE, nullableCompilationBundle.DefaultTitle) .SetOption(ExportOptionKey.LIBRARIES_USED, libraries.Cast <object>().ToArray()) .SetOption(ExportOptionKey.HAS_ICON, nullableCompilationBundle.IconPath != null) .SetOption(ExportOptionKey.IOS_BUNDLE_PREFIX, nullableCompilationBundle.IosBundlePrefix) .SetOption(ExportOptionKey.JS_FILE_PREFIX, nullableCompilationBundle.JsFilePrefix); if (options.GetBool(ExportOptionKey.HAS_ICON)) { options.SetOption(ExportOptionKey.ICON_PATH, nullableCompilationBundle.IconPath); } return(platform.ExportProject( vm.Globals.Values.OrderBy(v => v.VariableNameToken.Value).ToArray(), vm.StructDefinitions.Values.OrderBy(s => s.NameToken.Value).ToArray(), vm.FunctionDefinitions.Values.OrderBy(f => f.NameToken.Value).ToArray(), libraries, resourceDatabase, options, libTranslationProvider)); } else { return(platform.ExportStandaloneVm( vm.Globals.Values.OrderBy(v => v.VariableNameToken.Value).ToArray(), vm.StructDefinitions.Values.OrderBy(s => s.NameToken.Value).ToArray(), vm.FunctionDefinitions.Values.OrderBy(f => f.NameToken.Value).ToArray(), libraries, libTranslationProvider)); } } }