Author: lluis
Date: 2007-03-26 09:06:07 -0500 (Mon, 26 Mar 2007)
New Revision: 74981
Added:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommandExtension.cs
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
trunk/monodevelop/Core/src/MonoDevelop.Projects/Makefile.am
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.mdp
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Combine.cs
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CombineEntry.cs
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Project.cs
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/ProjectService.cs
Log:
* MonoDevelop.Projects/ProjectService.cs,
MonoDevelop.Projects/CombineEntry.cs,
MonoDevelop.Projects/CustomCommandExtension.cs,
MonoDevelop.Projects/Combine.cs, MonoDevelop.Projects/Project.cs:
Moved custom command execution to a project service extension.
* MonoDevelop.Projects.mdp, Makefile.am: Updated.
Modified: trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog 2007-03-26
13:47:27 UTC (rev 74980)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog 2007-03-26
14:06:07 UTC (rev 74981)
@@ -1,3 +1,12 @@
+2007-03-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * MonoDevelop.Projects/ProjectService.cs,
+ MonoDevelop.Projects/CombineEntry.cs,
+ MonoDevelop.Projects/CustomCommandExtension.cs,
+ MonoDevelop.Projects/Combine.cs, MonoDevelop.Projects/Project.cs:
+ Moved custom command execution to a project service extension.
+ * MonoDevelop.Projects.mdp, Makefile.am: Updated.
+
2007-03-19 Jeffrey Stedfast <[EMAIL PROTECTED]>
* MonoDevelop.Projects.Text/ITextFile.cs: Added GetCharAt()
Modified: trunk/monodevelop/Core/src/MonoDevelop.Projects/Makefile.am
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects/Makefile.am 2007-03-26
13:47:27 UTC (rev 74980)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects/Makefile.am 2007-03-26
14:06:07 UTC (rev 74981)
@@ -203,6 +203,7 @@
MonoDevelop.Projects/ConvertXml.cs \
MonoDevelop.Projects/CustomCommand.cs \
MonoDevelop.Projects/CustomCommandCollection.cs \
+ MonoDevelop.Projects/CustomCommandExtension.cs \
MonoDevelop.Projects/CustomCommandType.cs \
MonoDevelop.Projects/CyclicBuildOrderException.cs \
MonoDevelop.Projects/DefaultCompilerResult.cs \
@@ -239,9 +240,9 @@
MonoDevelop.Projects/ProjectReferenceCollection.cs \
MonoDevelop.Projects/ProjectReferenceEventArgs.cs \
MonoDevelop.Projects/ProjectRenameEventArgs.cs \
+ MonoDevelop.Projects/ProjectsServices.cs \
MonoDevelop.Projects/ProjectService.cs \
MonoDevelop.Projects/ProjectServiceExtension.cs \
- MonoDevelop.Projects/ProjectsServices.cs \
MonoDevelop.Projects/TypelibImporter.cs \
MonoDevelop.Projects/UnknownCombineEntry.cs \
MonoDevelop.Projects/UnknownProjectVersionException.cs
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Combine.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Combine.cs
2007-03-26 13:47:27 UTC (rev 74980)
+++
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Combine.cs
2007-03-26 14:06:07 UTC (rev 74981)
@@ -471,12 +471,6 @@
protected internal override void OnExecute (IProgressMonitor
monitor, ExecutionContext context)
{
- AbstractConfiguration conf = ActiveConfiguration as
AbstractConfiguration;
- if (conf != null && conf.CustomCommands.HasCommands
(CustomCommandType.Execute)) {
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.Execute, context);
- return;
- }
-
if (singleStartup) {
if (StartupEntry != null)
StartupEntry.Execute (monitor, context);
@@ -683,11 +677,6 @@
protected internal override void OnClean (IProgressMonitor
monitor)
{
CombineConfiguration config = ActiveConfiguration as
CombineConfiguration;
- if (config != null && config.CustomCommands.HasCommands
(CustomCommandType.Clean)) {
- config.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.Clean);
- return;
- }
-
if (config == null)
return;
@@ -702,13 +691,6 @@
return new DefaultCompilerResult (new
CompilerResults (null), "", 0, 1);
}
- CombineConfiguration config = ActiveConfiguration as
CombineConfiguration;
- if (config != null && config.CustomCommands.HasCommands
(CustomCommandType.Build)) {
- config.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.Build);
- return new DefaultCompilerResult (new
CompilerResults (null), "", 0, 0);
- }
-
-
CombineEntryCollection allProjects =
GetAllBuildableEntries (ActiveConfiguration.Name);
monitor.BeginTask (GettextCatalog.GetString ("Building
Solution {0}", Name), allProjects.Count);
try {
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CombineEntry.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CombineEntry.cs
2007-03-26 13:47:27 UTC (rev 74980)
+++
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CombineEntry.cs
2007-03-26 14:06:07 UTC (rev 74981)
@@ -394,49 +394,17 @@
public void Clean (IProgressMonitor monitor)
{
- AbstractConfiguration conf = ActiveConfiguration as
AbstractConfiguration;
- if (conf != null) {
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.BeforeClean);
- if (monitor.IsCancelRequested)
- return;
- }
-
Services.ProjectService.ExtensionChain.Clean (monitor,
this);
-
- if (conf != null && !monitor.IsCancelRequested)
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.AfterClean);
}
public ICompilerResult Build (IProgressMonitor monitor)
{
- AbstractConfiguration conf = ActiveConfiguration as
AbstractConfiguration;
- if (conf != null) {
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.BeforeBuild);
- if (monitor.IsCancelRequested)
- return new DefaultCompilerResult (new
CompilerResults (null), "");
- }
-
- ICompilerResult res = InternalBuild (monitor);
-
- if (conf != null && !monitor.IsCancelRequested)
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.AfterBuild);
-
- return res;
+ return InternalBuild (monitor);
}
public void Execute (IProgressMonitor monitor, ExecutionContext
context)
{
- AbstractConfiguration conf = ActiveConfiguration as
AbstractConfiguration;
- if (conf != null) {
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.BeforeExecute, context);
- if (monitor.IsCancelRequested)
- return;
- }
-
Services.ProjectService.ExtensionChain.Execute
(monitor, this, context);
-
- if (conf != null && !monitor.IsCancelRequested)
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.AfterExecute, context);
}
public bool NeedsBuilding {
Added:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommandExtension.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommandExtension.cs
2007-03-26 13:47:27 UTC (rev 74980)
+++
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommandExtension.cs
2007-03-26 14:06:07 UTC (rev 74981)
@@ -0,0 +1,57 @@
+
+using System;
+using MonoDevelop.Core;
+using System.CodeDom.Compiler;
+
+namespace MonoDevelop.Projects
+{
+ public class CustomCommandExtension: ProjectServiceExtension
+ {
+ public override ICompilerResult Build (IProgressMonitor
monitor, CombineEntry entry)
+ {
+ AbstractConfiguration conf = entry.ActiveConfiguration
as AbstractConfiguration;
+ if (conf != null) {
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.BeforeBuild);
+ if (monitor.IsCancelRequested)
+ return new DefaultCompilerResult (new
CompilerResults (null), "");
+ }
+
+ ICompilerResult res = base.Build (monitor, entry);
+
+ if (conf != null && !monitor.IsCancelRequested)
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.AfterBuild);
+
+ return res;
+ }
+
+ public override void Clean (IProgressMonitor monitor,
CombineEntry entry)
+ {
+ AbstractConfiguration conf = entry.ActiveConfiguration
as AbstractConfiguration;
+ if (conf != null) {
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.BeforeClean);
+ if (monitor.IsCancelRequested)
+ return;
+ }
+
+ base.Clean (monitor, entry);
+
+ if (conf != null && !monitor.IsCancelRequested)
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.AfterClean);
+ }
+
+ public override void Execute (IProgressMonitor monitor,
CombineEntry entry, ExecutionContext context)
+ {
+ AbstractConfiguration conf = entry.ActiveConfiguration
as AbstractConfiguration;
+ if (conf != null) {
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.BeforeExecute, context);
+ if (monitor.IsCancelRequested)
+ return;
+ }
+
+ base.Execute (monitor, entry, context);
+
+ if (conf != null && !monitor.IsCancelRequested)
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.AfterExecute, context);
+ }
+ }
+}
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Project.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Project.cs
2007-03-26 13:47:27 UTC (rev 74980)
+++
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/Project.cs
2007-03-26 14:06:07 UTC (rev 74981)
@@ -386,13 +386,10 @@
protected internal override ICompilerResult OnBuild
(IProgressMonitor monitor)
{
- AbstractProjectConfiguration conf = ActiveConfiguration
as AbstractProjectConfiguration;
- if (conf != null && conf.CustomCommands.HasCommands
(CustomCommandType.Build)) {
- conf.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.Build);
- return new DefaultCompilerResult (new
CompilerResults (null), "");
- }
-
// create output directory, if not exists
+ AbstractProjectConfiguration conf = ActiveConfiguration
as AbstractProjectConfiguration;
+ if (conf == null)
+ return null;
string outputDir = conf.OutputDirectory;
try {
DirectoryInfo directoryInfo = new
DirectoryInfo(outputDir);
@@ -424,12 +421,6 @@
{
isDirty = true;
- AbstractProjectConfiguration config =
ActiveConfiguration as AbstractProjectConfiguration;
- if (config != null && config.CustomCommands.HasCommands
(CustomCommandType.Clean)) {
- config.CustomCommands.ExecuteCommand (monitor,
this, CustomCommandType.Clean);
- return;
- }
-
// Delete the generated assembly
string file = GetOutputFileName ();
if (file != null) {
@@ -440,6 +431,7 @@
}
// Delete referenced assemblies
+ AbstractProjectConfiguration config =
ActiveConfiguration as AbstractProjectConfiguration;
if (config != null)
CleanReferencesInOutputPath
(config.OutputDirectory);
}
@@ -471,12 +463,7 @@
protected internal override void OnExecute (IProgressMonitor
monitor, ExecutionContext context)
{
- AbstractProjectConfiguration configuration =
(AbstractProjectConfiguration) ActiveConfiguration;
-
- if (configuration != null &&
configuration.CustomCommands.HasCommands (CustomCommandType.Execute)) {
- configuration.CustomCommands.ExecuteCommand
(monitor, this, CustomCommandType.Execute, context);
- } else
- DoExecute (monitor, context);
+ DoExecute (monitor, context);
}
protected virtual void DoExecute (IProgressMonitor monitor,
ExecutionContext context)
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/ProjectService.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/ProjectService.cs
2007-03-26 13:47:27 UTC (rev 74980)
+++
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/ProjectService.cs
2007-03-26 14:06:07 UTC (rev 74981)
@@ -36,7 +36,7 @@
DataContext dataContext = new DataContext ();
ArrayList projectBindings = new ArrayList ();
ProjectServiceExtension defaultExtension = new
DefaultProjectServiceExtension ();
- ProjectServiceExtension extensionChain;
+ ProjectServiceExtension extensionChain = new
CustomCommandExtension ();
FileFormatManager formatManager = new FileFormatManager ();
IFileFormat defaultProjectFormat = new MdpFileFormat ();
@@ -203,9 +203,10 @@
if (extensions.Length > 0) {
extensions [extensions.Length - 1].Next =
defaultExtension;
- extensionChain = extensions [0];
- } else
- extensionChain = defaultExtension;
+ extensionChain.Next = extensions [0];
+ } else {
+ extensionChain.Next = defaultExtension;
+ }
}
}
@@ -230,16 +231,32 @@
public override void Clean (IProgressMonitor monitor,
CombineEntry entry)
{
+ AbstractConfiguration config =
entry.ActiveConfiguration as AbstractConfiguration;
+ if (config != null && config.CustomCommands.HasCommands
(CustomCommandType.Clean)) {
+ config.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.Clean);
+ return;
+ }
+
entry.OnClean (monitor);
}
public override ICompilerResult Build (IProgressMonitor
monitor, CombineEntry entry)
{
+ AbstractConfiguration conf = entry.ActiveConfiguration
as AbstractConfiguration;
+ if (conf != null && conf.CustomCommands.HasCommands
(CustomCommandType.Build)) {
+ conf.CustomCommands.ExecuteCommand (monitor,
entry, CustomCommandType.Build);
+ return new DefaultCompilerResult (new
CompilerResults (null), "");
+ }
return entry.OnBuild (monitor);
}
public override void Execute (IProgressMonitor monitor,
CombineEntry entry, ExecutionContext context)
{
+ AbstractConfiguration configuration =
entry.ActiveConfiguration as AbstractConfiguration;
+ if (configuration != null &&
configuration.CustomCommands.HasCommands (CustomCommandType.Execute)) {
+ configuration.CustomCommands.ExecuteCommand
(monitor, entry, CustomCommandType.Execute, context);
+ return;
+ }
entry.OnExecute (monitor, context);
}
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.mdp
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.mdp
2007-03-26 13:47:27 UTC (rev 74980)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.mdp
2007-03-26 14:06:07 UTC (rev 74981)
@@ -251,15 +251,16 @@
<File name="./MonoDevelop.Projects/GenericProjectBinding.cs"
subtype="Code" buildaction="Compile" />
<File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
<File name="./MonoDevelop.Projects.dll.config" subtype="Code"
buildaction="FileCopy" />
+ <File name="./MonoDevelop.Projects/CustomCommandExtension.cs"
subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="False" refto="monodoc,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<ProjectReference type="Gac" localcopy="False" refto="System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="False" refto="System.Xml,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <ProjectReference type="Gac" localcopy="False" refto="System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<ProjectReference type="Gac" localcopy="False" refto="Mono.Posix,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<ProjectReference type="Project" localcopy="False"
refto="MonoDevelop.Core" />
<ProjectReference type="Assembly" localcopy="False"
refto="../../../build/bin/Mono.Cecil.dll" />
+ <ProjectReference type="Gac" localcopy="True" refto="System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</References>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True"
RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName=""
SyncReferences="True" IsAutotoolsProject="True"
RelativeConfigureInPath="../../../">
<ExcludedFiles>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches