private void GeneratePackageJarAndExportCiAndFileList(string storageLocation, string packageName, string stamp) { string workingDir = Path.GetTempPath() + "\\Migration"; #region Write Operation and Installer files to this exec path PreparePackageForGeneration(); #endregion #region Export Ci from exec path And Linked Files List string pathToThisExec = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string pathToDotCiFolder = pathToThisExec + @"\MIGRATION\FIRSTPACKAGE\trunk"; string pathToExportDirectory = storageLocation + "\\" + stamp + "-Release-Export"; if (Directory.Exists(pathToExportDirectory)) { Directory.Delete(pathToExportDirectory, true); Directory.CreateDirectory(pathToExportDirectory); } FrontendUtils.CopyDirectory(pathToDotCiFolder, pathToExportDirectory); File.Delete(pathToExportDirectory + @"\.ci\package\murex\Migration\main.groovy"); File.Delete(pathToExportDirectory + @"\.ci\package\murex\Migration\installMain.groovy"); File.Delete(pathToExportDirectory + @"\.ci\ci-main.xml"); if (dgvFilesToImport.Rows.Count > 0) { string outputFileName = pathToExportDirectory + @"\ImportFileList.txt"; ExportFileList(outputFileName); } #endregion #region Copy Migration ready from exec path to temp dir And get linked files if (Directory.Exists(pathToThisExec + @"\MIGRATION")) { if (Directory.Exists(workingDir)) { Directory.Delete(workingDir, true); } FrontendUtils.CopyDirectory(pathToThisExec + @"\MIGRATION", workingDir + @"\MIGRATION"); } string pathToAppDir = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\"; GetLinkedFiles(pathToAppDir); #endregion #region Create Generation Command and Generate string pathToCisPackage = workingDir + @"\MIGRATION\FIRSTPACKAGE\cis-mxpack-1.0-full.jar"; string pathToConfigFile = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\.ci\ci.xml"; string pathTomainConfigFile = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\.ci\ci-main.xml"; string configFileText = File.ReadAllText(pathTomainConfigFile).Replace("Migration-Package", stamp + "-" + packageName); FrontendUtils.WriteFile(pathToConfigFile, configFileText); string pathToTarget = storageLocation; string pathToSource = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk"; string packageId = "MigrationPackage"; string commandToExecute = "-jar \"" + pathToCisPackage + "\"" + " " + "-configfile:\"" + pathToConfigFile + "\"" + " " + "-source:\"" + pathToSource + "\"" + " " + "-target:\"" + pathToTarget + "\"" + " " + "-packageid:" + packageId; //FrontendUtils.WriteFile(workingDir + @"\compile.cmd", commandToExecute); //FrontendUtils.ExecuteCommandSync(workingDir + @"\compile.cmd"); bwPackageGenerator.RunWorkerAsync(commandToExecute); packageGenForm = new PackageBeingGeneratredForm(); packageGenForm.ShowDialog(); #endregion }
private void StartPackageJarGeneration() { string workingDir = Path.GetTempPath() + "\\Migration"; PreparePackageForGeneration(); #region Copy Migration And get linked files if (Directory.Exists(pathToThisExec + @"\MIGRATION")) { if (Directory.Exists(workingDir)) { Directory.Delete(workingDir, true); } FrontendUtils.CopyDirectory(pathToThisExec + @"\MIGRATION", workingDir + @"\MIGRATION"); } string pathToAppDir = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\"; GetLinkedFiles(pathToAppDir); #endregion #region Create Generation Command and Generate FolderBrowserDialog dial = new FolderBrowserDialog(); dial.ShowNewFolderButton = true; dial.Description = "Generated Package Location"; PackageNameForm form = new PackageNameForm(); DialogResult dialogPackageName = form.ShowDialog(); if (dialogPackageName == DialogResult.OK) { string pathToCisPackage = workingDir + @"\MIGRATION\FIRSTPACKAGE\cis-mxpack-1.0-full.jar"; string pathToConfigFile = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\.ci\ci.xml"; string pathTomainConfigFile = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk\.ci\ci-main.xml"; string configFileText = File.ReadAllText(pathTomainConfigFile).Replace("Migration-Package", form.Controls["txtPackageName"].Text); FrontendUtils.WriteFile(pathToConfigFile, configFileText); if (dial.ShowDialog() == DialogResult.OK) { string pathToTarget = dial.SelectedPath; string pathToSource = workingDir + @"\MIGRATION\FIRSTPACKAGE\trunk"; string packageId = "MigrationPackage"; string commandToExecute = "-jar \"" + pathToCisPackage + "\"" + " " + "-configfile:\"" + pathToConfigFile + "\"" + " " + "-source:\"" + pathToSource + "\"" + " " + "-target:\"" + pathToTarget + "\"" + " " + "-packageid:" + packageId; //FrontendUtils.WriteFile(workingDir + @"\compile.cmd", commandToExecute); bwPackageGenerator.RunWorkerAsync(commandToExecute); packageGenForm = new PackageBeingGeneratredForm(); packageGenForm.ShowDialog(); //StartGeneratingPackageInBackground(commandToExecute); } } #endregion }