select-switch in repo config [message #602648] |
Fri, 12 March 2010 01:25 |
Henrik Lindberg Messages: 2509 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
|
|
|
Powered by
FUDForum. Page generated in 0.02322 seconds