Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2009-06-22 21:52:48 +0400
committerLluis Sanchez <lluis@novell.com>2009-06-22 21:52:48 +0400
commit902a9495bedc7d03ce59a56b4835f312f6cea5dd (patch)
tree8f3a7cb5c85dcc7d90f06bd8b3fa703b82bcc28c /extras/BooBinding
parentb87dee4056b46c6bde58746b688e85d2fb06becd (diff)
* BooBinding.addin.xml: Remove invalid icon.
* BooBindingCompilerServices.boo: Fix bug 324223 - BOO: When rebuilding external classes, they are not always reloaded correctly. Patch by Manuel de la Pena. * BooLanguageBinding.boo: Use standard icon for boo projects, since boo-project-icon doesn't exist. svn path=/trunk/monodevelop/; revision=136629
Diffstat (limited to 'extras/BooBinding')
-rw-r--r--extras/BooBinding/BooBinding.addin.xml1
-rw-r--r--extras/BooBinding/BooBindingCompilerServices.boo190
-rw-r--r--extras/BooBinding/BooLanguageBinding.boo2
-rw-r--r--extras/BooBinding/ChangeLog11
4 files changed, 135 insertions, 69 deletions
diff --git a/extras/BooBinding/BooBinding.addin.xml b/extras/BooBinding/BooBinding.addin.xml
index 2fbd6e2167..f3a9872bf3 100644
--- a/extras/BooBinding/BooBinding.addin.xml
+++ b/extras/BooBinding/BooBinding.addin.xml
@@ -94,7 +94,6 @@
<Extension path = "/MonoDevelop/Core/StockIcons">
<StockIcon stockid = "md-boo-file" resource = "Boo.FileIcon" />
<StockIcon stockid = "boo-icon" resource = "BooBinding.Base" />
- <StockIcon stockid = "boo-project-icon" resource = "Boo.ProjectIcon" />
</Extension>
</Addin>
diff --git a/extras/BooBinding/BooBindingCompilerServices.boo b/extras/BooBinding/BooBindingCompilerServices.boo
index 2f8a160892..ae69e4bd13 100644
--- a/extras/BooBinding/BooBindingCompilerServices.boo
+++ b/extras/BooBinding/BooBindingCompilerServices.boo
@@ -20,19 +20,15 @@
namespace BooBinding
import System
-import System.Diagnostics
import System.IO
import System.CodeDom.Compiler
import System.Text
-import System.Reflection
+import System.Text.RegularExpressions
-import MonoDevelop.Core.Gui.Components
import MonoDevelop.Core
+import MonoDevelop.Core.ProgressMonitoring
import MonoDevelop.Projects
-import Boo.Lang.Compiler
-import Boo.Lang.Compiler.Resources
-
[extension] #FIXME: workaround BOO-1167
def GetAllReferences (this as ProjectItemCollection) as ProjectReference*:
for item in this:
@@ -43,86 +39,146 @@ def GetAllFiles (this as ProjectItemCollection) as ProjectFile*:
for item in this:
yield item if item isa ProjectFile
-
public class BooBindingCompilerServices:
+
public def CanCompile (fileName as string):
- return Path.GetExtension(fileName).ToUpper() == ".BOO"
+ return Path.GetExtension (fileName).ToUpper () == ".BOO"
def Compile (projectItems as ProjectItemCollection, configuration as DotNetProjectConfiguration, monitor as IProgressMonitor) as BuildResult:
- compilerparameters = cast(BooCompilerParameters, configuration.CompilationParameters)
+ compilerparameters = cast (BooCompilerParameters, configuration.CompilationParameters)
if compilerparameters is null:
- compilerparameters = BooCompilerParameters()
+ compilerparameters = BooCompilerParameters ()
+ #we get the compiler target to be used
+ compilerTarget as string = "exe"
- // FIXME: Use outdir 'configuration.OutputDirectory'
- compiler = Boo.Lang.Compiler.BooCompiler()
- compiler.Parameters.Pipeline = Pipelines.CompileToFile()
-
- compiler.Parameters.Debug = configuration.DebugMode
- compiler.Parameters.OutputAssembly = configuration.CompiledOutputName
- compiler.Parameters.Ducky = compilerparameters.Ducky
-
- # Make sure we don't load the generated assembly at all
- compiler.Parameters.GenerateInMemory = false
-
+ if configuration.CompileTarget == CompileTarget.Exe:
+ compilerTarget = "exe"
+ elif configuration.CompileTarget == CompileTarget.Library:
+ compilerTarget = "library"
+ elif configuration.CompileTarget == CompileTarget.WinExe:
+ compilerTarget = "winexe"
+
+ parameters as StringBuilder = StringBuilder (
+ "-o:${configuration.CompiledOutputName} -t:${compilerTarget}")
+
+ #we decide if we want to use ducks
+ if compilerparameters.Ducky:
+ parameters.Append (" -ducky ")
+
+ #we decide if we are going to define the debug var
+ if configuration.DebugMode:
+ parameters.Append (" -debug+ ")
+ else:
+ parameters.Append (" -debug- ")
+
+ if configuration.EnvironmentVariables.Keys.Count > 0:
+ parameters.Append (" -define: ")
+
+ #we loop through the defines and add them to the list
+ for currentDefine in configuration.EnvironmentVariables.Keys:
+ defineValue = ""
+ if configuration.EnvironmentVariables.TryGetValue (currentDefine, defineValue):
+ if not defineValue == String.Empty:
+ parameters.Append ("${currentDefine}=${defineValue},")
+ else:
+ parameters.Append ("${currentDefine},")
+
+ #we need to remove the last comma added in the loop
+ if configuration.EnvironmentVariables.Keys.Count > 0:
+ parameters.Remove (parameters.ToString ().LastIndexOf (","),1)
+
+ #we add the different references
for lib as ProjectReference in projectItems.GetAllReferences ():
for fileName as string in lib.GetReferencedFileNames (configuration.Id):
- compiler.Parameters.References.Add(Assembly.LoadFile(fileName))
-
+ parameters.Append (" -reference:${fileName} ")
+
for finfo as ProjectFile in projectItems.GetAllFiles ():
if finfo.Subtype != Subtype.Directory:
if finfo.BuildAction == BuildAction.Compile:
- compiler.Parameters.Input.Add(Boo.Lang.Compiler.IO.FileInput(finfo.Name))
+ parameters.Append (" ${finfo.FilePath} ")
elif finfo.BuildAction == BuildAction.EmbeddedResource:
- compiler.Parameters.Resources.Add (EmbeddedFileResource (finfo.Name))
-
+ parameters.Append (" -resource:${finfo.FilePath}[${finfo.ResourceId}]")
+
+ # if the assembly is signed we point to the file
+ if configuration.SignAssembly:
+ parameters.Append (" -keyfile: ${configuration.AssemblyKeyFile} ")
+
+ # we check if the project is going to be using a strong signature and let the
+ # compiler know where to find it
- if configuration.CompileTarget == CompileTarget.Exe:
- compiler.Parameters.OutputType = CompilerOutputType.ConsoleApplication
- elif configuration.CompileTarget == CompileTarget.Library:
- compiler.Parameters.OutputType = CompilerOutputType.Library
- elif configuration.CompileTarget == CompileTarget.WinExe:
- compiler.Parameters.OutputType = CompilerOutputType.WindowsApplication
-
tf = TempFileCollection ()
- context = DoCompilation (monitor, compiler)
- cr = ParseOutput (tf, context)
- return cr
+ compilationOutput = DoCompilation (monitor, parameters.ToString (), configuration.OutputDirectory )
+ return ParseOutput (tf, compilationOutput)
+
- private def DoCompilation (monitor as IProgressMonitor, compiler as Boo.Lang.Compiler.BooCompiler):
+ private def DoCompilation (monitor as IProgressMonitor, parameters as string, outputDir as string):
try:
- monitor.BeginTask (null, 2)
- monitor.Log.WriteLine ("Compiling Boo source code ...")
- context = compiler.Run()
- monitor.Step (1)
- return context
+
+ swError = StringWriter ()
+ chainedError as LogTextWriter = LogTextWriter ()
+ chainedError.ChainWriter (monitor.Log)
+ chainedError.ChainWriter (swError);
+
+ swLog = StringWriter ()
+ chainedLogs as LogTextWriter = LogTextWriter ()
+ chainedLogs.ChainWriter (swLog);
+
+ operationMonitor = AggregatedOperationMonitor (monitor)
+ monitor.Log.WriteLine (GettextCatalog.GetString ("Starting Boo compilation"))
+ monitor.Log.WriteLine (GettextCatalog.GetString ("booc ${parameters}"))
+
+ #we create a new process that will be used to execute the command line of the compiler
+ wrapper = MonoDevelop.Core.Runtime.ProcessService.StartProcess ("booc",parameters ,
+ Path.GetDirectoryName (outputDir),chainedError , chainedLogs, null)
+
+ #we take care of cancelation
+ operationMonitor.AddOperation (wrapper);
+ wrapper.WaitForOutput ();
+ exitCode = wrapper.ExitCode
+
+ if monitor.IsCancelRequested:
+ monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled"))
+ monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null)
+ if exitCode == 0:
+ exitCode = -1
+
+ error = swLog.ToString ()
+ return error
ensure:
- monitor.EndTask()
+ #we get rid of this guys
+ wrapper.Dispose ()
+ swError.Close ()
+ chainedError.Close ()
+ operationMonitor.Dispose ()
+ monitor.EndTask ()
+ swLog.Close ()
- def ParseOutput (tf as TempFileCollection , context as CompilerContext) as BuildResult:
+ def ParseOutput (tf as TempFileCollection , errors as string):
cr = CompilerResults (tf)
+ # we read the errors line by line to get them in the monodevelop list
+ reader = StringReader (errors);
+ nextError as string
- for err as Boo.Lang.Compiler.CompilerError in context.Errors:
- cerror = System.CodeDom.Compiler.CompilerError ()
- cerror.ErrorText = err.Code + ": " + err.Message
-
- if err.LexicalInfo is not null:
- SetErrorLexicalInfo (cerror, err.LexicalInfo)
-
- cr.Errors.Add(cerror)
-
- for warning as CompilerWarning in context.Warnings:
- cerror = System.CodeDom.Compiler.CompilerError ()
- cerror.ErrorText = warning.Code + ": " + warning.Message
-
- if warning.LexicalInfo is not null:
- SetErrorLexicalInfo (cerror, warning.LexicalInfo)
-
- cerror.IsWarning = true
- cr.Errors.Add(cerror)
-
+ while (nextError = reader. ReadLine()) != null:
+ error = ParseErrorLine(nextError)
+ if not error is null:
+ cr.Errors.Insert (0,error)
+
+ reader.Close ();
return BuildResult (cr, null)
- def SetErrorLexicalInfo (error as System.CodeDom.Compiler.CompilerError, lexicalInfo as Boo.Lang.Compiler.Ast.LexicalInfo):
- error.FileName = lexicalInfo.FileName
- error.Column = lexicalInfo.Column
- error.Line = lexicalInfo.Line
+ private def ParseErrorLine(errorLine as string) as System.CodeDom.Compiler.CompilerError:
+ error = System.CodeDom.Compiler.CompilerError()
+ #errors are of the form "file(row, column):ErrorNum:Type:message"
+ data = @/(?<file>.*\.boo)\s*\((?<row>\d+),\s?(?<column>\d+)\):\s*(?<message>.*)/.Matches (errorLine)
+ if data.Count > 0:
+ error.ErrorText = data[0].Groups["message"].Value
+ error.FileName = data[0].Groups["file"].Value
+ error.Line = int.Parse (data[0].Groups["row"].Value)
+ error.Column = int.Parse (data[0].Groups["column"].Value)
+ if error.ErrorText.Contains ("WARNING"):
+ error.IsWarning = true
+ return error
+ else:
+ return null
+ \ No newline at end of file
diff --git a/extras/BooBinding/BooLanguageBinding.boo b/extras/BooBinding/BooLanguageBinding.boo
index bca6b2f1f0..3c1236d479 100644
--- a/extras/BooBinding/BooLanguageBinding.boo
+++ b/extras/BooBinding/BooLanguageBinding.boo
@@ -49,7 +49,7 @@ public class BooLanguageBinding(IDotNetLanguageBinding):
public ProjectStockIcon as string:
get:
- return "boo-project-icon"
+ return "md-project"
public def CanCompile(fileName as string) as bool:
Debug.Assert(compilerServices is not null)
diff --git a/extras/BooBinding/ChangeLog b/extras/BooBinding/ChangeLog
index 204d1519e4..c327b067e2 100644
--- a/extras/BooBinding/ChangeLog
+++ b/extras/BooBinding/ChangeLog
@@ -1,3 +1,14 @@
+2009-06-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * BooBinding.addin.xml: Remove invalid icon.
+
+ * BooBindingCompilerServices.boo: Fix bug 324223 - BOO: When
+ rebuilding external classes, they are not always reloaded
+ correctly. Patch by Manuel de la Pena.
+
+ * BooLanguageBinding.boo: Use standard icon for boo projects,
+ since boo-project-icon doesn't exist.
+
2009-06-17 Lluis Sanchez Gual <lluis@novell.com>
* BooBinding.sln: