Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Eclipse resource filters #331

Open
frozenspider opened this issue Feb 17, 2017 · 2 comments
Open

Support for Eclipse resource filters #331

frozenspider opened this issue Feb 17, 2017 · 2 comments

Comments

@frozenspider
Copy link

frozenspider commented Feb 17, 2017

It would be very nice to have at least some support for Eclipse resource filters feature.
My use case - exclude target, project/project and project/target from Eclipse project view, right now resource filters are wiped out when project definition is re-generated.
That being said, surely this isn't the only use case for resource filters.

@mkurz
Copy link
Member

mkurz commented Feb 17, 2017

@frozenspider You can do this already.
Here is an example of how I exclude/include some files/folders in Eclipse.

These resource filters will...
...exclude following files and folders:

.git
.project
.classpath
.settings
node_modules
project/project
project/target

...include only following files and folders inside the target folder:

target/scala-[0-9].[0-9][0-9]/classes_managed
target/scala-[0-9].[0-9][0-9]/classes_managed/.*
target/scala-[0-9].[0-9][0-9]/test-classes_managed
target/scala-[0-9].[0-9][0-9]/test-classes_managed/

Just put it in build.sbt (actually I created a eclipse.sbt to remove noise from build.sbt):

// Add eclipse resource filters to the .project file
EclipseKeys.projectTransformerFactories ++= Seq(transformNode("projectDescription", DefaultTransforms.Append(<filteredResources>
	<filter>
		<id>1440448189826</id>
		<name></name>
		<type>10</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-name-matches-false-false-.git</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189827</id>
		<name />
		<type>6</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-.project</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189828</id>
		<name />
		<type>6</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-.classpath</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189829</id>
		<name />
		<type>10</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-.settings</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189830</id>
		<name></name>
		<type>10</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-node_modules</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189831</id>
		<name></name>
		<type>26</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-project/project</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189832</id>
		<name></name>
		<type>26</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-false-project/target</arguments>
		</matcher>
	</filter>
	<filter>
		<id>1440448189833</id>
		<name>target</name>
		<type>29</type>
		<matcher>
			<id>org.eclipse.ui.ide.multiFilter</id>
			<arguments>1.0-projectRelativePath-matches-false-true-target/scala-[0-9].[0-9][0-9]|target/scala-[0-9].[0-9][0-9]/classes_managed|target/scala-[0-9].[0-9][0-9]/classes_managed/.*|target/scala-[0-9].[0-9][0-9]/test-classes_managed|target/scala-[0-9].[0-9][0-9]/test-classes_managed/.*</arguments>
		</matcher>
	</filter>
</filteredResources>)))

@frozenspider
Copy link
Author

I'll use this workaround for now, thanks!
Still, I think the proper implementation of resource filters will be an asset and this issue stands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants