void CompileAllFiles(TempDirectorySwiftClassFileProvider fileProvider, string moduleName, string outputLibraryName, string outputLibraryPath, string [] inputModulePaths, string [] inputLibraryPaths, string [] inputModuleNames, string target, bool outputIsFramework) { SwiftTargetCompilerInfo compilerInfo = CompilerLocation.GetTargetInfo(target); using (CustomSwiftCompiler compiler = new CustomSwiftCompiler(compilerInfo, fileProvider, false)) { compiler.Verbose = verbose; string [] sourceFiles = fileProvider.CompletedFileNames.ToArray(); SwiftCompilerOptions options = new SwiftCompilerOptions(moduleName, inputModulePaths, inputLibraryPaths, inputModuleNames); compiler.Compile(options, outputIsFramework, sourceFiles); } }
List <ClassDeclaration> ReflectClassDeclarations(string code) { using (TempDirectoryFilenameProvider fileProvider = new TempDirectoryFilenameProvider(null, false)) { CustomSwiftCompiler compiler = Utils.DefaultSwiftCompiler(fileProvider); SwiftCompilerOptions options = new SwiftCompilerOptions("NameNotImportant", null, null, null); compiler.CompileString(options, code); List <ModuleDeclaration> modules = compiler.ReflectToModules(new string [] { compiler.DirectoryPath }, new string [] { compiler.DirectoryPath }, "", "NameNotImportant"); Assert.AreEqual(1, modules.Count); return(modules [0].AllClasses); } }
public static CustomSwiftCompiler CompileSwift(string swiftCode, DisposableTempDirectory provider = null, string moduleName = "Xython", string target = "x86_64-apple-macosx10.9") { CustomSwiftCompiler compiler = DefaultSwiftCompiler(provider, target: target); string [] includeDirectories = null; List <string> libraryDirectories = new List <string> { compiler.DirectoryPath, Compiler.kSwiftRuntimeGlueDirectory }; if (provider != null) { includeDirectories = new string [] { provider.DirectoryPath }; libraryDirectories.Add(provider.DirectoryPath); } SwiftCompilerOptions options = new SwiftCompilerOptions(moduleName, includeDirectories, libraryDirectories.ToArray(), new string [] { "XamGlue" }); compiler.CompileString(options, swiftCode); return(compiler); }