use of org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testRemoveAllOfUnitId.
@Test
public void testRemoveAllOfUnitId() throws Exception {
CapabilityPattern unitIdPattern = patternWithVersion(CapabilityType.P2_INSTALLABLE_UNIT, "main.product.id", null);
subject = newEvaluator(removeAllFilter(unitIdPattern));
subject.filterUnits(workUnits);
assertThat(removedUnits(), hasItem("main.product.id_0.0.1.201112271438"));
assertThat(removedUnits(), hasSize(1));
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern in project tycho by eclipse.
the class TargetPlatformFilterConfigurationReader method parseFilter.
private void parseFilter(Xpp3Dom filterDom, List<TargetPlatformFilter> result) {
CapabilityPattern scopePattern = parseScopePattern(filterDom);
Xpp3Dom restrictToDom = getComplexValue(filterDom, "restrictTo");
Xpp3Dom removeAllDom = getMarker(filterDom, "removeAll");
if (removeAllDom == null && restrictToDom == null) {
throw new TargetPlatformFilterSyntaxException("Filter action is required: specify either 'filters.filter.removeAll' or 'filters.filter.restrictTo'");
} else if (removeAllDom != null && restrictToDom != null) {
throw new TargetPlatformFilterSyntaxException("Only one filter action may be specified: either 'filters.filter.removeAll' or 'filters.filter.restrictTo'");
}
final TargetPlatformFilter filter;
if (removeAllDom != null) {
filter = TargetPlatformFilter.removeAllFilter(scopePattern);
} else {
CapabilityPattern restrictionPattern = parseRestrictionPattern(restrictToDom);
filter = TargetPlatformFilter.restrictionFilter(scopePattern, restrictionPattern);
}
result.add(filter);
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testUnitAndBundleIdDistinction.
@Test
public void testUnitAndBundleIdDistinction() throws Exception {
// does not match because main.product.id is not a bundle
CapabilityPattern bundleIdPattern = patternWithVersion(CapabilityType.OSGI_BUNDLE, "main.product.id", null);
subject = newEvaluator(removeAllFilter(bundleIdPattern));
subject.filterUnits(workUnits);
assertThat(removedUnits(), hasSize(0));
}
Aggregations