Eiffel configuration redirection (.ecf)

by Jocelyn Fiat (modified: 2015 Jun 15)

Introduction

Have you ever wished that an Eiffel library could be accessed from more that one place?

Have you ever wished to install your library collection in development under $EIFFEL_LIBRARY (or $ISE_LIBRARY) but still be manage the source with your subversion, or git?

I don't know for you, but I did frequently. And over the years I have been using various solutions using environment, variable, symbolic link, file synchronization, cloud, ... But none of them are easy or friendly.

A solution based on redirection

Lately I have been working on the Eiffel Web Framework project, and I told myself, why not using a solution similar to http redirection that simply use "Location: .." header.

And that's what I implemented for ISE Eiffel compiler based on .ecf and now I'd like to hear from Eiffel users, read your comments and maybe other suggestions.

My suggestion is to add the notion of location to ecf

Example

The following example illustrates the redirection of "wsf" libary to my dev working copy

I created a file under $ISE_LIBRARY/contrib/library/web/framework/ewf/wsf/wsf-safe.ecf with the following content

<?xml version="1.0" encoding="ISO-8859-1"?> <redirection xmlns="http://www.eiffel.com/developers/xml/configuration-1-11-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-11-0 http://www.eiffel.com/developers/xml/configuration-1-11-0.xsd" uuid="A37CE5AA-4D2A-4441-BC6A-0A1D7EC49647" location="c:\Eiffel_projects\library\dev\EWF\library\server\wsf\wsf-safe.ecf"> </location>

It just tells the compiler to look at c:\Eiffel_projects\library\dev\EWF\library\server\wsf\wsf-safe.ecf to get the "wsf" library. The optional "uuid" attribute could be used to ensure the redirection points to the same library.

Comments ?

I made my own built of Eiffel Studio with this behavior, and I really love it.

The beauty of this solution is that I don't need to use any environment variable, I don't need to update all my .ecf to follow the new location, all I have to do is create the file under $ISE_LIBRARY ... with the content and that's it.

What do you think about this, would you like to see it in EiffelStudio ? Maybe you have suggestion to make it even better?

UPDATED: This functionality will be available from EiffelStudio 13.11 .

The syntax is <redirection uuid="...." location="path-to-new-location.ecf" />
The uuid is optional, but if it is precised in the redirection file, it has to match with the new location .ecf otherwise a UUID mismatch error will be reported.

Comments
  • Grant Rettke (4 years ago 27/3/2013)

    How are the alternatives?

    Hi Jocelyn,

    That sounds nice. I'm really curious to know, what didn't you like about the alternatives, and how does your solution address them?

    • Jocelyn Fiat (4 years ago 27/3/2013)

      no need to change existing .ecf

      I will mainly talk (quickly) about Windows experiments here in relation with Eiffel Web Framework (EWF) project development.

      Taken that - The source of EWF is hosted at github, so this is a git repository. - ISE EiffelStudio releases also include EWF's libraries splitted inside the $ISE_LIBRARY/contrib but does not follow the same layout as EWF's git repository - that ISE_LIBRARY can point to ISE_EIFFEL or EIFFEL_SRC (source code for Eiffel Studio) - I am working on projects using EWF, and I try to use the EWF lib from $ISE_LIBRARY, so that it is easy to compile for other, no need to download the EWF package for each one my EWF's related projects (i.e web server app-or-site) - EWF is actively developed, and I contribute a lot to EWF. - I want to test the latest EWF from $ISE_LIBRARY and also improve EWF while using it on my different projects.

      So my need was to be able to modify the source code located under $ISE_LIBRARY, and for time to time, run some EWF tests like recompiling all the .ecf, and if successful, commit and push the modification to the main git repository, or share the change with other git repo. I usually checkout the EWF repository into c:\_dev\EIFFEL_LIBRARY\EWF.

      Among the various solutions I tried , the most close to a working solution was using ntfs junctions (similar to symbolic link) for folder,

        BUT the eiffel compiler is supporting relative location for .ecf ... and then was not able to find all the .ecf 

      indeed

        for instance I had  $ISE_LIBRARY\contrib\library\web\framework\ewf\wsf  linking to c:\_dev\EIFFEL_LIBRARY\EWF\library\server\wsf
        BUT in wsf/wsf.ecf I had relative locations such as ../../text/encoder/encoder.ecf
        and the compiler were not finding  $ISE_LIBRARY\contrib\library\web\framework\text\encoder\encoder.ecf ...  
        as expected since this folder does not exists.
        So I could add a new link   $ISE_LIBRARY\contrib\library\web\framework\text\encoder to c:\_dev\EIFFEL_LIBRARY\EWF\library\text\encoder
        but for EiffelStudio release, the good location of encoder would be in $ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder
        so I should also have this link.
        Now this becomes messy and time consuming to put all those links.

      Other solution was to modify the .ecf ... but then I was not able to compile EWF from c:\_dev\EIFFEL_LIBRARY\EWF itself, and I had to be careful when committing changes. Well this was not a solution.

      With the ecf redirection .. I just have to create $ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf as a redirection to c:\_dev\EIFFEL_LIBRARY\EWF\library\server\wsf.ecf .. and that's it, the compiler will be redirected to the real location, and relative location will work like a charm. And I need to do the same (i.e put redirection) to any EWF's lib I use directly in my application (but not for lib used by EWF itself).

      Other benefit of ecf redirection .. you can easily commit that with subversion, git, or even in an archive .. And that makes sense especially if you want your lib to be accessible from multiple locations.

      For instance, we will be able to have better layout for ISE's lib (as discussed a few months ago)

      • library\network\curl in addition to library\cURL
      • library\graphic\vision2 in addition to library\vision2
      • and so on

      And with this solution, this works the same on Windows, linux, Mac and so on (which was not the case with ntfs junction ...)

      I don't have to modify any file on c:\_dev\EIFFEL_LIBRARY\EWF

      Those are the main points, there were others but not as relevant.Then so far the ecf redirection really address my needs, and is very simple. I am now using it daily, and this saves me a lot of time while working on EWF.

      Now, if you have other alternatives, please share them with us.

      • Eric Bezault (4 years ago 1/4/2013)

        Can you give a concrete example when you speak about a better layout for ISE's lib with library\network\curl and library\cURL and like wise for vision2? I did not really understand what problem we are trying to solve here and how ECF redirection would make things better.

        • Jocelyn Fiat (4 years ago 2/4/2013)

          About Library Categorization

          I was talking about http://dev.eiffel.com/Library_Categorization To avoid breaking existing configuration, we could use that .ecf redirection to apply the library categorization.

          So here this would mainly allow us to reorganize the location of libraries, but keeping previous location. We might also think about an "obsolete" message.

          And we could also have the lib in different place for instance library/gobo/goto_xml.ecf and library/text/parser/xml/parser/gobo/xml.ecf that is to say having the possibility to put a library in more than one folder.

          • Jocelyn Fiat (4 years ago 2/4/2013)

            And for me the main advantage would be to have portable way to have symbolic link for ecf ... (this is not a NTFS junction, neither a windows shortcut, or a unix symoblic link ..) this would be supported by Eiffel compilers, and thus we can commit that in any subversion, git, zip, ... repository without any fear.

  • Alexander Kogtenkov (4 years ago 27/3/2013)

    Does it work for a web repository?

    How does redirection couple with a future web-based repository of Eiffel libraries?

    • Jocelyn Fiat (4 years ago 27/3/2013)

      I guess it should work fine too. Since the redirection is done at the configuration library level.

  • Olivier Ligot (4 years ago 8/4/2013)

    epm

    Hi,

    Here are our needs regardings Eiffel libraries:

    • it should work with Git as most Eiffel libraries are hosted on Github
      • be able to specify a branch or tag name (point to a specific version)
      • updatable: we should be able to update all our local repositories in one shot (ex: by invoking one single command) when the remote repositories changes (we use more than 10 libraries per project and each library has its own Git(hub) repository so it's not conceivable to update each repository by hand)
    • no more environment variable handling: this is the job of a package manager, not the developer
    • ability to run some external commands after the initial checkout of the repository (external C compilation, gepp preprocessor, ...)

    For the moment, these needs are not satisfied by EiffelStudio (nor by Jocelyn proposition) and that's why we created epm, an Eiffel Package Manager (https://github.com/oligot/epm) that suit our needs.

    • Manu (4 years ago 9/4/2013)

      The redirection is not related to how the source code is maintained which is the responsibility of the owner. What we are providing with redirection is giving flexibility on the location of libraries, not on how they are specified.

      What you have just described is basically what anyone can achieve with git/subversion albeit a very manual process.

      For environment variable, it is up to the owner to decide that how this could be done. I know that installing a third party is problematic when you have to setup environment variables. So clearly we should go towards relative paths within a library. Eiffel Software policy is to use ISE_LIBRARY to refer to libraries only.

      As for commands to be run on initial checkout, that would be nice. EiffelStudio can actually provide that where we have pre/post compile tasks. It is underused and probably needs some improvements to make it more practical. For example, those tasks are launched at each compilation and if you do the task well it might not take that much time although it could be a distraction.

      • Larry Rix (4 years ago 25/8/2013)

        Pre and Post Compile Options

        In our case, the compile process has two alternative pre-compile processes:

        1. A simple F7, where we would want a Subversion update just before our compile. 2. A more advanced version, where we have a local DB needing to be updated by running three SQL scripts.

        The trigger for option two is an announcement in a Skype chat from one of the other developers that a new set of DB scripts are available and updates need to be applied before new code from SVN will run successfully.

        Perhaps the simplest solution is to always include a Subversion update before the compile and allow the developer to keep track of needing to update SQL Server.

        Also, there are times that a developer does NOT want to fetch updated code from the repository. So, perhaps another compile option where pre-compile and post-compile tasks are executed?

    • Jocelyn Fiat (4 years ago 22/5/2013)

      Sorry I haven't noticed the reply.

      So as Manu said, my post was mainly related to add ecf redirection. This does not target the same goal as epm.

      Not that epm is interesting topic, I will post about that need soon.

      For now, focusing on the ecf redirection, do you see any objection or improvement ?

  • Larry Rix (4 years ago 25/8/2013)

    Good Idea!

    I agree this is a good idea. We have any number of libraries we are using. Not all of them standard. Some of them are under active development.

  • Jocelyn Fiat (4 years ago 31/10/2013)

    This will be available with EiffelStudio 13.11

    We decided to include this addition to the upcoming EiffelStudio 13.11

    the syntax is

    <redirection uuid="...." location="path-to-new-location.ecf" />

    The uuid is optional, but if it is precised in the redirection file, it has to match with the new location .ecf otherwise a UUID mismatch error will be reported.

    I hope this will be helpful for the Eiffel users. At least I will use it myself.