Пример #1
0
        /*
         * private static void GenerateKickstartForIntegration(string destinationDirectory, string connectionString, List<MSolutionGroup> solutionGroupList)
         * {
         * foreach (var solutionGroup in solutionGroupList)
         * {
         * foreach (var solution in solutionGroup.Solution)
         * {
         * if (!solution.KickstartGrpcIntegrationProjectFlag)
         * {
         *     continue;//  second pass, GrpcRefs are set
         * }
         *
         * var solutionConverter = new KSolutionToCSolutionConverter();
         * solutionConverter.Convert(solution);
         * }
         * }
         * }*/

        private static void AddProtoRefs(List <KSolutionGroup> solutionGroupList)
        {
            #region
            KickstartCoreService.AddProtoRef(solutionGroupList, "blah", CProtoRpcRefDataDirection.Pull, "blahblah",
                                             "blahblahblahService", "GetBlah");

            #endregion
        }
Пример #2
0
        public async Task ExecuteAsync(string destinationDirectory, string solutionName, List <KSolutionGroup> solutionGroupList)
        {
            if (string.IsNullOrWhiteSpace(solutionName))
            {
                throw new ApplicationException("Solution name not specified");
            }
            var sw = Stopwatch.StartNew();

            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 10, ProgressMessage = "Generation Started"
            });
            var connectionString = "Server=localhost;";
            var timeString       = DateTime.Now.ToString("yyyyMMddHHmmss");

            KickstartCoreService.SetCompanyNameOnProjects(solutionGroupList);
            KickstartCoreService.ConfigureMetaData(solutionGroupList, destinationDirectory);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = ""
            });
            //deploy sql code to temp db, convert to K objects
            _kickstartCoreService.BuildSqlMeta(destinationDirectory, connectionString, solutionGroupList);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = "Sql objects created on WorkDb"
            });


            AddProtoRefs(solutionGroupList);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = ""
            });

            //pass 2
            //generate C objects from K objects
            _solutionGenerator.GenerateCSolutions(destinationDirectory, connectionString, solutionGroupList);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = "Pass 2: K object transformed to C objects"
            });

            //save the K/C meta to Excel
            //Excel can be tweaked, and used as Meta source
            //_kSolutionGroupToExcelConverter.OutputPath = Path.Combine(destinationDirectory, $"{timeString}.xlsx");
            //_kSolutionGroupToExcelConverter.Convert(solutionGroupList);

            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = ""
            });


            //Pass 3
            //generate Code from C objects
            _codeGenerator.GenerateCode(solutionGroupList, destinationDirectory);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = "Pass 3: Code generated"
            });

            _solutionVisitor.AddProjectsToApplication(solutionGroupList, destinationDirectory);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = "Pass 3: Projects added to solution"
            });

            if (solutionGroupList.Count > 1 || solutionGroupList.First().Solution.Count > 1)
            {
                //only do if there are multiple solutions
                _solutionVisitor.AddAllProjectsToMasterSln(solutionGroupList, destinationDirectory, solutionName);
            }
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = ""
            });

            BatchFileService.GenerateRestoreScript(solutionGroupList, destinationDirectory);
            BatchFileService.GenerateBuildScript(solutionGroupList, destinationDirectory);
            BatchFileService.GenerateDeployDbScript(solutionGroupList, destinationDirectory);
            BatchFileService.GenerateRunServicesScript(solutionGroupList, destinationDirectory);
            BatchFileService.GenerateRunTestClientScript(solutionGroupList, destinationDirectory);

            //Pass4
            //create diagrams

            DiagramGenerator.GenerateDiagram(destinationDirectory, solutionGroupList);
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 5, ProgressMessage = "Pass 4: Diagrams generated"
            });
            ProgressChanged(this, new KickstartProgressChangedEventArgs()
            {
                ProgressPercentChange = 100, ProgressMessage = $"Completed in {sw.Elapsed.TotalSeconds}.{sw.Elapsed.Milliseconds}s"
            });



            System.Console.WriteLine($"Completed in {sw.Elapsed.ToString()}");
        }