Time for tidying up

As Bruno posted the contribution guidelines it is time to clean up the mess I made and separate the different features from the master branch and from each other. I’m afraid it won’t be easy given that my public master branch was already littered with these feature fragments.

First I have identify the unrelated commits in the history in order to determine the new feature branches. I was working on several problems and most of them isn’t ready to be merged to the main development line.

  • ANTLR parser. This feature involves the AST classes, removing the old ANTLR thing, and adding the new ANTLR grammar. A potential issue could be those constructor codes that was added in the type-inference branch which I integrated in to the master for accessing those modifications.
  • The D Element label provider. This feature aimed to bring a more JDT-like icon set in the necessary places, such as the Outline view, the Script View and the completion proposal list. I found that basically this is not much more than one commit. There was also a hack to get the module name in a module definition label, but I’m quite uncertain of that change. However, this is a complication as I submitted that change in a random time, so I can’t use a range of commits to separate it out. Perhaps if it is easy to do, I should just simply get rid of it. This feature would add new icon files and change the DeeModelElementLabelProvider class.
  • Static library support. Now this is a worthy feature that is the closest to being completed. However, the issue mentioned above would make it complicated to separate to its own branch. After the separation I should request Bruno to have a look on this feature. The affected code is the builder, the project preferences and spreads to places like DLTKModuleResolver in the core.parser package. The change sets are ranging from here to there.
  • Bracket inserting. Should be quite straightforward as it is only one commit.
  • Type inference. The code that was submitted on this feature does nothing really interesting at the moment. It contains some key refactorings however that probably should be used later for many reasons. One of them is to have a visitor structure that is sufficient to work with all AST class and the other is replace the getMemberScope() (and later probably other AST member-) methods with visitor based processing code. The actual type inference code is only exploratory, trying to integrate the dltk’s type inference basics as an entry point code.
  • Renewing the completion proposal collecting code. The visitor refactoring above could be potentially useful for collecting completion proposal and would be better than the existing code as it is quite obscure. This completion proposal system should be aware of the priority listing, keywords, templates, and all resolvable nodes, not just references. The latter means that completing members for expressions (such as, casting an object or so). Should contain the changes in the function definitions but it is not working at the moment (the feature that the argument list is pre-filled with the parameter names and working like the template suggestions).

At the end of the day, I had to explore the weird world of rebasing as I did not really bother to learn it before. It’s because every time I’ve encounter with it, there was always a note that it could mess up things pretty badly,  and some even says that it is like lying.

Rebasing in git is like to take a range of commits and “replay” them on the top of a branch or a specific revision. This is the perfect tool for the job I am about to perform. The work flow is like this: take the deviation point in my master branch, pick those commits that are relevant to the functionality, and apply them on the deviation point it self. Sounds almost too simple.

However, there are problems that I need to be aware. One is the problem with rewriting the history: I can’t re-base a tacking branch and expect that I can push it easily to its remote. Once I push a branch somewhere re-basing it is not an option anymore. So if that happens, and I screw up (like this happened with the first attempt to do this with the feature-static-library branch where I included commits that renders the branch virtually impossible to merge to bruno’s master), there’s no way back. The only thing I can do, if nobody hangs on my repository, that I wipe out the whole stuff and push the necessary branches from scratch. At the end of this exercise, this is likely to happen though. The only person I share my repository is bruno, and he doesn’t depend on any of my current branches.

That pesky file name capitalization is really annoying. If I want to switch to a branch that has the previous file name, I have to delete the file to get rid of the problem. Not only that, I ran in to this while I performed the rebase call, which is even more annoying as I have to fix to the right name with an additional commit.

Finally I mastered the rebasing so now there’s a new repository I’m working with. There are three feature branches so far: feature-static-libraries, feature-labelprovider-improvement, feature-antlr-parser. These branches were grown from the latest master from Bruno, so there should be no problem to merge them in to the main line.

Static library support

After some messing around the EGit finally I came to understand how to push my changes to the google code clone. It came as a surprise because I was sure that I understand the git architecture. The problem was that I had proper ref specs to the google code clone’s repository.

Today’s exercise was to add some support of static libraries. I found that the DeeBuildOptions class had some traces for supporting different build types but it was set to EXECUTABLE without the option to change it. In the case of static library, the DMD compiler offer an option “-lib” to build static libraries. In addition I found that the there were already a combo box to set the build type in the DeeProjectOptionsBlock which is responsible for handle the compiler options in the UI.

So this part of the job was pretty easy: Uncomment the relevant part in the DeeProjectOptionsBlock.createControl method that shows the combo box for the build type setting. To handle the default cases better than we do currently, I hid all the properties of the DeeBuildOptions class and added some handling of the default values. If there’s no set output directory yet, it will depend on the build type, for instance: if the build type is executable or dynamic library, the output directory is ‘bin’, if the build type is static library, the output directory will be the ‘lib’ directory. However, I noticed a tiny little problem here. The D programming language is a native language which means that the compiled modules are subject of linking. That is, the real output of the build process is the executable/library/dynamic library and the object files themselves are kind of a by-product of this process. Most of the build system I saw there were a separation between the intermediate files (object files) and the final output. As a next step I would like to add an intermediate directory for the object files to handle (of course, if the user wishes so, he can keep the output files mixed with the object files).

On the UI with small little hack I only update those DeeBuildOption fields that were actually edited so that my changes on the default values could come to effect. But I need to updated the artifact name’s field which I just realized I didn’t. Next commit. If you switch to LIB_STATIC build type, the output folder and the output extension will change to lib.

Also, before I committed these changes I merged Bruno’s recent changes (mostly GDC related stuff).

The corresponding change set in the source code: r080d4e50bc25

Quick Reminder How to Develop DDT

As I ran in to problems as I tried to set up my Eclipse environment in order to develop the DDT plugin, I decided to make a quick reminder how the installation should look like. My development environment is Eclipse Indigo (3.7.x) on Windows.

  1. Make sure that the Eclipse is up-to-date completely. (Help/Check for software updates)
  2. First I need to install the PDE, the plug-in development plug-in for Eclipse. This is easy, however there are always problems with the naming. So, open up Help/Install New Software dialog from the menu, and select the repository Indigo – http://download.eclipse.org/releases/indigo. Untick the Group items by category and search for the phrase: “Eclipse Plug-in Development Environment”. Install it.
  3. DLTK 3.0: This is the default version line for Eclipse Indigo, so we should find it also in the eclipse repository. Help/Install New Software dialog, http://download.eclipse.org/releases/indigo. Untick the Group items by category and search for the phrase: ” Dynamic Languages Toolkit – Core Frameworks”. Install it.
  4. Since the original Descent project exists on an SVN repository, I need to install the Subversive SVN Client for Eclipse. In the same dialog as before, I check for the phrase:   “Subversive SVN Team Provider (Incubation)” and go.

As I expected EGit became part of the Eclipse Indigo project thus no additional installation will be required. Yet.

I need to be careful of the import order of the related projects. What I need accordingly to Bruno’s tutorial is to import the descent.compiler project from SVN. In the Package Explorer’s context menu click on the Import and select the SVN/Project from SVN repository. Stick the http://svn.dsource.org/projects/descent URL to the repository address and select on the resource page the trunk/descent.compiler project. Ta-dam! Oh, wait… the first time when you want to import from SVN, the subversive team provider plug-in will find that you don’t have a connector so, there’s a need to install one. After several try, I found that the SVNKit 1.35 works just fine to use.

Now comes the real deal, the source code of the DDT. Luckily, it’s really simple: Again, in the Package Explorer’s context menu click on the Import, select Git and in the upcoming dialog, click on the Clone… button.  There it is: paste the URL: https://code.google.com/a/eclipselabs.org/p/ddt/ and select the all the branches (well, the branches themselves is a bit funny, because it still seems that I need to add a new remote in order to get the other branches, but heck, it didn’t kill anything). Note, that the clone isn’t my google clone address, I’ll add that later as an upstream clone while Bruno’s one gonna be the downstream update site.

At the remote naming, I chose to use the bruno-* (* = branch name) format, so it’s gonna be easier to sort them. After all these, the package explorer gets littered with projects.