Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368002 - tycho package plugin incorrectly handles with 'bin.excludes'
Summary: tycho package plugin incorrectly handles with 'bin.excludes'
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jan Sievers CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-06 02:46 EST by Meng Xin Zhu CLA
Modified: 2021-04-28 16:55 EDT (History)
3 users (show)

See Also:


Attachments
example project (1.75 KB, application/octet-stream)
2012-01-06 02:48 EST, Meng Xin Zhu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Meng Xin Zhu CLA 2012-01-06 02:46:07 EST
I want to exclude some files from the bin folder after packaging it as single jar, I add 'bin.excludes' property in build.properties following link[1]. And it works well if exporting my plug-in to jar via Eclipse IDE.

But the final jar built by Tycho doesn't exclude those files. I roughly read the source of tycho package plug-in, it has code to handle the properties 'bin.includes' and 'bin.excludes' in the build.properties. But it doesn't work well.

[1] http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Freference%2Fpde_feature_generating_build.htm
Comment 1 Meng Xin Zhu CLA 2012-01-06 02:48:07 EST
Created attachment 209121 [details]
example project

There are two files named a.c and Makefile under src/, I want to exclude them from the final built jar.
Comment 2 Jan Sievers CLA 2012-01-12 03:30:44 EST
(In reply to comment #1)
> Created attachment 209121 [details]
> example project
> 
> There are two files named a.c and Makefile under src/, I want to exclude them
> from the final built jar.

I was under the impression that bin.includes are relative to the project root (same as for bin.includes), see integration test [1]
However you are right there should be a way to exclude resources which are copied from the source to the output folder.
Not sure if in addition to project root, we should also apply bin.excludes filters to the output folder. Do you have references how this is done exactly in PDE headless build? I can't find the details in the docs you linked.

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-its/projects/MNGECLIPSE1007
Comment 3 Meng Xin Zhu CLA 2012-01-12 05:17:26 EST
(In reply to comment #2)
> Not sure if in addition to project root, we should also apply bin.excludes
> filters to the output folder. Do you have references how this is done exactly in
> PDE headless build? I can't find the details in the docs you linked.
PDE build creates the ant script based on the build.properties on the air. It uses the copy task to include and exclude the files listed in build.properties.

See http://git.eclipse.org/c/pde/eclipse.pde.build.git/tree/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/FileSet.java
Comment 4 Jan Sievers CLA 2012-01-12 09:45:34 EST
(In reply to comment #3)
> (In reply to comment #2)
> > Not sure if in addition to project root, we should also apply bin.excludes
> > filters to the output folder. Do you have references how this is done exactly in
> > PDE headless build? I can't find the details in the docs you linked.
> PDE build creates the ant script based on the build.properties on the air. It
> uses the copy task to include and exclude the files listed in build.properties.
> 
> See
> http://git.eclipse.org/c/pde/eclipse.pde.build.git/tree/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/FileSet.java

Could not figure out the details because generated ant scripts are not retained but the sample shows that bin.excludes are applied to resources copied from source to output folder too.
In the meantime, I found a workaround.

You can configure

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <excludeResources>
            <exludeResource>a.c</exludeResource>
            <exludeResource>Makefile</exludeResource>
          </excludeResources>
        </configuration>
      </plugin>

This should achieve what you want.
Comment 6 Meng Xin Zhu CLA 2012-01-13 01:05:36 EST
Thanks for below workaround and quick fix. :)
(In reply to comment #4)
> In the meantime, I found a workaround.
> 
> You can configure
> 
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-compiler-plugin</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <excludeResources>
> <exludeResource>a.c</exludeResource>
> <exludeResource>Makefile</exludeResource>
> </excludeResources>
> </configuration>
> </plugin>
> 
> This should achieve what you want.