Hacking Vala using MonoDevelop

MonoDevelop is a powerful, featureful development environment, and one of the few that supports Vala.
This tutorial demonstrates how MonoDevelop can be used to hack on Vala itself.

Activating Vala Code Completion

Note: this section will shrink and disappear as bleeding-edge code eventually gets released for VTG and MonoDevelop.

  • Patching and Installing Vala Toys for gedit (VTG)

  • Installing MonoDevelop from the subversion repository

    • Installing dependencies
      • Debian and Ubuntu users can cheat: apt-get build-dep monodevelop

      • It looks like Fedora users can as well: yum-builddep monodevelop

      • Others will want to install the following packages, in order:
    • Check out MonoDevelop: svn co svn://anonsvn.mono-project.com/source/trunk/monodevelop

    • Configure MonoDevelop, making sure that ValaBinding is enabled: cd monodevelop; ./configure --select

      1. [X] main
      2. [ ] extras/JavaBinding
      3. [ ] extras/BooBinding
      4. [X] extras/ValaBinding
    • Now you should be ready to build and run MonoDevelop! make && make run

Checking out Vala master

  • Check out Vala from the GNOME Git repository.

  • Make sure your vala checkout directory is named vala

  • Run ./autogen.sh --enable-vapigen to bootstrap the project configuration.

Setting up the Vala project in MonoDevelop

  • Create an empty solution in the base directory of your Vala checkout.
    • Open the File menu and choose New > Solution...

    • Choose Vala from the project type list on the left

    • Choose Empty Vala Project from the list on the right.

    • Enter vala into the Name box.

    • For the Location box, browse to the directory above your vala checkout directory. ( If you checked out into /home/user/vala, then your location should be /home/user )

    • md-tutorial-create-solution.png

    • Click OK.

    • MonoDevelop will create a solution with an empty project named vala.

    • md-tutorial-solution-created.png

  • Configuring the Vala subprojects
    • Add each subproject: gee, ccode, codegen, compiler, vapigen. (We will reuse the existing vala subproject.)

      • In the solution tree, right-click Solution vala and choose Add > Add New Project...

      • Select Empty Vala Project for the project type, and enter the project name (gee, ccode, ...) in the Name box.

      • md-tutorial-create-subproject.png

      • Click Forward.

      • Click OK.

    • Configure each subproject: gee, ccode, vala, codegen, compiler, vapigen

      • Click the subproject in the solution tree to highlight it.
      • Click the Project menu, then choose (subproject name) Options

      • Expand the Build node and click Code Generation.

      • For gee, ccode, vala, and codegen, choose Shared Object from the Target combobox.

      • For compiler and vapigen, choose Executable from the Target combobox.

      • md-tutorial-subproject-target.png

      • Expand the General node and click Makefile Integration.

      • On the Makefile tab, check Enable makefile integration in this project.

      • On the Files tab, check Enable project file synchronization.

      • Check Source code files and choose the entry ending in VALASOURCES from the combobox.

      • md-tutorial-makefile-sources.png

      • On the Messages Regex tab, choose Vala from the Compiler combobox.

      • Click OK.

      • A dialog will pop up asking if you want the project or the makefile to be the "master" copy. Choose Makefile.

      • Another dialog may pop up asking if you want to overwrite project files. You do.
    • Set dependencies for each subproject: ccode, vala, codegen, compiler, vapigen

      • In the solution tree, expand the node for the subproject.
      • Right-click the Packages node and choose Edit Packages...

      • On the Project Packages tab, choose the appropriate dependencies for each subproject:

        • ccode: gee
        • vala: gee, ccode
        • codegen: gee, ccode, vala
        • compiler: gee, ccode, vala, codegen
        • vapigen: gee, ccode, vala
        • md-tutorial-select-packages.png

  • Now you should be ready to build! Press F8, or choose Build All from the Build menu. You can see the live compiler output by choosing Build Output from the View menu.

  • md-tutorial-build-output.png

''Sample bugfix''

  • Choose bug from Vala bugzilla

  • Fix bug

  • Generate patch? (requires md-bzr + bzr-git explanation)

Projects/Vala/HackingValaUsingMonoDevelop (last edited 2013-11-22 16:48:27 by WilliamJonMcCann)