示例#1
0
        public static ApplicationBuild SaveBuild(string BuildNotes, string FilePath, string CurrentUserName, int environmentId)
        {
            ApplicationBuild retval        = null;
            string           BuildType     = Platforms.Common.GetFilesBuildPlatform(Path.GetFileName(FilePath));
            Guid             uniqueBuildId = new Guid(System.IO.Path.GetFileNameWithoutExtension(FilePath));

            if (BuildType.ToUpper() == Constants.BUILD_PLATFORM_ANDROID)
            {
                Platforms.Android.AndroidManifestData data = Platforms.Android.AndroidPackage.GetManifestData(FilePath);
                CreateAndGetApplicationIfNoExists(data.ApplicationName, data.PackageName, Constants.BUILD_PLATFORM_ANDROID, CurrentUserName);

                using (var context = new Repository.BetaDepotContext())
                {
                    Repository.ApplicationBuild buildToSave = new Repository.ApplicationBuild()
                    {
                        AddedDtm         = DateTime.UtcNow,
                        Application      = context.Applications.Where(w => w.ApplicationIdentifier == data.PackageName).FirstOrDefault(),
                        UniqueIdentifier = uniqueBuildId,
                        Notes            = BuildNotes,
                        versionNumber    = data.VersionName,
                        versionCode      = data.VersionCode,
                        Platform         = Constants.BUILD_PLATFORM_ANDROID,
                        AddedBy          = context.TeamMembers.Where(w => w.UserName == CurrentUserName).FirstOrDefault(),
                        Environment      = context.Environments.Where(w => w.Id == environmentId).FirstOrDefault()
                    };
                    context.Builds.Add(buildToSave);
                    context.SaveChanges();
                    retval = buildToSave;
                }
            }
            else if (BuildType.ToUpper() == Constants.BUILD_PLATFORM_IOS)
            {
                Platforms.iOS.iOSBundleData data = Platforms.iOS.iOSBundle.GetIPABundleData(FilePath);
                CreateAndGetApplicationIfNoExists(data.BundleAppName, data.BundleIdentifier, Constants.BUILD_PLATFORM_IOS, CurrentUserName);

                using (var context = new Repository.BetaDepotContext())
                {
                    Repository.ApplicationBuild buildToSave = new Repository.ApplicationBuild()
                    {
                        AddedDtm         = DateTime.UtcNow,
                        Application      = context.Applications.Where(w => w.ApplicationIdentifier == data.BundleIdentifier).FirstOrDefault(),
                        UniqueIdentifier = Guid.NewGuid(),
                        Notes            = BuildNotes,
                        versionNumber    = data.BundleVersion,
                        Platform         = Constants.BUILD_PLATFORM_IOS,
                        AddedBy          = context.TeamMembers.Where(w => w.UserName == CurrentUserName).FirstOrDefault(),
                        Environment      = context.Environments.Where(w => w.Id == environmentId).FirstOrDefault()
                    };

                    context.Builds.Add(buildToSave);
                    context.SaveChanges();
                    retval = buildToSave;
                }
            }

            return(retval);
        }
示例#2
0
        private static void Build(string[] args, NLogProvider logProvider, string rhetosAppRootPath, out bool pauseOnError)
        {
            var logger = logProvider.GetLogger("DeployPackages");

            var configurationBuilder = new ConfigurationBuilder(logProvider)
                                       .AddOptions(new RhetosBuildEnvironment
            {
                ProjectFolder         = rhetosAppRootPath,
                OutputAssemblyName    = null,
                CacheFolder           = Path.Combine(rhetosAppRootPath, "GeneratedFilesCache"),
                GeneratedAssetsFolder = Path.Combine(rhetosAppRootPath, "bin", "Generated"),
                GeneratedSourceFolder = null,
            })
                                       .AddOptions(new LegacyPathsOptions
            {
                BinFolder       = Path.Combine(rhetosAppRootPath, "bin"),
                PluginsFolder   = Path.Combine(rhetosAppRootPath, "bin", "Plugins"),
                ResourcesFolder = Path.Combine(rhetosAppRootPath, "Resources"),
            })
                                       .AddKeyValue(ConfigurationProvider.GetKey((BuildOptions o) => o.GenerateAppSettings), false)
                                       .AddKeyValue(ConfigurationProvider.GetKey((BuildOptions o) => o.BuildResourcesFolder), true)
                                       .AddWebConfiguration(rhetosAppRootPath)
                                       .AddKeyValue(ConfigurationProvider.GetKey((ConfigurationProviderOptions o) => o.LegacyKeysWarning), true)
                                       .AddKeyValue(ConfigurationProvider.GetKey((LoggingOptions o) => o.DelayedLogTimout), 60.0)
                                       .AddConfigurationManagerConfiguration()
                                       .AddCommandLineArgumentsWithConfigurationPaths(args);

            var configuration = configurationBuilder.Build();

            var deployPackagesOptions = configuration.GetOptions <DeployPackagesOptions>();

            pauseOnError = !deployPackagesOptions.NoPause;
            if (deployPackagesOptions.StartPaused)
            {
                StartPaused();
            }

            if (!deployPackagesOptions.DatabaseOnly)
            {
                LegacyUtilities.Initialize(configuration);
                DeleteObsoleteFiles(rhetosAppRootPath, logProvider, logger);

                var installedPackages = DownloadPackages(deployPackagesOptions.IgnoreDependencies, logProvider, logger);

                var pluginAssemblies = Directory.GetFiles(Path.Combine(rhetosAppRootPath, "bin", "Plugins"), "*.dll", SearchOption.TopDirectoryOnly);
                var build            = new ApplicationBuild(configuration, logProvider, pluginAssemblies, installedPackages);
                build.GenerateApplication();
            }
            else
            {
                logger.Info("Skipped deleting old generated files (DeployDatabaseOnly).");
                logger.Info("Skipped download packages (DeployDatabaseOnly).");
                logger.Info("Skipped code generators (DeployDatabaseOnly).");
            }
        }
示例#3
0
        public void CorrectRegistrationsBuildTime()
        {
            var configuration = GetBuildConfiguration();
            var build         = new ApplicationBuild(configuration, new NLogProvider(), PluginsFromThisAssembly(), new InstalledPackages());
            var builder       = build.CreateBuildComponentsContainer();

            using (var container = builder.Build())
            {
                var registrationsDump = DumpSortedRegistrations(container);
                System.Diagnostics.Trace.WriteLine(registrationsDump);
                TestUtility.AssertAreEqualByLine(_expectedRegistrationsBuild, registrationsDump);

                TestAmbiguousRegistations(container,
                                          expectedMultiplePlugins: new[] { "Rhetos.Dsl.IDslModelIndex", "Rhetos.Extensibility.IGenerator" },
                                          expectedOverridenRegistrations: new Dictionary <Type, string> {
                    { typeof(IUserInfo), "NullUserInfo" }
                });
            }
        }
示例#4
0
        public ActionResult SaveBuild(string BuildNotes, string FileName, int EnvironmentId)
        {
            string           BuildType = Platforms.Common.GetFilesBuildPlatform(FileName);
            string           filePath  = Path.Combine(Server.MapPath("~/App_Data/Files"), FileName);
            ApplicationBuild Build     = Iteedee.BetaDepot.Repository.Managers.ApplicationBuildMgr.SaveBuild(BuildNotes, filePath, User.Identity.GetUserName(), EnvironmentId);

            Common.Messaging.NotifyTeamOfNewBuild(Build.Id);
            if (Build.Platform == Common.Constants.BUILD_PLATFORM_ANDROID)
            {
                return(Redirect("~/Platform/Index/ANDROID"));
            }
            else if (Build.Platform == Common.Constants.BUILD_PLATFORM_IOS)
            {
                return(Redirect("~/Platform/Index/IOS"));
            }
            else
            {
                return(Redirect("~/Home/Index"));
            }
        }