private static MakeStatus Make(string platformName, string outputPackageName)
        {
            //Get Platform enum
            Platforms platform = Platforms.Unknow;

            Enum.TryParse(platformName, true, out platform);

            switch (platform)
            {
            case Platforms.Android:
                _buildService = new AndroidBuildService();
                break;

            case Platforms.WindowsPhone:
                _buildService = new WindowsPhoneBuildService();
                break;

            case Platforms.BlackBerry:
                _buildService = new BlackBerryBuildService();
                break;

            case Platforms.Browser:
                break;

            case Platforms.Windows:
                break;

            case Platforms.Unknow:
                return(new MakeStatus(Platforms.Unknow));
            }

            return(_buildService.Build(outputPackageName));
        }
Esempio n. 2
0
        public void Build(int sourceControlVersionId, int projectVersionId, Action <int> projectBuildStarted, Action <int, bool> projectBuildComplete)
        {
            AspNetDeployEntities entities = new AspNetDeployEntities();

            SourceControlVersion sourceControlVersion = entities.SourceControlVersion.Include("SourceControl").First(scv => scv.Id == sourceControlVersionId);
            ProjectVersion       projectVersion       = entities.ProjectVersion.Include("Properties").First(pv => pv.Id == projectVersionId);

            string        sourcesFolder = this.pathServices.GetSourceControlVersionPath(sourceControlVersion.SourceControl.Id, sourceControlVersion.Id);
            IBuildService buildService  = buildServiceFactory.Create(projectVersion.ProjectType);

            BuildSolutionResult buildSolutionResult = buildService.Build(
                sourcesFolder,
                projectVersion,
                projectFileName =>
            {
                ProjectVersion projectVersionBuild = entities.ProjectVersion
                                                     .Where(p => p.SourceControlVersionId == sourceControlVersionId)
                                                     .ToList()
                                                     .FirstOrDefault(p => !p.IsDeleted && Path.Combine(sourcesFolder, p.ProjectFile).ToLowerInvariant() == projectFileName.ToLowerInvariant());

                if (projectVersionBuild != null)
                {
                    projectBuildStarted(projectVersionBuild.Id);
                }
            },
                (projectFileName, success, message) =>
            {
                ProjectVersion projectVersionBuild = entities.ProjectVersion
                                                     .Where(p => p.SourceControlVersionId == sourceControlVersionId)
                                                     .ToList()
                                                     .FirstOrDefault(p => !p.IsDeleted && Path.Combine(sourcesFolder, p.ProjectFile).ToLowerInvariant() == projectFileName.ToLowerInvariant());

                if (projectVersionBuild != null)
                {
                    projectBuildComplete(projectVersionBuild.Id, success);
                }
            },
                (projectFile, exception) =>
            {
                this.loggingService.Log(new AspNetDeployException("Project build failed: " + projectFile, exception), null);
            });
        }