https://wiki.dlang.org/api.php?action=feedcontributions&user=AthanasiusOfAlex&feedformat=atomD Wiki - User contributions [en]2024-03-19T01:28:38ZUser contributionsMediaWiki 1.31.2https://wiki.dlang.org/?title=Mono-D&diff=8013Mono-D2016-09-20T10:27:35Z<p>AthanasiusOfAlex: /* Setup Mono-D */ Fixed the include path for OS X</p>
<hr />
<div>'''Mono-D''' brings D support to the cross-platform XamarinStudio/MonoDevelop [[IDEs|IDE]].<br />
<br />
[[File:Mono-D_screenshot1.png|500px]]<br />
<br />
== Features ==<br />
<br />
* D Project management<br />
** Managing files & resources<br />
** Managing inter-project dependencies in a solution<br />
** Build projects and prepare them for being deployed<br />
* Ad hoc [[DUB]] support. <small>Despite the package.json/dub.json file not being a native format that is supported by the Mono/.Net facilities, there's still a bunch of things wrapped for being used within MD.</small><br />
** Open DUB package.json/dub.json files as projects<br />
** Resolving package dependencies and subpackages and opening all of them as projects, too<br />
** Build support<br />
** ...<br />
* Basic [[Visual-D]] project format support<br />
* [[dmd]], [[gdc]], [[ldc2]], [[rdmd]], [[dub]], [[make]] toolchain support<br />
* '''Rich editing''' & refactoring facilities:<br />
** Halfway™ decent auto code completion including pre-compile time<br />
*** template deduction & evaluation,<br />
*** mixins & mixin expression,<br />
*** expression value as well as<br />
*** compiler traits,<br />
*** op overload evaluation & deduction <small>that is used to provide extremely more accurate information about which symbols could be accessed or typed in a particular code context</small><br />
** Obligatory things like definition lookup,<br />
** Code symbol reference highlighting,<br />
** Semantic type identifer highlighting,<br />
** Optional diff-based syntax highlighting (Can be toggled via pressing Ctrl+Alt+K or in the global D options),<br />
** Diet template file highlighting.<br />
** Mixin expression pre-compilation to see what a mixin will look like when being compiled<br />
** Automatically generating method stubs for overridable methods<br/>[[File:Mono-d_method_override.png|300px]]<br />
** Code declaration foldings<br />
** User-generated foldings via <br />
<syntaxhighlight lang="D"><br />
//region My Region<br />
int myCodes;<br />
//endregion</syntaxhighlight><br />
** Obligatory <tt title="Abstract Syntax Tree">AST</tt> outlining <small>for easy access of stuff declared in a D source file</small><br />
** Intelligent code indentation<br />
** Basic code formatting support <small>which reorganizes all kinds of code elements, not only line beginnings</small><br />
** Invoking a project's unit tests via pressing Ctrl+T<br />
** ...<br />
<br />
== How to install Mono-D ==<br />
<br />
=== Install MonoDevelop(MD)/Xamarin Studio(XS) ===<br />
<br />
<b>Note:</b> Xamarin Studio is basically a slightly different but still generally freely available version of MonoDevelop.<br />
In the following, MD can be seen equally to XS.<br/><br />
You'll need XS/MD <b>&gt;v5.6</b> to be installed for Mono-D.<br />
<br />
==== On Windows/OSX ====<br />
<br />
# Go to http://monodevelop.com/download, download &amp; install the latest MonoDevelop setup. <small>Note that there's a gtk# package required to be installed as well.</small><br />
# Launch XS. Open the <i>''Help''</i> menu (Windows) or the ''Xamarin Studio'' menu (OSX) and select <i>'Check for updates'</i>.<br />
# Select the <i>Alpha channel</i> to be used for searching updates.<br/><small>Generally it's recommended to stick to the latest 'Alpha' version of XS because only then, you'll get the very latest &amp; most recent changes &amp; bug fixes. In my very long experience of using XS, it's usually not the case that an Alpha version behaves unstable.</small><br />
<br />
==== On Linux ====<br />
<br />
# Check your distro's software manager for any recent MonoDevelop version and try to install that one.<br/><small>MD &gt;=5.6 is mandatory due to massive API changes etc.!</small><br />
# If no proper build hasn't been uploaded, go to http://simendsjo.me/files/abothe and download the .xz matching your OS architecture.<br />
# Follow the instructions given in the [http://simendsjo.me/files/abothe/readme.txt ''readme.txt''] in order to deploy everything properly.<br/><small>The archives are maintained by me, so please check the site regularly (like 1-2 times per month) for updates!</small><br />
# Also it is possible to use [https://build.opensuse.org/project/show/home:tpokorra:mono ''build.opensuse.org'']. Instruction for Ubuntu 14.04:<br />
## Add apt repository: <nowiki>sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/tpokorra:/mono/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/mono.list"</nowiki><br />
## Download key: ''wget http://download.opensuse.org/repositories/home:/tpokorra:/mono/xUbuntu_14.04/Release.key''<br />
## Add key: ''sudo apt-key add - < Release.key''<br />
## Update: ''sudo apt-get update''<br />
## Install: ''sudo apt-get install monodevelop-opt''<br />
## Run ''monodevelop-opt'' instead of ''monodevelop''<br />
<br />
Further requirements:<br />
* libgnomeui<br />
* xterm, gnome-terminal, mate-terminal OR konsole<br />
<br />
=== Install Mono-D ===<br />
<br />
# Make sure you've got [http://dlang.org/download.html dmd], optionally [http://code.dlang.org/download dub] installed<br/><small>Either via downloading the zip distributables or via your linux distro's package manager. The packages are usually called dmd, druntime and dtools.</small><br />
# Launch MD<br />
# Click on the ''Tools'' (Windows)/''Xamarin Studio'' (OSX) =&gt; ''Addin manager'' menu<br />
# In the ''Gallery'' tab, hit the ''Refresh''-button<br />
# If there's an exception that some .mrep files could not be found,<br />
## Open the repository drop-down menu<br />
## click the ''Manage Repositories'' entry<br />
## Add http://addins.monodevelop.com/Stable/Win32/5.0 <small>(or, if it still fails: http://mono-d.alexanderbothe.com/repo)</small><br />
# In the ''Language Bindings'' group, install the ''D Language Binding''<br />
<br />
'''Note:'''<br />
Before installing any new version of Mono-D '''on Windows''', make sure you never opened any D project since the last start of XS or MD.<br/><small>Otherwise, you'll get some installation errors etc which are caused by the fact that dlls cannot be overwritten once being loaded.</small><br />
<br />
=== Setup Mono-D ===<br />
There are further steps required to set up Mono-D properly:<br />
<br />
# Open ''Edit'' =&gt; ''Preferences''<br/>You'll find all D-related options in the ''Environment'' =&gt; ''D'' tree item.<br />
# If the dmd executable cannot be found via $PATH or %PATH, adjust the compiler's bin path in the ''Compiler Toolchains'' settings to the absolute path.<br/><small>This also counts for OSX-Installations where XS is somehow not able to pass /usr/local/bin as default PATH entry..so just set the bin path over there as well!</small><br />
# Do the same for dub or the Win32 [http://mono-d.alexanderbothe.com/ResourceCompiler.zip ResourceCompiler.zip].<br />
# In order to get the code completion running for phobos etc., activate the ''Includes'' tab in your compiler's settings and add the following lines <small>(which you may fit to your machine's setup, of course)</small><br/><code>D:\Programs\D\dmd2\src\druntime\import</code><br/><code>D:\Programs\D\dmd2\src\phobos</code><br/>on Windows or the other respective paths for Linux:<br/><code>/usr/sha/include/dlang</code> or <br/><code>/usr/include/dmd</code><br/>or for OSX:<br/><code>/Library/D/dmd/src</code><br/>You can of course add custom globally used libraries as well.<br/><small>Note that it's not sufficient to just reference the ...\dmd2\src\-path alone -- the \druntime\src\-folder will cause trouble otherwise because it then would parse runtime source codes twice and then will confuse equally named packages and modules!</small><br />
<br />
== Release Notes ==<br />
<br />
See [[Mono-D Release Notes]]<br />
<br />
== Feedback ==<br />
<br />
* IRC: #d.mono-d on [https://webchat.freenode.net/ Freenode].<br />
* Github: [https://github.com/aBothe/D_Parser/issues Code completion issues] or [https://github.com/aBothe/Mono-D/issues General issues]<br />
<br />
== Contribute & Support ==<br />
<br />
If you like Mono-D, you may [http://mono-d.alexanderbothe.com/donate.html support Alex with a little tip] for letting Mono-D become even better :-)<br />
<br />
If you want to get your hands dirty and work on Mono-D on your own, follow these steps:<br />
* Uninstall Mono-D from MonoDevelop/XamarinStudio.<br />
* On Windows, restart XS.<br />
* <code>git clone https://github.com/aBothe/Mono-D.git</code> (or your own fork of the Mono-D repo)<br />
* <code>cd Mono-D</code><br />
* <code>git submodule init</code><br />
* <code>git submodule update</code><br />
* Open up the MonoDevelop.DBinding.sln in MonoDevelop - or Visual Studio on Windows<br />
* Build Mono-D once (so the bin/Debug-Path becomes set up)<br />
* On Non-Windows, <code>sudo ln -s -d "MonoDevelop.DBinding/bin/Debug" "/usr/lib/monodevelop/AddIns/mono-d"</code> (adapt /usr/ to your own installation path where monodevelop has been installed to!)<br />
* On Windows, execute 'make symlink.bat' which is located in the repo's root.<br />
* Open MonoDevelop.D's Project settings<br />
* Head to the Custom Command-Tab<br />
* Adapt the given 'Run'-command path to MonoDevelop.exe to your system's setup. For Visual Studio, there should be a similar setting.<br />
* Now you can build & debug Mono-D directly from within MonoDevelop/Visual Studio.<br />
<br />
== Tutorials, Known Issues & Stuff ==<br />
<br />
=== Build D Projects outside MonoDevelop ===<br />
You still need a working MonoDevelop and Mono-D installation in order to proceed with the following step!<br/><br />
Just execute <pre>mdtool build MyDSln.sln</pre> to get e.g. a D project/solution built with Mono-D's facilities.<br/><br />
<b>Note:</b> You'll first off need to find mdtool in your XamarinStudio/MonoDevelop installation.<br />
On Linux, this command may look like<br />
<pre>/opt/mono/bin/mdtool build MyDSln.sln</pre><br />
On Windows, this may looks like<br />
<pre>"C:\Program Files (x86)\Xamarin Studio\bin\mdtool.exe" build MyDSln.sln</pre><br />
If you only have one .sln existing in a directory, just invoking mdtool inside that directory is also sufficient!<br />
<br />
=== Dub Project fails to build under OSX ===<br />
Generally it is to mention that XS does overwrite the system's $PATH environment variable when invoking dub or other native commands.<br/><br />
<br />
That overwritten $PATH does typically not contain /usr/local/bin - which is the reason why many dub setups will fail to work with Mono-D on OSX by default.<br/><br />
To fix this, just head to the 'D' -> 'Dub Settings' tab in the global options and enter e.g. <br />
<code>/usr/local/bin/dub</code> <br />
as 'dub executable'.<br />
Then, nearly everything should work fine.<br />
<br />
==== Dub can't find dmd ====<br />
If you're getting a build error message like<br/><br />
<pre>dub build "XYZ" "--build=plain"<br />
Error executing command build:<br />
Failed to invoke the compiler dmd to determine the build platform: /bin/bash: dmd: command not found</pre><br />
, you may set up your own dub executable 'proxy' so dub finds dmd again:<br />
For instance into <i>/Users/&lt;user&gt;/monod_dub.sh</i>:<br />
<syntaxhighlight lang="bash"><br />
#!/bin/sh<br />
export PATH="$PATH:/usr/local/bin"<br />
dub $*<br />
</syntaxhighlight><br />
<br />
Now set <i>/Users/&lt;user&gt;/monod_dub.sh</i> to the 'D' -> 'Dub Settings' tab -> 'dub executable' option.<br />
<br />
==== ld can't find custom D libs ====<br />
It may also be the case that ld magically won't find your customly installed D libraries to link them in. In that case, see https://github.com/aBothe/Mono-D/issues/517<br />
<br />
== Additional Screenshots ==<br />
<br />
[[File:Mono-D-on-Windows-Xamarin-5.2.png]]<br />
[[File:Mono-D-on-Fedora-KDE-Monodevelop-5.3.png]]</div>AthanasiusOfAlex