Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368002

Summary: tycho package plugin incorrectly handles with 'bin.excludes'
Product: z_Archived Reporter: Meng Xin Zhu <kane.zhu>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gregory.amerson, jan.sievers, kane.mx
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
example project none

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.