Skip to content

Commit c0ce550

Browse files
authored
[FLINK-26035][build][planner] Add table-planner-loader-bundle module
1 parent 222b72f commit c0ce550

File tree

7 files changed

+116
-36
lines changed

7 files changed

+116
-36
lines changed

flink-table/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ If you want to use Table API & SQL, check out the [documentation](https://nightl
5252
* SQL validator
5353
* Query planner, optimizer and rules implementation
5454
* Code generator
55-
* Two jars are produced: one doesn't have any classifier and bundles all the classes from this module together with the two parsers, including 3rd party dependencies, while the other jar, classified as `loader-bundle`, extends the first jar including scala dependencies.
56-
* `flink-table-planner-loader`: Loader for `flink-table-planner` that loads the planner in a separate classpath, isolating the Scala version used to compile the planner.
55+
* The produced jar includes all the classes from this module together with the two parsers, including 3rd party dependencies (excluding Scala dependencies).
56+
* `flink-table-planner-loader-bundle` Bundles `flink-table-planner`, including Scala dependencies.
57+
* `flink-table-planner-loader`: Loader for `flink-table-planner` that loads the planner and it's Scala dependencies in a separate classpath using `flink-table-planner-loader-bundle`, isolating the Scala version used to compile the planner.
5758

5859
### SQL client
5960

@@ -65,7 +66,8 @@ If you want to use Table API & SQL, check out the [documentation](https://nightl
6566

6667
### Notes
6768

68-
No module except `flink-table-planner` should depend on `flink-table-runtime` in production classpath,
69+
No module except `flink-table-planner` should depend on `flink-table-runtime` in production classpath,
70+
no module except `flink-table-planner-loader` should depend on `flink-table-planner-loader-bundle` in production classpath,
6971
and similarly no module should depend on `flink-table-planner` or `flink-table-planner-loader` in production classpath.
7072
For testing, you should depend on `flink-table-planner-loader` and `flink-table-runtime`.
7173
These are already shipped by the Flink distribution.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing, software
14+
~ distributed under the License is distributed on an "AS IS" BASIS,
15+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
~ See the License for the specific language governing permissions and
17+
~ limitations under the License.
18+
-->
19+
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<parent>
27+
<groupId>org.apache.flink</groupId>
28+
<artifactId>flink-table</artifactId>
29+
<version>1.15-SNAPSHOT</version>
30+
<relativePath>..</relativePath>
31+
</parent>
32+
33+
<artifactId>flink-table-planner-loader-bundle</artifactId>
34+
<name>Flink : Table : Planner Loader Helper</name>
35+
<packaging>jar</packaging>
36+
<description>Intermediate build artifact use by the planner-loader.</description>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.apache.flink</groupId>
41+
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
42+
<version>${project.version}</version>
43+
<scope>runtime</scope>
44+
</dependency>
45+
</dependencies>
46+
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-deploy-plugin</artifactId>
52+
<configuration>
53+
<skip>true</skip>
54+
</configuration>
55+
</plugin>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-shade-plugin</artifactId>
59+
<executions>
60+
<execution>
61+
<id>shade-flink</id>
62+
<phase>package</phase>
63+
<goals>
64+
<goal>shade</goal>
65+
</goals>
66+
<configuration>
67+
<artifactSet>
68+
<includes>
69+
<include>org.apache.flink:flink-table-planner_${scala.binary.version}</include>
70+
<!-- flink-table-planner scala dependencies -->
71+
<include>org.scala-lang:*</include>
72+
<include>org.apache.flink:flink-scala_${scala.binary.version}</include>
73+
</includes>
74+
</artifactSet>
75+
</configuration>
76+
</execution>
77+
</executions>
78+
</plugin>
79+
</plugins>
80+
</build>
81+
82+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
flink-table-planner-loader-bundle
2+
Copyright 2014-2021 The Apache Software Foundation
3+
4+
This product includes software developed at
5+
The Apache Software Foundation (http://www.apache.org/).
6+
7+
The following dependencies all share the same BSD license which you find under licenses/LICENSE.scala.
8+
9+
- org.scala-lang:scala-compiler:2.12.7
10+
- org.scala-lang:scala-library:2.12.7
11+
- org.scala-lang:scala-reflect:2.12.7
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright (c) 2002- EPFL
2+
Copyright (c) 2011- Lightbend, Inc.
3+
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7+
8+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
Neither the name of the EPFL nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORSAS ISAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

flink-table/flink-table-planner-loader/pom.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<dependency>
5656
<!-- Ensures that flink-table-planner is built beforehand, in order to bundle the jar -->
5757
<groupId>org.apache.flink</groupId>
58-
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
58+
<artifactId>flink-table-planner-loader-bundle</artifactId>
5959
<version>${project.version}</version>
6060
<!-- We don't want any production code from flink-table-planner-loader to reference flink-table-planner directly -->
6161
<scope>runtime</scope>
@@ -89,14 +89,12 @@
8989
<artifactId>maven-surefire-plugin</artifactId>
9090
<configuration>
9191
<classpathDependencyExcludes>
92-
<!-- flink-table-planner_${scala.binary.version} is declared as runtime scope,
93-
so surefire will include it in the test classpath.
94-
But because the planner-loader and the planner_${scala.binary.version} jars are exclusive,
92+
<!-- The planner-loader and the planner_${scala.binary.version} jars are exclusive,
9593
that is you can have only one of them at the same time in the classpath,
9694
we need to exclude the planner_${scala.binary.version} from the test classpath
9795
in order to execute the loader tests correctly.
9896
-->
99-
<exclude>org.apache.flink:flink-table-planner_${scala.binary.version}</exclude>
97+
<exclude>org.apache.flink:flink-table-planner-loader-bundle</exclude>
10098
</classpathDependencyExcludes>
10199
</configuration>
102100
</plugin>
@@ -114,9 +112,8 @@
114112
<artifactItems>
115113
<artifactItem>
116114
<groupId>org.apache.flink</groupId>
117-
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
115+
<artifactId>flink-table-planner-loader-bundle</artifactId>
118116
<version>${project.version}</version>
119-
<classifier>loader-bundle</classifier>
120117
<type>jar</type>
121118
<overWrite>true</overWrite>
122119
<destFileName>flink-table-planner.jar</destFileName>
@@ -140,7 +137,7 @@
140137
<configuration>
141138
<filters>
142139
<filter>
143-
<artifact>org.apache.flink:flink-table-planner</artifact>
140+
<artifact>org.apache.flink:flink-table-planner-loader-bundle</artifact>
144141
<includes>
145142
<include>META-INF/NOTICE</include>
146143
<include>META-INF/licenses/**</include>
@@ -149,8 +146,7 @@
149146
</filters>
150147
<artifactSet>
151148
<includes>
152-
<!-- Because of the filter above, this inclusion is just adding NOTICE and licenses -->
153-
<include>org.apache.flink:flink-table-planner</include>
149+
<include>org.apache.flink:flink-table-planner-loader-bundle</include>
154150
</includes>
155151
</artifactSet>
156152
</configuration>

flink-table/flink-table-planner/pom.xml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -396,29 +396,6 @@ under the License.
396396
</relocation>
397397
</relocations>
398398
</configuration>
399-
<executions>
400-
<execution>
401-
<!-- This configuration is essentially the same as shade-flink,
402-
but it writes another jar to a separate file and it includes scala.
403-
This jar is used by flink-table-planner-loader -->
404-
<id>shade-loader-bundle</id>
405-
<phase>package</phase>
406-
<goals>
407-
<goal>shade</goal>
408-
</goals>
409-
<configuration>
410-
<shadedArtifactAttached>true</shadedArtifactAttached>
411-
<shadedClassifierName>loader-bundle</shadedClassifierName>
412-
<artifactSet>
413-
<includes combine.children="append">
414-
<!-- flink-table-planner scala dependencies -->
415-
<include>org.scala-lang:*</include>
416-
<include>org.apache.flink:flink-scala_${scala.binary.version}</include>
417-
</includes>
418-
</artifactSet>
419-
</configuration>
420-
</execution>
421-
</executions>
422399
</plugin>
423400

424401
<!-- Scala Code Style, most of the configuration done via plugin management -->

flink-table/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ under the License.
4242
<module>flink-table-api-java-uber</module>
4343
<module>flink-table-planner</module>
4444
<module>flink-table-planner-loader</module>
45+
<module>flink-table-planner-loader-bundle</module>
4546
<module>flink-table-runtime</module>
4647
<module>flink-sql-client</module>
4748
<module>flink-sql-parser</module>

0 commit comments

Comments
 (0)