static Platform() { OS = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PlatformOS.Windows : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? PlatformOS.OSX : PlatformOS.Linux; string sname = RuntimeInformation.FrameworkDescription; Framework = sname.Contains("Core") ? PlatformFramework.Core : sname.Contains("Framework") ? PlatformFramework.Framework : PlatformFramework.Native; }
public static AppleSdk GetSdk(PlatformFramework framework) { switch (framework) { case PlatformFramework.iOS: return IPhoneSdks.Native; case PlatformFramework.WatchOS: return IPhoneSdks.Watch; case PlatformFramework.TVOS: return IPhoneSdks.TVOS; default: throw new InvalidOperationException (string.Format ("Invalid framework: {0}", framework)); } }
static IBTool CreateIBToolTask(PlatformFramework framework, string projectDir, string intermediateOutputPath, params string[] fileNames) { var ibtool = CreateIBToolTask(framework, projectDir, intermediateOutputPath); var interfaceDefinitions = new List <ITaskItem> (); foreach (var name in fileNames) { interfaceDefinitions.Add(new TaskItem(Path.Combine(projectDir, name))); } ibtool.InterfaceDefinitions = interfaceDefinitions.ToArray(); return(ibtool); }
static IBTool CreateIBToolTask(PlatformFramework framework, string projectDir, string intermediateOutputPath) { var interfaceDefinitions = new List <ITaskItem> (); var sdk = IPhoneSdks.GetSdk(framework); var version = IPhoneSdkVersion.GetDefault(sdk, false); var root = sdk.GetSdkPath(version, false); var usr = Path.Combine(sdk.DeveloperRoot, "usr"); var bin = Path.Combine(usr, "bin"); string platform; switch (framework) { case PlatformFramework.WatchOS: platform = "WatchOS"; break; case PlatformFramework.TVOS: platform = "AppleTVOS"; break; default: platform = "iPhoneOS"; break; } foreach (var item in Directory.EnumerateFiles(projectDir, "*.storyboard", SearchOption.AllDirectories)) { interfaceDefinitions.Add(new TaskItem(item)); } foreach (var item in Directory.EnumerateFiles(projectDir, "*.xib", SearchOption.AllDirectories)) { interfaceDefinitions.Add(new TaskItem(item)); } return(new IBTool { AppManifest = new TaskItem(Path.Combine(projectDir, "Info.plist")), InterfaceDefinitions = interfaceDefinitions.ToArray(), IntermediateOutputPath = intermediateOutputPath, BuildEngine = new TestEngine(), ResourcePrefix = "Resources", ProjectDir = projectDir, SdkPlatform = platform, SdkVersion = version.ToString(), SdkUsrPath = usr, SdkBinPath = bin, SdkRoot = root, }); }
public static AppleSdk GetSdk(PlatformFramework framework) { switch (framework) { case PlatformFramework.iOS: return(IPhoneSdks.Native); case PlatformFramework.WatchOS: return(IPhoneSdks.Watch); case PlatformFramework.TVOS: return(IPhoneSdks.TVOS); default: throw new InvalidOperationException(string.Format("Invalid framework: {0}", framework)); } }