public static SwiftTargetCompilerInfo Create(SwiftCompilerLocation compilerLocation, string target)
        {
            if (compilerLocation == null)
            {
                throw new ArgumentNullException(nameof(compilerLocation));
            }

            string pathToCompilerLib = compilerLocation.SwiftCompilerLib;
            string sdkPath           = "";

            if (target != null)
            {
                string parent = ReliablePath.GetParentDirectory(pathToCompilerLib);
                sdkPath           = SdkForTarget(target);
                pathToCompilerLib = Path.Combine(parent, sdkPath);
            }

            if (!Directory.Exists(pathToCompilerLib))
            {
                throw ErrorHelper.CreateError(ReflectorError.kCantHappenBase + 18, $"Unable to find path to compiler library directory '{pathToCompilerLib}'.");
            }

            string swiftc = Path.Combine(compilerLocation.SwiftCompilerBin, "swiftc");
            string swift  = Path.Combine(compilerLocation.SwiftCompilerBin, "swift");

            return(new SwiftTargetCompilerInfo(target, compilerLocation.SwiftCompilerBin, pathToCompilerLib, swiftc, swift, sdkPath));
        }
Пример #2
0
 public WrappingCompiler(string outputDirectory, SwiftCompilerLocation compilerLocation,
                         bool retainSwiftFiles, TypeMapper typeMapper, bool verbose, ErrorHandling errors)
 {
     this.outputDirectory  = Ex.ThrowOnNull(outputDirectory, "outputDirectory");
     CompilerLocation      = Ex.ThrowOnNull(compilerLocation, "compilerLocation");
     this.retainSwiftFiles = retainSwiftFiles;
     this.typeMapper       = Ex.ThrowOnNull(typeMapper, "typeMapper");
     this.verbose          = verbose;
     this.errors           = errors;
 }