protected void CreateExecutableProject() { ProcessProject(); PostProcessExecutableProject(); inputProject.Save(ProjectPath, (l, m) => Harness.Log(l, m)); UpdateInfoPList(); }
void CreateWatchOSContainerProject() { var csproj = new XmlDocument(); csproj.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSContainerTemplate, "Container.csproj")); csproj.FindAndReplace("%CONTAINER_PATH%", Path.GetFullPath(Harness.WatchOSContainerTemplate).Replace('/', '\\') + "\\"); csproj.FindAndReplace("%WATCHAPP_CSPROJ%", Path.GetFileName(WatchOSAppProjectPath)); csproj.SetProjectReferenceValue(Path.GetFileName(WatchOSAppProjectPath), "Name", Path.GetFileNameWithoutExtension(WatchOSAppProjectPath)); WatchOSGuid = "{" + Helpers.GenerateStableGuid().ToString().ToUpper() + "}"; csproj.SetProjectGuid(WatchOSGuid); csproj.FixInfoPListInclude(Suffix); if (MonoNativeInfo != null) { csproj.AddAdditionalDefines("MONO_NATIVE_WATCH"); MonoNativeHelper.AddProjectDefines(csproj, MonoNativeInfo.Flavor); MonoNativeHelper.RemoveSymlinkMode(csproj); } csproj.Save(WatchOSProjectPath, (l, m) => Harness.Log(l, m)); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{Suffix}.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSContainerTemplate, "Info.plist")); info_plist.SetCFBundleIdentifier(BundleIdentifier); info_plist.SetCFBundleName(Name); info_plist.SetMinimumOSVersion("9.0"); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
void CreateTodayContainerProject() { var csproj = new XmlDocument(); var suffix = Suffix; csproj.LoadWithoutNetworkAccess(Path.Combine(Harness.TodayContainerTemplate, "TodayContainer.csproj")); csproj.SetOutputPath("bin\\$(Platform)\\$(Configuration)" + suffix, false); csproj.SetIntermediateOutputPath("obj\\$(Platform)\\$(Configuration)" + suffix); csproj.SetProjectReferenceValue("TodayExtension.csproj", "Name", Path.GetFileNameWithoutExtension(TodayExtensionProjectPath)); csproj.SetProjectReferenceValue("TodayExtension.csproj", "Project", TodayExtensionGuid); csproj.SetProjectReferenceInclude("TodayExtension.csproj", TodayExtensionProjectPath.Replace('/', '\\')); csproj.FixCompileInclude("Main.cs", Path.Combine(Harness.TodayContainerTemplate, "Main.cs").Replace('/', '\\')); csproj.FixInfoPListInclude(suffix, Path.GetDirectoryName(TemplateProjectPath)); TodayContainerGuid = "{" + Helpers.GenerateStableGuid().ToString().ToUpper() + "}"; ProjectGuid = TodayContainerGuid; csproj.SetProjectGuid(TodayContainerGuid); csproj.ResolveAllPaths(Harness.TodayContainerTemplate); csproj.Save(TodayContainerProjectPath, (l, m) => Harness.Log(l, m)); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{suffix}.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(Harness.TodayContainerTemplate, "Info.plist")); info_plist.SetCFBundleIdentifier(BundleIdentifier); info_plist.SetCFBundleName(Name); info_plist.SetMinimumOSVersion(GetMinimumOSVersion("8.0")); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
void CreateWatchOSAppProject() { var csproj = new XmlDocument(); var suffix = Suffix + "-app"; csproj.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSAppTemplate, "App.csproj")); csproj.FindAndReplace("%WATCHAPP_PATH%", Path.GetFullPath(Harness.WatchOSAppTemplate).Replace('/', '\\') + "\\"); csproj.FindAndReplace("%WATCHEXTENSION_CSPROJ%", Path.GetFileName(WatchOSExtensionProjectPath)); csproj.SetProjectReferenceValue(Path.GetFileName(WatchOSExtensionProjectPath), "Project", WatchOSExtensionGuid); csproj.SetProjectReferenceValue(Path.GetFileName(WatchOSExtensionProjectPath), "Name", Path.GetFileNameWithoutExtension(WatchOSExtensionProjectPath)); WatchOSAppGuid = "{" + Helpers.GenerateStableGuid().ToString().ToUpper() + "}"; csproj.SetProjectGuid(WatchOSAppGuid); csproj.FixInfoPListInclude(suffix); if (MonoNativeInfo != null) { csproj.AddAdditionalDefines("MONO_NATIVE_WATCH"); MonoNativeHelper.AddProjectDefines(csproj, MonoNativeInfo.Flavor); MonoNativeHelper.RemoveSymlinkMode(csproj); } csproj.Save(WatchOSAppProjectPath, (l, m) => Harness.Log(l, m)); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{Suffix}-app.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSAppTemplate, "Info.plist")); info_plist.SetCFBundleIdentifier(BundleIdentifier + ".watchkitapp"); info_plist.SetPListStringValue("WKCompanionAppBundleIdentifier", BundleIdentifier); info_plist.SetPListStringValue("CFBundleName", Name); info_plist.SetMinimumOSVersion(GetMinimumOSVersion(info_plist.GetMinimumOSVersion())); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
protected override void UpdateInfoPList() { XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, "Info" + Suffix + ".plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(TargetDirectory, OriginalInfoPListInclude)); BundleIdentifier = info_plist.GetCFBundleIdentifier(); info_plist.SetMinimumOSVersion(GetMinimumOSVersion(info_plist.GetMinimumOSVersion())); info_plist.SetUIDeviceFamily(UIDeviceFamily); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
void CreateWatchOSLibraryProject() { var csproj = inputProject; csproj.SetProjectTypeGuids("{FC940695-DFE0-4552-9F25-99AF4A5619A1};" + LanguageGuid); csproj.SetOutputPath("bin\\$(Platform)\\$(Configuration)" + Suffix); csproj.SetIntermediateOutputPath("obj\\$(Platform)\\$(Configuration)" + Suffix); csproj.RemoveTargetFrameworkIdentifier(); csproj.SetPlatformAssembly("Xamarin.WatchOS"); csproj.SetImport(IsBindingProject ? BindingsImports : Imports); csproj.AddAdditionalDefines("XAMCORE_3_0;MONOTOUCH_WATCH;"); csproj.FixProjectReferences(Suffix); csproj.SetExtraLinkerDefs("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); csproj.FixTestLibrariesReferences(Platform); csproj.Save(WatchOSProjectPath, (l, m) => Harness.Log(l, m)); WatchOSGuid = csproj.GetProjectGuid(); }
void CreateTodayExtensionProject() { var csproj = inputProject; var suffix = Suffix + "-extension"; csproj.SetProjectTypeGuids("{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};" + LanguageGuid); csproj.SetOutputPath("bin\\$(Platform)\\$(Configuration)" + suffix); csproj.SetIntermediateOutputPath("obj\\$(Platform)\\$(Configuration)" + suffix); csproj.SetImport(IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.AppExtension.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.AppExtension.CSharp.targets"); csproj.FixInfoPListInclude(suffix, Path.GetDirectoryName(TemplateProjectPath)); csproj.SetOutputType("Library"); csproj.AddAdditionalDefines("XAMCORE_3_0;TODAY_EXTENSION"); var ext = IsFSharp ? "fs" : "cs"; // we have diff templates for the bcl tests because they use xunit/nunit and not monotouch nunit. csproj.AddCompileInclude("TodayExtensionMain." + ext, Path.Combine(Harness.TodayExtensionTemplate, "TodayExtensionMain." + ext), true); csproj.AddInterfaceDefinition(Path.Combine(Harness.TodayExtensionTemplate, "TodayView.storyboard").Replace('/', '\\')); csproj.SetExtraLinkerDefs("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); csproj.FixProjectReferences(Path.Combine(ProjectsDir, GetTargetSpecificDir()), "-today", FixProjectReference); csproj.ResolveAllPaths(TemplateProjectPath); csproj.Save(TodayExtensionProjectPath, (l, m) => Harness.Log(l, m)); TodayExtensionGuid = csproj.GetProjectGuid(); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{suffix}.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(TargetDirectory, OriginalInfoPListInclude)); BundleIdentifier = info_plist.GetCFBundleIdentifier() + "-today"; info_plist.SetCFBundleIdentifier(BundleIdentifier + ".todayextension"); info_plist.SetMinimumOSVersion(GetMinimumOSVersion("8.0")); info_plist.AddPListStringValue("CFBundlePackageType", "XPC!"); info_plist.SetCFBundleDisplayName(Name); info_plist.AddPListKeyValuePair("NSExtension", "dict", @" <key>NSExtensionMainStoryboard</key> <string>TodayView</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.widget-extension</string> "); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
public string GuessFailureReason(ILog log) { try { using (var reader = log.GetReader()) { string line; var error_msg = new System.Text.RegularExpressions.Regex("([A-Z][A-Z][0-9][0-9][0-9][0-9]:.*)"); while ((line = reader.ReadLine()) != null) { var match = error_msg.Match(line); if (match.Success) { return(match.Groups [1].Captures [0].Value); } } } } catch (Exception e) { Harness.Log("Failed to guess failure reason: {0}", e.Message); } return(null); }
protected override void ExecuteInternal() { if (MonoNativeInfo == null) { return; } MonoNativeInfo.AddProjectDefines(inputProject); inputProject.AddAdditionalDefines("MONO_NATIVE_IOS"); inputProject.FixInfoPListInclude(Suffix); inputProject.SetExtraLinkerDefs("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); inputProject.Save(ProjectPath, (l, m) => Harness.Log(l, m)); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, "Info" + Suffix + ".plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(TargetDirectory, "Info.plist")); info_plist.SetMinimumOSVersion(GetMinimumOSVersion(info_plist.GetMinimumOSVersion())); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
void CreateWatchOSContainerProject() { var csproj = new XmlDocument(); csproj.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSContainerTemplate, "Container.csproj")); csproj.FindAndReplace("%CONTAINER_PATH%", Path.GetFullPath(Harness.WatchOSContainerTemplate).Replace('/', '\\') + "\\"); csproj.FindAndReplace("%WATCHAPP_CSPROJ%", WatchOSAppProjectPath); csproj.SetProjectReferenceValue(WatchOSAppProjectPath, "Name", Path.GetFileNameWithoutExtension(WatchOSAppProjectPath)); WatchOSGuid = "{" + Helpers.GenerateStableGuid().ToString().ToUpper() + "}"; csproj.SetProjectGuid(WatchOSGuid); csproj.FixInfoPListInclude(Suffix, Path.GetDirectoryName(TemplateProjectPath)); csproj.ResolveAllPaths(TemplateProjectPath); csproj.Save(WatchOSProjectPath, (l, m) => Harness.Log(l, m)); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{Suffix}.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(Harness.WatchOSContainerTemplate, "Info.plist")); info_plist.SetCFBundleIdentifier(BundleIdentifier); info_plist.SetCFBundleName(Name); info_plist.SetMinimumOSVersion("9.0"); info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }
void CreateWatchOSExtensionProject() { var csproj = inputProject; var suffix = Suffix + "-extension"; // Remove unused configurations csproj.DeleteConfiguration("iPhone", "Release-bitcode"); csproj.DeleteConfiguration("iPhone", "Release64"); csproj.DeleteConfiguration("iPhone", "Debug64"); csproj.FixArchitectures("i386", "ARMv7k", "iPhone", "Release32"); csproj.FixArchitectures("i386", "ARMv7k", "iPhone", "Debug32"); // add Release64_32 and set the correct architecture csproj.CloneConfiguration("iPhone", "Release", "Release64_32"); csproj.FixArchitectures("i386", "ARM64_32", "iPhone", "Release64_32"); // add Debug64_32 and set the correct architecture csproj.CloneConfiguration("iPhone", "Debug", "Debug64_32"); csproj.FixArchitectures("i386", "ARM64_32", "iPhone", "Debug64_32"); csproj.FixArchitectures(SimulatorArchitectures, DeviceArchitectures, "iPhoneSimulator", "Debug"); csproj.FixArchitectures(SimulatorArchitectures, DeviceArchitectures, "iPhoneSimulator", "Release"); csproj.FixArchitectures(SimulatorArchitectures, DeviceArchitectures, "iPhone", "Debug"); csproj.FixArchitectures(SimulatorArchitectures, DeviceArchitectures, "iPhone", "Release"); csproj.SetProjectTypeGuids("{1E2E965C-F6D2-49ED-B86E-418A60C69EEF};" + LanguageGuid); csproj.SetOutputPath("bin\\$(Platform)\\$(Configuration)" + suffix); csproj.SetIntermediateOutputPath("obj\\$(Platform)\\$(Configuration)" + suffix); csproj.RemoveTargetFrameworkIdentifier(); csproj.SetPlatformAssembly("Xamarin.WatchOS"); csproj.SetImport(IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.AppExtension.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.AppExtension.CSharp.targets"); csproj.FixProjectReferences("-watchos"); csproj.FixInfoPListInclude(suffix); csproj.SetOutputType("Library"); csproj.AddAdditionalDefines("BITCODE", "iPhone", "Release"); csproj.AddAdditionalDefines("XAMCORE_3_0;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;"); csproj.RemoveReferences("OpenTK-1.0"); var ext = IsFSharp ? "fs" : "cs"; csproj.AddCompileInclude("InterfaceController." + ext, Path.Combine(Harness.WatchOSExtensionTemplate, "InterfaceController." + ext)); csproj.SetExtraLinkerDefs("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); csproj.SetMtouchUseBitcode(true, "iPhone", "Release"); csproj.SetMtouchUseLlvm(true, "iPhone", "Release"); if (MonoNativeInfo != null) { csproj.AddAdditionalDefines("MONO_NATIVE_WATCH"); MonoNativeHelper.AddProjectDefines(csproj, MonoNativeInfo.Flavor); MonoNativeHelper.RemoveSymlinkMode(csproj); } // Not linking a watch extensions requires passing -Os to the native compiler. // https://github.com/mono/mono/issues/9867 var configurations = new string [] { "Debug", "Debug32", "Debug64_32", "Release", "Release32", "Release64_32" }; foreach (var c in configurations) { var flags = "-fembed-bitcode-marker"; if (csproj.GetMtouchLink("iPhone", c) == "None") { flags += " -Os"; } csproj.AddExtraMtouchArgs($"--gcc_flags='{flags}'", "iPhone", c); } csproj.Save(WatchOSExtensionProjectPath, (l, m) => Harness.Log(l, m)); WatchOSExtensionGuid = csproj.GetProjectGuid(); XmlDocument info_plist = new XmlDocument(); var target_info_plist = Path.Combine(TargetDirectory, $"Info{Suffix}-extension.plist"); info_plist.LoadWithoutNetworkAccess(Path.Combine(TargetDirectory, "Info.plist")); BundleIdentifier = info_plist.GetCFBundleIdentifier() + "_watch"; if (BundleIdentifier.Length >= 58) { BundleIdentifier = BundleIdentifier.Substring(0, 57); // If the main app's bundle id is 58 characters (or sometimes more), then the watch extension crashes at launch. radar #29847128. } info_plist.SetCFBundleIdentifier(BundleIdentifier + ".watchkitapp.watchkitextension"); info_plist.SetMinimumOSVersion(GetMinimumOSVersion("2.0")); info_plist.SetUIDeviceFamily(4); info_plist.AddPListStringValue("RemoteInterfacePrincipleClass", "InterfaceController"); info_plist.AddPListKeyValuePair("NSExtension", "dict", string.Format( @" <key>NSExtensionAttributes</key> <dict> <key>WKAppBundleIdentifier</key> <string>{0}.watchkitapp</string> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.watchkit</string> ", BundleIdentifier)); if (!info_plist.ContainsKey("NSAppTransportSecurity")) { info_plist.AddPListKeyValuePair("NSAppTransportSecurity", "dict", @" <key>NSAllowsArbitraryLoads</key> <true/> " ); } info_plist.Save(target_info_plist, (l, m) => Harness.Log(l, m)); }