Skip to content

Commit

Permalink
[Build] Improve maven module build order (apache#9882)
Browse files Browse the repository at this point in the history
- add dependencies in distribution builds so that the modules get built
  in the correct order
  - allow building the distribution without pulsar-presto-distribution when core-modules is active

- modify src/check-binary-license script to allow skipping Pulsar SQL checks
  - this is preparation for a build without Presto / Pulsar SQL

- consistently exclude transitive dependencies from the provided dependencies that
  have been added to impact build order.
  - this has mainly an impact with maven-assembly-plugin which will include
    the transitive dependencies of a tar.gz dependency unless the dependencies
    are excluded explicitly.

- add "skipDocker" and "skipIntegrationTests" profiles which enable
  processing all other modules except docker or integration test modules
  - this is preparation for CI build to ensure that we don't miss running some
    unit tests in some module.

- fix running the backwards compatibility tests that are part of tests/bc_* modules
  - it's unclear how these are run currently. Perhaps they run in all integration test
    runs. This removes the possible duplication.

- Improve the docker profile so that it's possible to build tests/docker-images/* modules
  without activating integration tests
  • Loading branch information
lhotari authored Mar 12, 2021
1 parent 8370817 commit 1881459
Show file tree
Hide file tree
Showing 19 changed files with 283 additions and 69 deletions.
1 change: 1 addition & 0 deletions build/run_integration_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ test_group_shade() {

test_group_backwards_compat() {
mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-backwards-compatibility.xml -DintegrationTests
mvn_run_integration_test "$@" -DBackwardsCompatTests
}

test_group_cli() {
Expand Down
26 changes: 26 additions & 0 deletions distribution/offloaders/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@
<artifactId>managed-ledger</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tiered-storage-file-system</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tiered-storage-jcloud</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>server</module>
<module>io</module>
<module>offloaders</module>
<module>server</module>
</modules>
</profile>

Expand Down
48 changes: 44 additions & 4 deletions distribution/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-graphite</artifactId>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
</dependency>

<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
Expand Down Expand Up @@ -167,6 +167,12 @@
<version>${project.version}</version>
<!-- make sure the api examples are compiled before assembly -->
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -193,6 +199,12 @@
<version>${project.version}</version>
<!-- make sure the api examples are compiled before assembly -->
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- local-runner -->
Expand Down Expand Up @@ -337,4 +349,32 @@
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>core-modules</id>
<!-- allow building the distribution without pulsar-presto-distribution when core-modules is active -->
</profile>
<profile>
<id>main</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<!-- depend on pulsar-presto-distribution by default, unless core-modules profile is active -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-presto-distribution</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
5 changes: 5 additions & 0 deletions distribution/server/src/assemble/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
<exclude>junit:junit</exclude>

<exclude>org.projectlombok:lombok</exclude>

<!-- prevent adding pulsar-functions-api-examples in lib -->
<exclude>org.apache.pulsar:pulsar-functions-api-examples</exclude>
<!-- prevent adding any distribution .tar.gz files in lib -->
<exclude>*:tar.gz</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand Down
29 changes: 23 additions & 6 deletions docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
</parent>
<artifactId>docker-images</artifactId>
<name>Apache Pulsar :: Docker Images</name>
<modules>
<module>pulsar</module>
<module>grafana</module>
<module>pulsar-all</module>
<module>pulsar-standalone</module>
</modules>
<build>
<plugins>
<plugin>
Expand All @@ -47,4 +41,27 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>skipDocker</id>
<activation>
<property>
<name>skipDocker</name>
</property>
</activation>
<modules/>
</profile>
<profile>
<id>docker</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>pulsar</module>
<module>grafana</module>
<module>pulsar-all</module>
<module>pulsar-standalone</module>
</modules>
</profile>
</profiles>
</project>
12 changes: 12 additions & 0 deletions docker/pulsar-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
<version>${project.parent.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.perfmark</groupId>
Expand All @@ -50,6 +56,12 @@
<classifier>bin</classifier>
<type>tar.gz</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
6 changes: 6 additions & 0 deletions docker/pulsar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
<classifier>bin</classifier>
<type>tar.gz</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,10 @@ flexible messaging model and an intuitive client API.</description>
</profile>
<profile>
<id>docker</id>
<modules>
<module>docker</module>
<module>tests</module>
</modules>
</profile>

<profile>
Expand Down Expand Up @@ -1804,16 +1808,17 @@ flexible messaging model and an intuitive client API.</description>

<module>pulsar-client-messagecrypto-bc</module>

<!-- all these 3 modules should be put at the end in this exact sequence -->
<module>distribution</module>
<module>docker</module>
<module>tests</module>
<module>pulsar-metadata</module>
<module>jclouds-shaded</module>

<!-- package management releated modules (begin) -->
<module>pulsar-package-management</module>
<!-- package management releated modules (end) -->

<!-- all these 3 modules should be put at the end in this exact sequence -->
<module>distribution</module>
<module>docker</module>
<module>tests</module>
</modules>
</profile>

Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-io/docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-io-kafka-connect-adaptor</artifactId>
<artifactId>pulsar-io-kafka-connect-adaptor-nar</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
68 changes: 39 additions & 29 deletions src/check-binary-license
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@
# all error fatal
set -e

# skip checks for Presto licenses if 1. argument is "--no-presto"/"no-pulsar-sql"
# this is to allow building the server distribution without Pulsar SQL
NO_PRESTO=0
if [[ "$1" == "--no-presto" || "$1" == "--no-pulsar-sql" ]]; then
NO_PRESTO=1
shift
fi

TARBALL="$1"
if [ -z $TARBALL ]; then
echo "Usage: $0 <binary-tarball>"
exit -1
exit 1
fi

JARS=$(tar -tf $TARBALL | grep '\.jar' | grep -v 'lib/presto/' | grep -v '/examples/' | grep -v '/instances/' | sed 's!.*/!!' | sort)
Expand Down Expand Up @@ -86,34 +94,36 @@ for J in $NOTICEJARS; do
fi
done

# check pulsar sql jars
JARS=$(tar -tf $TARBALL | grep '\.jar' | grep 'lib/presto/' | grep -v pulsar-client | grep -v bouncy-castle-bc | grep -v pulsar-metadata | grep -v 'managed-ledger' | grep -v 'pulsar-client-admin' | grep -v 'pulsar-client-api' | grep -v 'pulsar-functions-api' | grep -v 'pulsar-presto-connector-original' | grep -v 'pulsar-presto-distribution' | grep -v 'pulsar-common' | grep -v 'pulsar-functions-proto' | grep -v 'pulsar-functions-utils' | grep -v 'pulsar-io-core' | grep -v 'pulsar-transaction-common' | grep -v 'pulsar-package-core' | sed 's!.*/!!' | sort)
LICENSEPATH=$(tar -tf $TARBALL | awk '/^[^\/]*\/lib\/presto\/LICENSE/')
LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
LICENSEJARS=$(echo "$LICENSE" | sed -nE 's!.* (.*\.jar).*!\1!gp')


for J in $JARS; do
echo $J | grep -q "org.apache.pulsar"
if [ $? == 0 ]; then
continue
fi

echo "$LICENSE" | grep -q $J
if [ $? != 0 ]; then
echo $J unaccounted for in lib/presto/LICENSE
EXIT=1
fi
done

# Check all jars mentioned in LICENSE are bundled
for J in $LICENSEJARS; do
echo "$JARS" | grep -q $J
if [ $? != 0 ]; then
echo $J mentioned in lib/presto/LICENSE, but not bundled
EXIT=2
fi
done
if [ "$NO_PRESTO" -ne 1 ]; then
# check pulsar sql jars
JARS=$(tar -tf $TARBALL | grep '\.jar' | grep 'lib/presto/' | grep -v pulsar-client | grep -v bouncy-castle-bc | grep -v pulsar-metadata | grep -v 'managed-ledger' | grep -v 'pulsar-client-admin' | grep -v 'pulsar-client-api' | grep -v 'pulsar-functions-api' | grep -v 'pulsar-presto-connector-original' | grep -v 'pulsar-presto-distribution' | grep -v 'pulsar-common' | grep -v 'pulsar-functions-proto' | grep -v 'pulsar-functions-utils' | grep -v 'pulsar-io-core' | grep -v 'pulsar-transaction-common' | grep -v 'pulsar-package-core' | sed 's!.*/!!' | sort)
LICENSEPATH=$(tar -tf $TARBALL | awk '/^[^\/]*\/lib\/presto\/LICENSE/')
LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
LICENSEJARS=$(echo "$LICENSE" | sed -nE 's!.* (.*\.jar).*!\1!gp')


for J in $JARS; do
echo $J | grep -q "org.apache.pulsar"
if [ $? == 0 ]; then
continue
fi

echo "$LICENSE" | grep -q $J
if [ $? != 0 ]; then
echo $J unaccounted for in lib/presto/LICENSE
EXIT=1
fi
done

# Check all jars mentioned in LICENSE are bundled
for J in $LICENSEJARS; do
echo "$JARS" | grep -q $J
if [ $? != 0 ]; then
echo $J mentioned in lib/presto/LICENSE, but not bundled
EXIT=2
fi
done
fi

if [ $EXIT != 0 ]; then
echo
Expand Down
4 changes: 2 additions & 2 deletions tests/bc_2_0_0/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@

<profiles>
<profile>
<id>integrationTests</id>
<id>BackwardsCompatTests</id>
<activation>
<property>
<name>integrationTests</name>
<name>BackwardsCompatTests</name>
</property>
</activation>
<build>
Expand Down
Loading

0 comments on commit 1881459

Please sign in to comment.