<!-- there's a bug with maven-shade-plugin that messed up ${basedir} variable
     the workaround is to use ${project.build.directory} instead and use relative paths from there -->

<assembly>
    <id>distribution</id>
    <formats>
        <format>tar.gz</format>
    </formats>
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}</directory>
            <includes>
                <include>${project.artifactId}-${project.version}.jar</include>
            </includes>            
            <outputDirectory>/lib</outputDirectory>
        </fileSet>
        <fileSet>
          <directory>${project.build.directory}/../src/main/java</directory>
          <useDefaultExcludes>true</useDefaultExcludes>
          <outputDirectory>/src</outputDirectory>
        </fileSet>
        <fileSet>
          <directory>${project.build.directory}/apidocs</directory>
          <useDefaultExcludes>true</useDefaultExcludes>
          <outputDirectory>/javadoc</outputDirectory>
        </fileSet>        
        <fileSet>
            <directory>${project.build.directory}/../src/assemble</directory>
            <includes>
                <include>*.txt</include>
                <include>*.TXT</include>
                <include>*.html</include>
            </includes>
            <excludes>
                <exclude>*LICENSE*</exclude>
            </excludes>
            <filtered>true</filtered>
            <outputDirectory>/</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>${project.build.directory}/../src/assemble</directory>
            <includes>
                <include>*LICENSE*</include>
            </includes>
            <outputDirectory>/licenses</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>${project.build.directory}/../src/main/config</directory>
            <includes>
                <include>ehcache.xml</include>
                <include>ehcache.xsd</include>
            </includes>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
    <files>
      <file>
        <source>${project.build.directory}/changes.txt</source>
        <outputDirectory>/</outputDirectory>
        <destName>CHANGELOG.txt</destName>
      </file>
    </files>
    <dependencySets>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
            <unpack>false</unpack>
            <scope>runtime</scope>
            <excludes>
                <exclude>net.sf.ehcache:*</exclude>
            </excludes>
        </dependencySet>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
            <unpack>false</unpack>
            <scope>provided</scope>
            <includes>
              <include>org.slf4j:slf4j-jdk14</include>
            </includes>
        </dependencySet>       
        <dependencySet>
            <outputDirectory>lib/agent</outputDirectory>
            <unpack>false</unpack>
            <scope>compile</scope>
            <includes>
              <include>net.sf.ehcache:sizeof-agent</include>
            </includes>
        </dependencySet>        
    </dependencySets>
</assembly>
