public static MonoDroidPublishOperation PublishPackage(IProgressMonitor monitor, MonoDroidProject project, ConfigurationSelector configSel, AndroidSigningOptions options, string sourceApk, string destApk, bool createNewKey, string dName, int keyValidity) { var conf = project.GetConfiguration(configSel); var opMon = new AggregatedOperationMonitor(monitor); IAsyncOperation packageOp = null; // If we need signing, it means we don't have the apk ready if (project.PackageNeedsSigning(configSel)) { ClearUploadFlags(conf); packageOp = project.SignPackage(configSel); opMon.AddOperation(packageOp); } var outputMonitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor( GettextCatalog.GetString("Publishing package"), MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true); var op = new MonoDroidPublishOperation(outputMonitor, options, sourceApk, destApk, packageOp, createNewKey, dName, keyValidity); op.Completed += delegate { opMon.Dispose(); outputMonitor.Dispose(); }; op.Start(); return(op); }
//may block while it's showing a GUI. project MUST be built before calling this public static MonoDroidUploadOperation SignAndUpload(IProgressMonitor monitor, MonoDroidProject project, ConfigurationSelector configSel, bool forceReplace, ref AndroidDevice device) { var conf = project.GetConfiguration(configSel); var opMon = new AggregatedOperationMonitor(monitor); InvokeSynch(() => MonoDroidFramework.EnsureSdksInstalled()); IAsyncOperation signOp = null; if (project.PackageNeedsSigning(configSel)) { ClearUploadFlags(conf); signOp = project.SignPackage(configSel); opMon.AddOperation(signOp); } if (device == null) { device = InvokeSynch(() => ChooseDevice(null)); } if (device == null) { opMon.Dispose(); return(null); } if (!device.IsEmulator && MonoDroidFramework.CheckTrial()) { opMon.Dispose(); return(null); } //copture the device for a later anonymous method AndroidDevice dev = device; bool replaceIfExists = forceReplace || !GetUploadFlag(conf, device); var uploadOp = Upload(device, conf.ApkSignedPath, conf.PackageName, signOp, replaceIfExists); opMon.AddOperation(uploadOp); uploadOp.Completed += delegate(IAsyncOperation op) { if (op.Success) { SetUploadFlag(conf, dev); } opMon.Dispose(); }; return(uploadOp); }
public static IAsyncOperation Sign(IProgressMonitor monitor, MonoDroidProject project, ConfigurationSelector configSel) { var conf = project.GetConfiguration(configSel); var opMon = new AggregatedOperationMonitor(monitor); InvokeSynch(() => MonoDroidFramework.EnsureSdksInstalled()); IAsyncOperation signOp = null; if (project.PackageNeedsSigning(configSel)) { ClearUploadFlags(conf); signOp = project.SignPackage(configSel); signOp.Completed += delegate { opMon.Dispose(); }; return(signOp); } return(Core.Execution.NullProcessAsyncOperation.Success); }
public static IAsyncOperation SignAndCopy(IProgressMonitor monitor, MonoDroidProject project, ConfigurationSelector configSel) { var conf = project.GetConfiguration(configSel); var opMon = new AggregatedOperationMonitor(monitor); IAsyncOperation signOp = null; if (project.PackageNeedsSigning(configSel)) { ClearUploadFlags(conf); signOp = project.SignPackage(configSel); opMon.AddOperation(signOp); } string packageName = project.GetPackageName(conf); string targetFile = InvokeSynch(() => ChooseApkLocation(null, project.BaseDirectory, packageName)); if (String.IsNullOrEmpty(targetFile)) { opMon.Dispose(); return(null); } if (MonoDroidFramework.CheckTrial()) { opMon.Dispose(); return(null); } var copy = CopyApk(signOp, conf.ApkSignedPath, targetFile); copy.Completed += delegate { opMon.Dispose(); }; return(copy); }