Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » B3 » select-switch in repo config
select-switch in repo config [message #520342] Thu, 11 March 2010 15:40
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2492
Registered: July 2009
Senior Member
Hi,
Thomas and I had a discussion today about the repository configuration,
and the lack to limit the resolution of a particular request to take
place only from particular repositories.

This resulted in the following new syntax.

"select-switch" Expression
("case" Expression : RepositoryConfiguration ) +
"endswitch"

When a resolution is performed, the constant value "request" is bound to
an instance of RequiredCapability. Thus enabling a repository
configuration like this:

repositories {
select-switch request.name

case ~/^org\.myorg\..*/
: "svn:svn+ssh://somplace.org/trunk";

case "org.yourorg.yourthing"
: "svn:https://yourplace.org/svn/repo1/trunk";

case _
: "p2:http://someplace.org/p2repo";

endswitch
}

This is different than the earlier select-first, which will try all
listed repositories in order until one returns a build unit.

The select-switch will evaluated cases in order until a match is found,
and that repo (and that repo alone) is given a chance to resolve the
request.

Note, that this is a special case of switch-case, as the case
expressions are not any general expression - only repository
declarations are permitted.

An alterantive was considered where this filtering was instead done as
part of the initialization of a repository handler. This would have ment
declaring a lambda to do the filtering. As this is probably a common
construct, we felt that it was better represented as a switch case.

The new proposed syntax has been implemented. Test has not yet been
written though. New version shortly available in SVN.

Regards
- henrik
Previous Topic:b3 website and documentation available
Next Topic:select-switch in repo config
Goto Forum:
  


Current Time: Fri Apr 18 16:58:15 EDT 2014

Powered by FUDForum. Page generated in 0.05097 seconds