/* * Create the Mashup package (*.mashup) from the specified Mashup Manifest. * Inspired by Mashup.Designer.DeploymentHelper.SaveMashupFile */ static bool SaveMashupFile(ManifestDesigner manifest) { try { // validate Manifest typeof(DeploymentHelper).InvokeMember("ValidateManifest", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, null, null, new Object[] { manifest }); // create Mashup package string defaultFileName = manifest.DeploymentName + "_" + manifest.Version + Defines.ExtensionMashup; FileInfo packageFile = new FileInfo(manifest.File.Directory + "\\" + defaultFileName); PackageHelper.CreatePackageFromManifest(manifest, manifest.File, packageFile, PackageHelper.DeployTarget_LSO); // check Mashup profile if (manifest.GetProfileNode() != null) { string message = "Please note that this Mashup contains a profile section and should be deployed using Life Cycle Manager. Warning - Using this tool will not result in a merge of profile information into the profile."; Console.WriteLine(message); } return(true); } catch (Exception exception) { Console.Error.WriteLine(exception); return(false); } }
static void Main(string[] args) { // check the arguments if (args.Length == 0) { Console.WriteLine("Usage: Deploy.exe Mashup1,Mashup2,Mashup3 [DEV,TST]"); return; } string userid = null; string password = null; if (args.Length > 1) { // get the M3 userid/password Console.Write("Userid: "); userid = Console.ReadLine(); Console.Write("Password: "******"*.manifest", SearchOption.AllDirectories); foreach (string file in files) { Console.WriteLine("Opening {0}", file); ManifestDesigner manifest = new ManifestDesigner(new FileInfo(file)); string name = manifest.DeploymentName + Defines.ExtensionMashup; string nameAndVersion = manifest.DeploymentName + "_" + manifest.Version + Defines.ExtensionMashup; Console.WriteLine("Generating {0}", nameAndVersion); // generate the Mashup package if (SaveMashupFile(manifest)) { if (args.Length > 1) { // get the resulting binary contents byte[] bytes = File.ReadAllBytes(manifest.File.Directory + "\\" + nameAndVersion); // for each M3 environment string[] environments = args[1].Split(','); foreach (string environment in environments) { // deploy Console.WriteLine("Deploying {0} to {1}", name, environment); DeployMashup(name, bytes, environment, userid, password); } } } // generate the LawsonApp for LCM string package = manifest.File.Directory + "\\" + manifest.DeploymentName + "_" + manifest.Version + Mango.Core.ApplicationConstants.FileExtension; Console.WriteLine("Generating {0}", package); XmlDocument appConfigDoc = (XmlDocument)typeof(DeploymentHelper).InvokeMember("CreateAppConfig", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, null, null, new Object[] { manifest, PackageHelper.DeployTarget_LSO }); Stream stream = new FileInfo(package).OpenWrite(); FileStream appStream = (FileStream)typeof(DeploymentHelper).InvokeMember("CreateAppStream", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, null, null, new Object[] { manifest, appConfigDoc, PackageHelper.DeployTarget_LSO }); appStream.CopyTo(stream); appStream.Close(); stream.Close(); } } Console.WriteLine("DONE"); }