4
4
using System.Collections;
5
using System.Collections.Generic;
7
8
using MonoDevelop.Core;
8
9
using MonoDevelop.Core.ProgressMonitoring;
9
10
using MonoDevelop.Projects;
10
using MonoDevelop.Projects.Serialization;
11
using MonoDevelop.Core.Serialization;
11
12
using MonoDevelop.Deployment;
12
13
using MonoDevelop.Deployment.Gui;
70
71
set { defaultConfig = value; }
73
public override bool CanBuild (CombineEntry entry)
74
public override bool CanBuild (SolutionItem entry)
75
76
SolutionDeployer deployer = new SolutionDeployer (generateAutotools);
76
77
return deployer.CanDeploy ( entry );
79
public override void InitializeSettings (CombineEntry entry)
80
public override void InitializeSettings (SolutionItem entry)
81
82
if (string.IsNullOrEmpty (targetDir))
82
83
targetDir = entry.BaseDirectory;
83
84
if (string.IsNullOrEmpty (defaultConfig)) {
84
if (entry.ActiveConfiguration != null)
85
defaultConfig = entry.ActiveConfiguration.Name;
85
SolutionEntityItem se = entry as SolutionEntityItem;
86
defaultConfig = se != null ? se.GetConfigurations () [0] : null;
87
88
if (File.Exists (Path.Combine (entry.BaseDirectory, "autogen.sh")) ||
88
89
File.Exists (Path.Combine (entry.BaseDirectory, "configure"))) {
96
protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx)
97
protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx)
98
99
string tmpFolder = FileService.CreateTempDirectory ();
99
Combine combine = null;
100
CombineEntry entry = RootCombineEntry;
100
Solution solution = null;
101
SolutionItem entry = RootSolutionItem;
103
104
if (generateFiles) {
104
string[] childEntries;
105
if (entry is Combine) {
106
CombineEntry[] ents = GetChildEntries ();
107
childEntries = new string [ents.Length];
108
for (int n=0; n<ents.Length; n++)
109
childEntries [n] = ents [n].FileName;
105
List<string> childEntries = new List<string> ();
106
if (entry is SolutionFolder) {
107
SolutionItem[] ents = GetChildEntries ();
108
foreach (SolutionItem it in ents)
109
childEntries.Add (it.ItemId);
112
112
// If the entry is not a combine, use the parent combine as base combine
113
childEntries = new string [] { entry.FileName };
114
entry = entry.ParentCombine;
113
childEntries.Add (entry.ItemId);
114
entry = entry.ParentFolder;
118
if (entry is SolutionFolder)
119
sourceFile = entry.ParentSolution.FileName;
121
sourceFile = ((SolutionEntityItem)entry).FileName;
117
string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), entry.FileName, childEntries, tmpFolder, null);
123
string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), sourceFile, childEntries.ToArray (), tmpFolder, null);
118
124
if (efile == null) {
119
125
monitor.ReportError (GettextCatalog.GetString ("The project could not be exported."), null);
122
combine = Services.ProjectService.ReadCombineEntry (efile, new NullProgressMonitor ()) as Combine;
128
solution = Services.ProjectService.ReadWorkspaceItem (new NullProgressMonitor (), efile) as Solution;
125
if (entry is Combine)
126
combine = (Combine) entry;
128
combine = entry.ParentCombine;
131
solution = entry.ParentSolution;
131
combine.Build (monitor);
134
solution.Build (monitor, defaultConfig);
133
136
if (monitor.IsCancelRequested || !monitor.AsyncOperation.Success)
136
139
SolutionDeployer deployer = new SolutionDeployer (generateAutotools);
138
if (DefaultConfiguration == null || DefaultConfiguration == "")
139
deployer.Deploy ( ctx, combine, TargetDir, generateFiles, monitor );
141
deployer.Deploy ( ctx, combine, DefaultConfiguration, TargetDir, generateFiles, monitor );
140
if (!deployer.Deploy ( ctx, solution, DefaultConfiguration, TargetDir, generateFiles, monitor ))
144
if (solution != null)
146
146
Directory.Delete (tmpFolder, true);
150
151
protected override string OnResolveDirectory (DeployContext ctx, string folderId)