Enable the license checker over distribution/* and plugins/*

Moved the license checker config into the parent pom, and overrede
the license dir/target-to-check in distributions/pom.

Disabled the license checker explicitly for projects which run integration
tests but have no licenses dir:

* core
* distribution
* qa
* plugins/delete-by-query
* plugins/mapper-size
* plugins/site-example

Closes #12752
Closes #12754
This commit is contained in:
Clinton Gormley 2015-08-09 18:18:59 +02:00
parent 368c41666c
commit 205262c737
8 changed files with 87 additions and 26 deletions

View File

@ -320,6 +320,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Don't run the license checker in core -->
<id>check-license</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>

View File

@ -32,6 +32,9 @@ my $Source = shift(@ARGV) || die usage();
$License_Dir = File::Spec->rel2abs($License_Dir) . '/';
$Source = File::Spec->rel2abs($Source);
print "LICENSE DIR: $License_Dir\n";
print "SOURCE: $Source\n";
die "License dir is not a directory: $License_Dir\n" . usage()
unless -d $License_Dir;

View File

@ -29,6 +29,10 @@
<packaging.elasticsearch.systemd.sysctl.dir>/usr/lib/sysctl.d</packaging.elasticsearch.systemd.sysctl.dir>
<packaging.elasticsearch.tmpfilesd.dir>/usr/lib/tmpfiles.d</packaging.elasticsearch.tmpfilesd.dir>
<!-- Properties for the license checker -->
<project.licenses.dir>${project.basedir}/../licenses</project.licenses.dir>
<project.licenses.check_target>${integ.scratch}</project.licenses.check_target>
<!-- rpmbuild location : default to /usr/bin/rpmbuild -->
<packaging.rpm.rpmbuild>/usr/bin/rpmbuild</packaging.rpm.rpmbuild>
@ -97,32 +101,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- checks integration test scratch area (where we extract the distribution) -->
<executions>
<execution>
<id>check-license</id>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skip.integ.tests}</skip>
<target>
<condition property="licenses.exists">
<available file="${basedir}/../licenses" type="dir"/>
</condition>
<echo taskName="license check">Running license check</echo>
<!-- don't run on windows, because everyone hates it -->
<exec failonerror="${licenses.exists}" executable="perl" osfamily="unix"
dir="${elasticsearch.tools.directory}/license-check">
<arg value="check_license_and_sha.pl"/>
<arg value="--check"/>
<arg value="${basedir}/../licenses"/>
<arg value="${integ.scratch}"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -38,6 +38,17 @@ governing permissions and limitations under the License. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Don't run the license checker in delete-by-query -->
<id>check-license</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -37,6 +37,17 @@ governing permissions and limitations under the License. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Don't run the license checker in mapper-size -->
<id>check-license</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -42,6 +42,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Don't run the license checker in site example -->
<id>check-license</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

25
pom.xml
View File

@ -57,6 +57,10 @@
<elasticsearch.integ.antfile.default>${elasticsearch.tools.directory}/ant/integration-tests.xml</elasticsearch.integ.antfile.default>
<elasticsearch.integ.antfile>${elasticsearch.integ.antfile.default}</elasticsearch.integ.antfile>
<!-- Properties for the license checker -->
<project.licenses.dir>${project.basedir}/licenses</project.licenses.dir>
<project.licenses.check_target>${basedir}/target/releases/${project.build.finalName}.zip</project.licenses.check_target>
<!-- Test properties -->
<tests.jvms>auto</tests.jvms>
<tests.shuffle>true</tests.shuffle>
@ -1191,6 +1195,27 @@ org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UT
<goal>run</goal>
</goals>
</execution>
<execution>
<id>check-license</id>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skip.integ.tests}</skip>
<target>
<echo taskName="license check">Running license check</echo>
<!-- don't run on windows, because everyone hates it -->
<exec failonerror="true" executable="perl" osfamily="unix"
dir="${elasticsearch.tools.directory}/license-check">
<arg value="check_license_and_sha.pl"/>
<arg value="--check"/>
<arg value="${project.licenses.dir}"/>
<arg value="${project.licenses.check_target}"/>
</exec>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>

View File

@ -129,6 +129,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Don't run the license checker in qa -->
<id>check-license</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>