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); }
static void AddInOSSpecifics(string os, MachOFile.MinOSVersion osmin, PLDict dict) { Dictionary <string, string> versioninfo = SdkVersion(os); string val = null; dict ["DTPlatformName"] = new PLString("DTPlatformName"); if (versioninfo.TryGetValue("ProductBuildVersion", out val)) { dict ["DTPlatformBuild"] = new PLString(val); dict ["DTSDKBuild"] = new PLString(val); val = null; } if (versioninfo.TryGetValue("PlatformVersion", out val)) { dict ["DTPlatformVersion"] = new PLString(val); dict ["DTSDKName"] = new PLString(os + val); } dict ["MinimumOSVersion"] = new PLString(osmin.Version.ToString()); PLArray supportedPlatforms = new PLArray(); dict ["CFBundleSupportedPlatforms"] = supportedPlatforms; switch (os) { case "iphoneos": // iPhoneOS supportedPlatforms.Add(new PLString("iPhoneOS")); PLArray devfamily = new PLArray(); devfamily.Add(new PLInteger(1)); devfamily.Add(new PLInteger(2)); dict ["UIDeviceFamily"] = devfamily; break; case "appletvos": // AppleTVOS supportedPlatforms.Add(new PLString("AppleTVOS")); break; case "watchos": // WatchOS supportedPlatforms.Add(new PLString("WatchOS")); break; default: break; } }