Beispiel #1
0
        public void Configure(IApplicationBuilder app)
        {
            app.Run(context => {
                var requestPath = context.Request.Path;
                switch (requestPath)
                {
                case "/log-time.html":
                    if (context.Request.Method == "POST")
                    {
                        var date = ParseExact(context.Request.Form["date"], "yyyy-MM-dd",
                                              CultureInfo.InvariantCulture);
                        var loggedTimeEvent = new LoggedTimeEvent(
                            date,
                            context.Request.Form["hour"],
                            context.Request.Form["minute"],
                            context.Request.Form["total-hours"],
                            context.Request.Form["project"]);
                        File.WriteAllText("events/" + Now.ToUniversalTime() + "-LoggedTime.json", JsonSerializer.Serialize(loggedTimeEvent));
                    }
                    return(context.Response.WriteAsync(FillTemplate("layout/log-time.html",
                                                                    GetTodayAndYesterday())));

                default:
                    return(context.Response.WriteAsync("Unknown path: " + requestPath));
                }
            });
        }
        public override bool Execute()
        {
            Log.LogTaskName("Archive");
            Log.LogTaskProperty("AppBundleDir", AppBundleDir);
            Log.LogTaskProperty("AppExtensionReferences", AppExtensionReferences);
            Log.LogTaskProperty("InsightsApiKey", InsightsApiKey);
            Log.LogTaskProperty("ITunesSourceFiles", ITunesSourceFiles);
            Log.LogTaskProperty("OutputPath", OutputPath);
            Log.LogTaskProperty("ProjectName", ProjectName);
            Log.LogTaskProperty("SigningKey", SigningKey);
            Log.LogTaskProperty("SolutionPath", SolutionPath);
            Log.LogTaskProperty("WatchAppReferences", WatchAppReferences);

            var archiveDir = CreateArchiveDirectory();

            try {
                var plist       = PDictionary.FromFile(Path.Combine(AppBundleDir.ItemSpec, "Info.plist"));
                var productsDir = Path.Combine(archiveDir, "Products");

                // Archive the OnDemandResources...
                var resourcesDestDir = Path.Combine(productsDir, "OnDemandResources");
                var resourcesSrcDir  = Path.Combine(OutputPath, "OnDemandResources");

                if (Directory.Exists(resourcesSrcDir))
                {
                    Ditto(resourcesSrcDir, resourcesDestDir);
                }

                // Archive the Applications...
                var appDestDir = Path.Combine(productsDir, "Applications", Path.GetFileName(AppBundleDir.ItemSpec));
                Ditto(AppBundleDir.ItemSpec, appDestDir);

                // Archive the dSYMs...
                if (Directory.Exists(DSYMDir))
                {
                    var destDir = Path.Combine(archiveDir, "dSYMs", Path.GetFileName(DSYMDir));
                    Ditto(DSYMDir, destDir);
                }

                // Archive the mSYMs...
                if (Directory.Exists(MSYMDir))
                {
                    var destDir = Path.Combine(archiveDir, "mSYMs", Path.GetFileName(MSYMDir));
                    Ditto(MSYMDir, destDir);
                }

                // Archive the Bitcode symbol maps
                var bcSymbolMaps = Directory.GetFiles(Path.GetDirectoryName(DSYMDir), "*.bcsymbolmap");
                if (bcSymbolMaps.Length > 0)
                {
                    var bcSymbolMapsDir = Path.Combine(archiveDir, "BCSymbolMaps");

                    Directory.CreateDirectory(bcSymbolMapsDir);

                    for (int i = 0; i < bcSymbolMaps.Length; i++)
                    {
                        File.Copy(bcSymbolMaps[i], Path.Combine(bcSymbolMapsDir, Path.GetFileName(bcSymbolMaps[i])));
                    }
                }

                if (AppExtensionReferences != null)
                {
                    // Archive the dSYMs, mSYMs, etc for each of the referenced App Extensions as well...
                    for (int i = 0; i < AppExtensionReferences.Length; i++)
                    {
                        ArchiveAppExtension(AppExtensionReferences[i], archiveDir);
                    }
                }

                if (WatchAppReferences != null)
                {
                    // Archive the dSYMs, mSYMs, etc for each of the referenced WatchOS2 Apps as well...
                    for (int i = 0; i < WatchAppReferences.Length; i++)
                    {
                        ArchiveWatchApp(WatchAppReferences[i], archiveDir);
                    }
                }

                if (ITunesSourceFiles != null)
                {
                    // Archive the iTunesMetadata.plist and iTunesArtwork files...
                    var iTunesMetadataDir = Path.Combine(archiveDir, "iTunesMetadata", Path.GetFileName(AppBundleDir.ItemSpec));
                    for (int i = 0; i < ITunesSourceFiles.Length; i++)
                    {
                        var archivedMetaFile = Path.Combine(iTunesMetadataDir, Path.GetFileName(ITunesSourceFiles[i].ItemSpec));

                        Directory.CreateDirectory(iTunesMetadataDir);
                        File.Copy(ITunesSourceFiles[i].ItemSpec, archivedMetaFile, true);
                    }
                }

                // Generate an archive Info.plist
                var arInfo = new PDictionary();
                // FIXME: figure out this value
                //arInfo.Add ("AppStoreFileSize", new PNumber (65535));

                var props = new PDictionary();
                props.Add("ApplicationPath", new PString(string.Format("Applications/{0}", Path.GetFileName(AppBundleDir.ItemSpec))));
                props.Add("CFBundleIdentifier", new PString(plist.GetCFBundleIdentifier()));
                if (plist.GetCFBundleShortVersionString() != null)
                {
                    props.Add("CFBundleShortVersionString", new PString(plist.GetCFBundleShortVersionString()));
                }
                else if (plist.GetCFBundleVersion() != null)
                {
                    props.Add("CFBundleShortVersionString", new PString(plist.GetCFBundleVersion()));
                }

                var iconFiles = plist.GetCFBundleIconFiles();
                var iconDict  = plist.GetCFBundleIcons();
                var icons     = new PArray();

                if (iconFiles != null)
                {
                    AddIconPaths(icons, iconFiles, Path.Combine(archiveDir, "Products"));
                }

                if (iconDict != null)
                {
                    var primary = iconDict.Get <PDictionary> (ManifestKeys.CFBundlePrimaryIcon);
                    if (primary != null && (iconFiles = primary.GetCFBundleIconFiles()) != null)
                    {
                        AddIconPaths(icons, iconFiles, Path.Combine(archiveDir, "Products"));
                    }
                }

                if (icons.Count > 0)
                {
                    props.Add("IconPaths", icons);
                }

                props.Add("SigningIdentity", new PString(SigningKey));

                arInfo.Add("ApplicationProperties", props);
                arInfo.Add("ArchiveVersion", new PNumber(2));
                arInfo.Add("CreationDate", new PDate(Now.ToUniversalTime()));
                arInfo.Add("Name", new PString(plist.GetCFBundleName() ?? plist.GetCFBundleDisplayName()));
                arInfo.Add("SchemeName", new PString(ProjectName));

                if (!string.IsNullOrEmpty(SolutionPath))
                {
                    arInfo.Add("SolutionName", new PString(Path.GetFileNameWithoutExtension(SolutionPath)));
                    arInfo.Add("SolutionPath", new PString(SolutionPath));
                }

                if (!string.IsNullOrEmpty(InsightsApiKey))
                {
                    arInfo.Add("InsightsApiKey", new PString(InsightsApiKey));
                }

                arInfo.Save(Path.Combine(archiveDir, "Info.plist"));

                ArchiveDir = archiveDir;
            } catch (Exception ex) {
                Log.LogErrorFromException(ex);
                Directory.Delete(archiveDir, true);
            }

            return(!Log.HasLoggedErrors);
        }
 public TestDateTimeProvider()
 {
     // set defaults
     Now    = DateTime.Now;
     UtcNow = Now.ToUniversalTime();
 }
        public override bool Execute()
        {
            var archiveDir = CreateArchiveDirectory();

            try {
                var plist       = PDictionary.FromFile(Path.Combine(AppBundleDir.ItemSpec, "Contents", "Info.plist"));
                var productsDir = Path.Combine(archiveDir, "Products");

                // Archive the Applications...
                var appDestDir = Path.Combine(productsDir, "Applications", Path.GetFileName(AppBundleDir.ItemSpec));
                Ditto(AppBundleDir.ItemSpec, appDestDir);

                // Archive the dSYMs...
                if (Directory.Exists(DSYMDir))
                {
                    var destDir = Path.Combine(archiveDir, "dSYMs", Path.GetFileName(DSYMDir));
                    Ditto(DSYMDir, destDir);
                }

                // Generate an archive Info.plist
                var arInfo = new PDictionary();
                var props  = new PDictionary();
                props.Add("ApplicationPath", new PString(string.Format("Applications/{0}", Path.GetFileName(AppBundleDir.ItemSpec))));
                props.Add("CFBundleIdentifier", new PString(plist.GetCFBundleIdentifier()));

                var version = plist.GetCFBundleShortVersionString();
                var build   = plist.GetCFBundleVersion();
                props.Add("CFBundleShortVersionString", new PString(version ?? (build ?? "1.0")));
                props.Add("CFBundleVersion", new PString(build ?? "1.0"));
                props.Add("SigningIdentity", SigningKey);

                arInfo.Add("ApplicationProperties", props);
                arInfo.Add("ArchiveVersion", new PNumber(2));
                arInfo.Add("CreationDate", new PDate(Now.ToUniversalTime()));
                arInfo.Add("Name", new PString(plist.GetCFBundleName() ?? plist.GetCFBundleDisplayName()));

                if (!string.IsNullOrEmpty(ProjectGuid))
                {
                    arInfo.Add("ProjectGuid", new PString(ProjectGuid));
                }

                if (!string.IsNullOrEmpty(ProjectTypeGuids))
                {
                    arInfo.Add("ProjectTypeGuids", new PString(ProjectTypeGuids));
                }

                if (!string.IsNullOrEmpty(SolutionPath))
                {
                    arInfo.Add("SolutionName", new PString(Path.GetFileNameWithoutExtension(SolutionPath)));
                    arInfo.Add("SolutionPath", new PString(SolutionPath));
                }

                if (!string.IsNullOrEmpty(InsightsApiKey))
                {
                    arInfo.Add("InsightsApiKey", new PString(InsightsApiKey));
                }

                arInfo.Save(Path.Combine(archiveDir, "Info.plist"));
                ArchiveDir = archiveDir;
            } catch (Exception ex) {
                Log.LogErrorFromException(ex);
                Directory.Delete(archiveDir, true);
            }

            return(!Log.HasLoggedErrors);
        }
Beispiel #5
0
        }                                                    // default is `MonoBundle` but that can be changed with `_CustomBundleName`

        public override bool Execute()
        {
            var archiveDir = CreateArchiveDirectory();

            try {
                var plist       = PDictionary.FromFile(PlatformFrameworkHelper.GetAppManifestPath(Platform, AppBundleDir.ItemSpec));
                var productsDir = Path.Combine(archiveDir, "Products");

                // Archive the Applications...
                var appDestDir = Path.Combine(productsDir, "Applications", Path.GetFileName(AppBundleDir.ItemSpec));
                Ditto(AppBundleDir.ItemSpec, appDestDir);

                // Archive the main dSYM...
                ArchiveDSym(DSYMDir, archiveDir);

                // for each `.dylib` (file) inside `MonoBundle` there could be a corresponding `.dSYM` - e.g. when using an AOT mode
                foreach (var dylib in Directory.GetFiles(Path.Combine(AppBundleDir.ItemSpec, "Contents", CustomBundleName), "*.dylib"))
                {
                    var dsym = Path.Combine(AppBundleDir.ItemSpec, "..", Path.GetFileName(dylib) + ".dSYM");
                    ArchiveDSym(dsym, archiveDir);
                }

                // for each user framework (directory) that is bundled inside the app we must also archive their dSYMs, if available
                var fks = Path.Combine(AppBundleDir.ItemSpec, "Contents", "Frameworks");
                if (Directory.Exists(fks))
                {
                    foreach (var fx in Directory.GetDirectories(fks, "*.framework"))
                    {
                        var dsym = Path.Combine(AppBundleDir.ItemSpec, "..", Path.GetFileName(fx) + ".dSYM");
                        ArchiveDSym(dsym, archiveDir);
                    }
                }

                // Generate an archive Info.plist
                var arInfo = new PDictionary();
                var props  = new PDictionary();
                props.Add("ApplicationPath", new PString(string.Format("Applications/{0}", Path.GetFileName(AppBundleDir.ItemSpec))));
                props.Add("CFBundleIdentifier", new PString(plist.GetCFBundleIdentifier()));

                var version = plist.GetCFBundleShortVersionString();
                var build   = plist.GetCFBundleVersion();
                props.Add("CFBundleShortVersionString", new PString(version ?? (build ?? "1.0")));
                props.Add("CFBundleVersion", new PString(build ?? "1.0"));
                props.Add("SigningIdentity", SigningKey);

                arInfo.Add("ApplicationProperties", props);
                arInfo.Add("ArchiveVersion", new PNumber(2));
                arInfo.Add("CreationDate", new PDate(Now.ToUniversalTime()));
                arInfo.Add("Name", new PString(plist.GetCFBundleName() ?? plist.GetCFBundleDisplayName()));

                if (!string.IsNullOrEmpty(ProjectGuid))
                {
                    arInfo.Add("ProjectGuid", new PString(ProjectGuid));
                }

                if (!string.IsNullOrEmpty(ProjectTypeGuids))
                {
                    arInfo.Add("ProjectTypeGuids", new PString(ProjectTypeGuids));
                }

                if (!string.IsNullOrEmpty(SolutionPath))
                {
                    arInfo.Add("SolutionName", new PString(Path.GetFileNameWithoutExtension(SolutionPath)));
                    arInfo.Add("SolutionPath", new PString(SolutionPath));
                }

                if (!string.IsNullOrEmpty(InsightsApiKey))
                {
                    arInfo.Add("InsightsApiKey", new PString(InsightsApiKey));
                }

                arInfo.Save(Path.Combine(archiveDir, "Info.plist"));
                ArchiveDir = archiveDir;
            } catch (Exception ex) {
                Log.LogErrorFromException(ex);
                Directory.Delete(archiveDir, true);
            }

            return(!Log.HasLoggedErrors);
        }