Eclipse Plugin nested ResourceFilter matchers

eclipse
plugins

(Patrick L.) #1

Hello!

This is a multi project build with many sub projects (>100). I’m trying to configure the Eclipse resource filters using the DSL as described here. I want to do this to avoid having duplicate entries in the Eclipse “OpenResource” dialogue and the launch configurations.
For that, I want to create an OR Filter and use the individual filers for the sub projects as arguments. Basically, this works. As an example, I would configure a main project with two subprojects named “subproject1” and “subproject2” as follows:

eclipse {
  project { 
    resourceFilter {
      appliesTo = 'FOLDERS'
      type = 'EXCLUDE_ALL'
      matcher {
        id = 'org.eclipse.ui.ide.orFilterMatcher'
        matcher {
          id = 'org.eclipse.ui.ide.multiFilter'
          arguments = "1.0-projectRelativePath-equals-true-false-subproject1"
        }
        matcher {
          id = 'org.eclipse.ui.ide.multiFilter'
          arguments = "1.0-projectRelativePath-equals-true-false-subproject2"
        }
      }
    }
  }
}

Now, because there are so many subprojects, I want to create the individual matchers as a loop providing the already known names of the subprojects as follows:

eclipse {
  project { 
    resourceFilter {
      appliesTo = 'FOLDERS'
      type = 'EXCLUDE_ALL'
      matcher {
        id = 'org.eclipse.ui.ide.orFilterMatcher'
        subprojects.each { proj ->
          matcher {
            id = 'org.eclipse.ui.ide.multiFilter'
            arguments = "1.0-projectRelativePath-equals-true-false-${proj.name}"
          }
        }
      }
    }
  }
}

But now, in the .project file I get:

	<filteredResources>
		<filter>
			<id>1</id>
			<type>26</type>
			<name/>
			<matcher>
				<id>org.eclipse.ui.ide.multiFilter</id>
				<arguments>1.0-projectRelativePath-equals-true-false-subproject2</arguments>
			</matcher>
		</filter>
	</filteredResources>

This is obviously not what I want to achieve. What am i doing wrong here?

Please help,
Patrick.