Search in sources :

Example 1 with TargetPlatformFilterSyntaxException

use of org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException 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);
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformFilterSyntaxException(org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException) CapabilityPattern(org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern) TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter)

Example 2 with TargetPlatformFilterSyntaxException

use of org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException in project tycho by eclipse.

the class TargetPlatformFilterConfigurationReaderTest method testMissingIdException.

public void testMissingIdException() throws Exception {
    try {
        Xpp3Dom filterConfig = getTargetFilters("targetfilter/missing_scope_id/pom.xml");
        subject.parseFilterConfiguration(filterConfig);
        fail();
    } catch (TargetPlatformFilterSyntaxException e) {
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformFilterSyntaxException(org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)

Example 3 with TargetPlatformFilterSyntaxException

use of org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException in project tycho by eclipse.

the class TargetPlatformFilterConfigurationReaderTest method testMissingTypeException.

public void testMissingTypeException() throws Exception {
    try {
        Xpp3Dom filterConfig = getTargetFilters("targetfilter/missing_scope_type/pom.xml");
        subject.parseFilterConfiguration(filterConfig);
        fail();
    } catch (TargetPlatformFilterSyntaxException e) {
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformFilterSyntaxException(org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)

Example 4 with TargetPlatformFilterSyntaxException

use of org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException in project tycho by eclipse.

the class TargetPlatformFilterConfigurationReaderTest method testMissingActionException.

public void testMissingActionException() throws Exception {
    try {
        Xpp3Dom filterConfig = getTargetFilters("targetfilter/missing_action/pom.xml");
        subject.parseFilterConfiguration(filterConfig);
        fail();
    } catch (TargetPlatformFilterSyntaxException e) {
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformFilterSyntaxException(org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)

Example 5 with TargetPlatformFilterSyntaxException

use of org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException in project tycho by eclipse.

the class TargetPlatformFilterConfigurationReaderTest method testDuplicateVersionException.

public void testDuplicateVersionException() throws Exception {
    try {
        Xpp3Dom filterConfig = getTargetFilters("targetfilter/duplicate_scope_version/pom.xml");
        subject.parseFilterConfiguration(filterConfig);
        fail();
    } catch (TargetPlatformFilterSyntaxException e) {
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformFilterSyntaxException(org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)

Aggregations

Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)6 TargetPlatformFilterSyntaxException (org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)6 TargetPlatformFilter (org.eclipse.tycho.artifacts.TargetPlatformFilter)1 CapabilityPattern (org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern)1