static Dictionary <string, string> SdkVersion(string os) { Dictionary <string, string> versionstuff = new Dictionary <string, string> (); string versiontext = ExecAndCollect.Run("/usr/bin/xcodebuild", $"-version -sdk {os}"); string [] textLines = versiontext.Split(new [] { Environment.NewLine }, StringSplitOptions.None); // returns a set of lines in the form "key: value"; foreach (string line in textLines) { if (line.Contains(':')) { string [] parts = line.Split(':'); if (parts.Length != 2) { continue; } string key = parts [0].Trim(); string val = parts [1].Trim(); versionstuff [key] = val; } } return(versionstuff); }
static PLDict MakeDefaultDict(string pathToLibrary) { PLDict dict = new PLDict(); dict [CFKey.CFBundleDevelopmentRegion.ToString()] = new PLString("en"); dict [CFKey.CFBundleIdentifier.ToString()] = new PLString("xamarin.tomswifty." + Path.GetFileName(pathToLibrary)); dict [CFKey.CFBundleInfoDictionaryVersion.ToString()] = new PLString("6.0"); dict [CFKey.CFBundleName.ToString()] = new PLString(Path.GetFileName(pathToLibrary)); dict [CFKey.CFBundlePackageType.ToString()] = new PLString("FMWK"); dict [CFKey.CFBundleVersion.ToString()] = new PLString("1"); dict [CFKey.CFBundleShortVersionString.ToString()] = new PLString("1.0"); dict [CFKey.CFBundleSignature.ToString()] = new PLString("????"); dict ["NSPrincipalClass"] = new PLString(""); dict [CFKey.CFBundleExecutable.ToString()] = new PLString(Path.GetFileName(pathToLibrary)); dict ["DTCompiler"] = new PLString("com.apple.compilers.llvm.clang.1_0"); try { string buildVersion = ExecAndCollect.Run("/usr/bin/sw_vers", "-buildVersion"); dict ["BuildMachineOSBuild"] = new PLString(buildVersion.TrimEnd('\r', ' ', '\n')); } catch { } try { string buildversions = ExecAndCollect.Run("/usr/bin/xcodebuild", "-version"); string [] textLines = buildversions.Split(new [] { Environment.NewLine }, StringSplitOptions.None); foreach (string line in textLines) { if (line.Contains("Xcode")) { int lastSpace = line.LastIndexOf(' '); if (lastSpace >= 0) { string [] versionparts = line.Substring(lastSpace + 1).Split('.'); if (versionparts.Length == 3) { string xcodeversion = String.Format("{0}{1}{2}{3}", versionparts [0].Length <= 1 ? "0" : "", versionparts [0], versionparts [1], versionparts [2]); dict ["DTXcode"] = new PLString(xcodeversion); } } } else if (line.Contains("Build")) { int lastSpace = line.LastIndexOf(' '); if (lastSpace >= 0) { string xcodebuildversion = line.Substring(lastSpace + 1).TrimEnd('\r', '\n', ' '); dict ["DTXcodeBuild"] = new PLString(xcodebuildversion); } } } } catch { } return(dict); }