Skip to content

Implement and expose compilation defines #4

Merged
merged 6 commits into from Apr 11, 2012
+109 −256
View
4 src/Boo.MonoDevelop.Util/BooCompletionTextEditorExtension.boo
@@ -39,7 +39,7 @@ class BooCompletionTextEditorExtension(CompletionTextEditorExtension,IPathedDocu
static IMPORTS_PATTERN = /^\s*import\s+(?<namespace>[\w\d]+(\.[\w\d]+)*)?\.?\s*/
# Only lookup "Go to" once
- static gotoBase = GettextCatalog.GetString ("Go to")
+ static gotoBase = GettextCatalog.GetString ("Go to Definition ({0})")
override def Initialize():
super()
@@ -380,7 +380,7 @@ class BooCompletionTextEditorExtension(CompletionTextEditorExtension,IPathedDocu
if (location != null):
displayText = DisplayTextForLocation (location)
if not string.IsNullOrEmpty (displayText):
- item.Text = string.Format ("{0} {1}", gotoBase, displayText)
+ item.Text = string.Format (gotoBase, displayText)
[CommandHandler(MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration)]
def GotoDeclaration ():
View
21 src/Boo.MonoDevelop/ProjectModel/BooCompilationParameters.boo
@@ -1,21 +1,34 @@
namespace Boo.MonoDevelop.ProjectModel
+import System
import MonoDevelop.Projects
import MonoDevelop.Core.Serialization
import Boo.MonoDevelop.Util
class BooCompilationParameters(ConfigurationParameters):
+ static DefineSeparator = ";"
ConfigurationItemProperty GenWarnings = false
ConfigurationItemProperty Ducky = false
ConfigurationItemProperty Culture = ""
ConfigurationItemProperty NoStdLib = false
+ [ItemProperty]
+ DefineConstants as string:
+ get: return string.Join (DefineSeparator, _defines.ToArray ())
+ set:
+ if (string.IsNullOrEmpty (value)):
+ _defines = System.Collections.Generic.List of string()
+ else:
+ _defines = System.Collections.Generic.List of string(value.Split (array (string, (DefineSeparator,)), StringSplitOptions.RemoveEmptyEntries))
+ private _defines = System.Collections.Generic.List of string()
+
+ DefineSymbols:
+ get: return _defines
+
override def AddDefineSymbol (symbol as string):
- # TODO: Implement
- pass
+ _defines.Add (symbol) unless _defines.Contains (symbol)
override def RemoveDefineSymbol (symbol as string):
- # TODO: Implement
- pass
+ _defines.Remove (symbol) if _defines.Contains (symbol)
View
4 src/Boo.MonoDevelop/ProjectModel/BooCompiler.boo
@@ -74,6 +74,8 @@ class BooCompiler:
if _compilationParameters.Ducky: options.WriteLine("-ducky")
if _compilationParameters.NoStdLib: options.WriteLine("-nostdlib")
+ for define in _compilationParameters.DefineSymbols:
+ options.WriteLine ("-define:${define}")
projectFiles = item as ProjectFile for item in _projectItems if item isa ProjectFile
for file in projectFiles:
@@ -92,6 +94,8 @@ class BooCompiler:
options.WriteLine("-reference:${fileName}")
optionsString = options.ToString()
+ if (_monitor):
+ _monitor.Log.WriteLine (optionsString)
print optionsString
File.WriteAllText(responseFileName, optionsString)
View
18 src/Boo.MonoDevelop/ProjectModel/GUI/BooCompilationParametersPanel.boo
@@ -9,22 +9,34 @@ import Gtk from "gtk-sharp"
class BooCompilationParametersPanel(MultiConfigItemOptionsPanel):
override def CreatePanelWidget():
+ vbox = VBox ()
+ definesHbox = HBox ()
_noStdLibCheckButton = CheckButton.NewWithLabel("No standard libraries")
- _noStdLibCheckButton.ShowAll()
- return _noStdLibCheckButton
+ vbox.PackStart (_noStdLibCheckButton, false, true, 5)
+ _definesEntry = Entry ()
+ definesLabel = Label ("Define Symbols: ")
+ definesHbox.PackStart (definesLabel, false, false, 5)
+ definesHbox.PackStart (_definesEntry, true , true, 5)
+ vbox.PackStart (definesHbox, true, true, 5)
+ vbox.ShowAll ()
+ return vbox
override def LoadConfigData():
_noStdLibCheckButton.Active = BooCompilationParameters.NoStdLib
+ _definesEntry.Text = BooCompilationParameters.DefineConstants
override def ValidateChanges():
return true
override def ApplyChanges():
BooCompilationParameters.NoStdLib = _noStdLibCheckButton.Active
+ BooCompilationParameters.DefineConstants = _definesEntry.Text
BooCompilationParameters as BooCompilationParameters:
get:
config as DotNetProjectConfiguration = self.CurrentConfiguration
return config.CompilationParameters
- _noStdLibCheckButton as Gtk.CheckButton
+ _noStdLibCheckButton as Gtk.CheckButton
+ _definesEntry as Gtk.Entry
+
View
37 src/UnityScript.MonoDevelop/ProjectModel/GUI/UnityScriptCompilationParametersPanel.boo
@@ -0,0 +1,37 @@
+namespace UnityScript.MonoDevelop.ProjectModel.GUI
+
+import MonoDevelop.Projects
+import MonoDevelop.Ide.Gui.Dialogs
+
+import UnityScript.MonoDevelop.ProjectModel
+import Gtk from "gtk-sharp"
+
+class UnityScriptCompilationParametersPanel(MultiConfigItemOptionsPanel):
+
+ override def CreatePanelWidget():
+ vbox = VBox ()
+ definesHbox = HBox ()
+ _definesEntry = Entry ()
+ definesLabel = Label ("Define Symbols: ")
+ definesHbox.PackStart (definesLabel, false, false, 5)
+ definesHbox.PackStart (_definesEntry, true , true, 5)
+ vbox.PackStart (definesHbox, true, true, 5)
+ vbox.ShowAll ()
+ return vbox
+
+ override def LoadConfigData():
+ _definesEntry.Text = UnityScriptCompilationParameters.DefineConstants
+
+ override def ValidateChanges():
+ return true
+
+ override def ApplyChanges():
+ UnityScriptCompilationParameters.DefineConstants = _definesEntry.Text
+
+ UnityScriptCompilationParameters as UnityScriptCompilationParameters:
+ get:
+ config as DotNetProjectConfiguration = self.CurrentConfiguration
+ return config.CompilationParameters
+
+ _definesEntry as Gtk.Entry
+
View
23 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCompilationParameters.boo
@@ -1,12 +1,27 @@
namespace UnityScript.MonoDevelop.ProjectModel
+import System
import MonoDevelop.Projects
+import MonoDevelop.Core.Serialization
class UnityScriptCompilationParameters(ConfigurationParameters):
+ static DefineSeparator = ";"
+
+ [ItemProperty]
+ DefineConstants as string:
+ get: return string.Join (DefineSeparator, _defines.ToArray ())
+ set:
+ if (string.IsNullOrEmpty (value)):
+ _defines = System.Collections.Generic.List of string()
+ else:
+ _defines = System.Collections.Generic.List of string(value.Split (array (string, (DefineSeparator,)), StringSplitOptions.RemoveEmptyEntries))
+ private _defines = System.Collections.Generic.List of string()
+
+ DefineSymbols:
+ get: return _defines
+
override def AddDefineSymbol (symbol as string):
- # TODO: Implement
- pass
+ _defines.Add (symbol) unless _defines.Contains (symbol)
override def RemoveDefineSymbol (symbol as string):
- # TODO: Implement
- pass
+ _defines.Remove (symbol) if _defines.Contains (symbol)
View
7 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCompiler.boo
@@ -15,6 +15,7 @@ class UnityScriptCompiler:
_projectItems as ProjectItemCollection
_compilationParameters as UnityScriptCompilationParameters
_projectParameters as UnityScriptProjectParameters
+ _monitor as IProgressMonitor
def constructor(
config as DotNetProjectConfiguration,
@@ -27,6 +28,7 @@ class UnityScriptCompiler:
_projectItems = projectItems
_compilationParameters = config.CompilationParameters or UnityScriptCompilationParameters()
_projectParameters = config.ProjectParameters or UnityScriptProjectParameters()
+ _monitor = progressMonitor
def Run() as BuildResult:
responseFileName = Path.GetTempFileName()
@@ -59,6 +61,9 @@ class UnityScriptCompiler:
commandLine.WriteLine("-debug+")
commandLine.WriteLine("-out:${_config.CompiledOutputName}")
+ for define in _compilationParameters.DefineSymbols:
+ commandLine.WriteLine ("-define:${define}")
+
for r in referencedFiles:
commandLine.WriteLine("-reference:'$r'")
@@ -73,6 +78,8 @@ class UnityScriptCompiler:
print "Unrecognized build action:", file.BuildAction
commandLineString = commandLine.ToString()
+ if (_monitor):
+ _monitor.Log.WriteLine (commandLineString)
print commandLineString
File.WriteAllText(responseFileName, commandLineString)
View
236 src/UnityScript.MonoDevelop/ShaderLabSyntaxMode.xml
@@ -1,236 +0,0 @@
-<!-- ShaderLabSyntaxMode.xml
-
- Author:
- Levi Bard <levi@unity3d.com>
-
- Copyright (c) 2010 Unity Technologies A/S
-
- Based on CSharpSyntaxMode by Mike Krüger
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. -->
-
-<SyntaxMode name = "ShaderLab" mimeTypes="text/x-shader" ignorecase="true" extends="text/x-csrc">
- <Property name="LineComment">//</Property>
- <Property name="StringQuote">"</Property>
- <EolSpan color = "text.preprocessor" rule="text.preprocessor">#</EolSpan>
-
- <EolSpan color = "comment.line" rule="Comment" tagColor="comment.tag.line">//</EolSpan>
-
- <Span color = "string.double" rule="String" stopateol = "true" escape='\'>
- <Begin>"</Begin>
- <End>"</End>
- </Span>
-
- <Match color = "constant.digit">CSharpNumber</Match>
-
- <Keywords color = "text.preprocessor">
- <Word>CGPROGRAM</Word>
- <Word>ENDCG</Word>
- </Keywords>
-
- <Keywords color = "keyword.operator">
- <Word>TexGen</Word>
- <Word>LightmapMode</Word>
- <Word>SetTexture</Word>
- <Word>Lighting</Word>
- <Word>Material</Word>
- <Word>Cull</Word>
- <Word>ZTest</Word>
- <Word>ZWrite</Word>
- <Word>Fog</Word>
- <Word>AlphaTest</Word>
- <Word>Blend</Word>
- <Word>ColorMask</Word>
- <Word>Offset</Word>
- <Word>SeparateSpecular</Word>
- <Word>ColorMaterial</Word>
- <Word>Diffuse</Word>
- <Word>Ambient</Word>
- <Word>Specular</Word>
- <Word>Shininess</Word>
- <Word>Emission</Word>
- <Word>Combine</Word>
- <Word>ConstantColor</Word>
- <Word>Matrix</Word>
- <Word>Lerp</Word>
- <Word>Mode</Word>
- <Word>Density</Word>
- <Word>LightMode</Word>
- <Word>RequireOptions</Word>
- <Word>LightTexCount</Word>
- <Word>Name</Word>
- <Word>Bind</Word>
- <Word>UsePass</Word>
- <Word>TextureScale</Word>
- <Word>TextureSize</Word>
- <Word>BorderScale</Word>
- <Word>Fallback</Word>
- </Keywords>
-
- <Keywords color = "keyword.selection">
- </Keywords>
-
- <Keywords color = "keyword.iteration">
- </Keywords>
-
- <Keywords color = "keyword.jump">
- </Keywords>
-
- <Keywords color = "keyword.context">
- </Keywords>
-
- <Keywords color = "keyword.exceptions">
- </Keywords>
-
- <Keywords color = "constant.language">
- <Word>On</Word>
- <Word>Off</Word>
- <Word>ObjectLinear</Word>
- <Word>EyeLinear</Word>
- <Word>SphereMap</Word>
- <Word>CubeReflect</Word>
- <Word>CubeNormal</Word>
- <Word>A</Word>
- <Word>RGB</Word>
- <Word>Less</Word>
- <Word>Greater</Word>
- <Word>LEqual</Word>
- <Word>GEqual</Word>
- <Word>NotEqual</Word>
- <Word>Always</Word>
- <Word>AmbientAndDiffuse</Word>
- <Word>Emission</Word>
- <Word>Back</Word>
- <Word>Front</Word>
- <Word>Linear</Word>
- <Word>Exp</Word>
- <Word>Exp2</Word>
- <Word>One</Word>
- <Word>Zero</Word>
- <Word>SrcColor</Word>
- <Word>SrcAlpha</Word>
- <Word>DstColor</Word>
- <Word>DstAlpha</Word>
- <Word>OneMinusSrcColor</Word>
- <Word>OneMinusSrcAlpha</Word>
- <Word>OneMinusDstColor</Word>
- <Word>OneMinusDstAlpha</Word>
- <Word>AppSrcAdd</Word>
- <Word>AppDstAdd</Word>
- <Word>Vertex</Word>
- <Word>VertexOrNone</Word>
- <Word>VertexOnly</Word>
- <Word>Pixel</Word>
- <Word>PixelOnly</Word>
- <Word>VertexOrPixel</Word>
- <Word>VertexAndPixel</Word>
- <Word>PixelOrNone</Word>
- <Word>None</Word>
- <Word>Always</Word>
- <Word>SoftVegetation</Word>
- <Word>Normal</Word>
- <Word>Tangent</Word>
- <Word>Texcoord</Word>
- <Word>Texcoord0</Word>
- <Word>Texcoord1</Word>
- </Keywords>
-
- <Keywords color = "keyword.declaration">
- </Keywords>
-
- <Keywords color = "keyword.type">
- <Word>Shader</Word>
- <Word>Properties</Word>
- <Word>SubShader</Word>
- <Word>Pass</Word>
- <Word>Texture</Word>
- <Word>Fog</Word>
- <Word>Tags</Word>
- <Word>BindChannels</Word>
- <Word>GrabPass</Word>
- <Word>Category</Word>
- <Word>Color</Word>
- <Word>Range</Word>
- <Word>Float</Word>
- <Word>Vector</Word>
- <Word>2D</Word>
- <Word>Rect</Word>
- <Word>Cube</Word>
- <Word>_Object2World</Word>
- <Word>_World2Object</Word>
- <Word>_ObjectSpaceCameraPos</Word>
- <Word>_ModelLightColor</Word>
- <Word>_SpecularLightColor</Word>
- <Word>_ObjectSpaceLightPos</Word>
- <Word>_Light2World</Word>
- <Word>_World2Light</Word>
- <Word>_Object2Light</Word>
- <Word>_Time</Word>
- <Word>_SinTime</Word>
- <Word>_CosTime</Word>
- <Word>_ProjectionParams</Word>
- <Word>_CubeNormalize</Word>
- <Word>_SpecFalloff</Word>
- <Word>Constant</Word>
- <Word>Previous</Word>
- </Keywords>
-
- <Keywords color = "constant.language.void">
- </Keywords>
-
- <Keywords color = "keyword.namespace">
- </Keywords>
-
- <Keywords color = "keyword.property">
- </Keywords>
-
- <Keywords color = "keyword.declaration">
- </Keywords>
-
- <Keywords color = "keyword.parameter">
- </Keywords>
-
-
- <Keywords color = "keyword.operator.declaration">
- </Keywords>
-
- <Keywords color = "keyword.misc">
- </Keywords>
-
- <Rule name = "text.preprocessor">
- <Keywords color="text.preprocessor.keyword">
- <Word>pragma</Word>
- </Keywords>
- </Rule>
-
- <Rule name = "Comment">
- <Keywords color="comment.keyword.todo" ignorecase="True">
- </Keywords>
- </Rule>
-
- <Rule name = "String">
- </Rule>
-
- <Rule name = "XmlDocumentationTag">
- </Rule>
-
- <Keywords color="keyword.type">
- </Keywords>
-
-</SyntaxMode>
View
14 src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.addin.xml
@@ -77,16 +77,10 @@
<MimeType id="text/x-unityscript" _description="UnityScript source code" icon="md-unityscript-file" isText="true">
<File pattern="*.us" />
</MimeType>
- <MimeType id="text/x-shader" _description="ShaderLab shader" isText="true">
- <File pattern="*.shader" />
- <File pattern="*.cginc" />
- <File pattern="*.glslinc" />
- </MimeType>
</Extension>
<Extension path = "/MonoDevelop/SourceEditor2/SyntaxModes">
<Templates resource="UnityScriptSyntaxMode.xml"/>
- <Templates resource="ShaderLabSyntaxMode.xml"/>
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/LanguageBindings">
@@ -112,4 +106,12 @@
<CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration" insertafter="MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations" />
</Condition>
</Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels/Build/Compiler">
+ <Condition id="ActiveLanguage" value="UnityScript">
+ <Panel id = "UnityScriptCompilationParametersPanel"
+ _label = "Compiler"
+ class = "UnityScript.MonoDevelop.ProjectModel.GUI.UnityScriptCompilationParametersPanel"/>
+ </Condition>
+ </Extension>
</Addin>
View
1 src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.booproj
@@ -99,6 +99,5 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="UnityScript.MonoDevelop.addin.xml" />
- <EmbeddedResource Include="ShaderLabSyntaxMode.xml" />
</ItemGroup>
</Project>
Something went wrong with that request. Please try again.