This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-shaded.git

commit 575912de77153544a5e4211f504cc67e5ee776a8
Author: Chesnay Schepler <[email protected]>
AuthorDate: Mon Sep 26 11:55:36 2022 +0200

    [FLINK-29414] Setup license check
---
 .github/workflows/ci.yml                           | 17 ++++++++-
 flink-shaded-guava-30/pom.xml                      | 11 +++++-
 .../flink-shaded-jackson-2/pom.xml                 | 11 +++++-
 .../pom.xml                                        | 11 +++++-
 flink-shaded-netty-4/pom.xml                       |  9 +++++
 .../flink-shaded-zookeeper-35/pom.xml              | 11 +++++-
 .../flink-shaded-zookeeper-36/pom.xml              | 11 +++++-
 pom.xml                                            | 43 ++++++++++++++++++++++
 tools/ci/log4j.properties                          | 43 ++++++++++++++++++++++
 9 files changed, 160 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4fb9f19..f9c6760 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,6 +22,8 @@ jobs:
     runs-on: ubuntu-latest
     env:
       MVN_COMMON_OPTIONS: -U -B --no-transfer-progress
+      MVN_BUILD_OUTPUT_FILE: "/tmp/mvn_build_output.out"
+      MVN_VALIDATION_DIR: "/tmp/flink-validation-deployment"
 
     steps:
       - uses: actions/checkout@v2
@@ -39,5 +41,16 @@ jobs:
           maven-version: 3.8.6
 
       - name: Build
-        run: mvn clean install ${{ env.MVN_COMMON_OPTIONS }}
-          -DaltDeploymentRepository=validation_repository::default::file:${{ 
env.MVN_VALIDATION_DIR }} \
+        run: |
+          set -o pipefail
+
+          mvn clean deploy ${{ env.MVN_COMMON_OPTIONS }} \
+            -DaltDeploymentRepository=validation_repository::default::file:${{ 
env.MVN_VALIDATION_DIR }} \
+             -Plicense-check \
+            | tee ${{ env.MVN_BUILD_OUTPUT_FILE }}
+
+      - name: Check licensing
+        run: |
+          mvn ${MVN_COMMON_OPTIONS} exec:java@check-licensing -N \
+            -Dexec.args="${{ env.MVN_BUILD_OUTPUT_FILE }} $(pwd) ${{ 
env.MVN_VALIDATION_DIR }}" \
+            -Dlog4j.configurationFile=file://$(pwd)/tools/ci/log4j.properties
\ No newline at end of file
diff --git a/flink-shaded-guava-30/pom.xml b/flink-shaded-guava-30/pom.xml
index 65b4808..623f8b8 100644
--- a/flink-shaded-guava-30/pom.xml
+++ b/flink-shaded-guava-30/pom.xml
@@ -28,7 +28,7 @@ under the License.
         <version>16.0</version>
     </parent>
 
-    <artifactId>flink-shaded-guava</artifactId>
+    <artifactId>flink-shaded-guava${flink.ci.license.suffix}</artifactId>
     <name>flink-shaded-guava-30</name>
     <version>${guava.version}-16.0</version>
 
@@ -53,6 +53,15 @@ under the License.
         </dependency>
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>-30</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
+
     <build>
         <plugins>
             <plugin>
diff --git a/flink-shaded-jackson-parent/flink-shaded-jackson-2/pom.xml 
b/flink-shaded-jackson-parent/flink-shaded-jackson-2/pom.xml
index 4627bd8..0107157 100644
--- a/flink-shaded-jackson-parent/flink-shaded-jackson-2/pom.xml
+++ b/flink-shaded-jackson-parent/flink-shaded-jackson-2/pom.xml
@@ -28,7 +28,7 @@ under the License.
         <version>2.12.4-16.0</version>
     </parent>
 
-    <artifactId>flink-shaded-jackson</artifactId>
+    <artifactId>flink-shaded-jackson${flink.ci.license.suffix}</artifactId>
     <name>flink-shaded-jackson-2</name>
 
     <dependencies>
@@ -74,6 +74,15 @@ under the License.
         </dependencies>
     </dependencyManagement>
 
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>-2</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
+
     <build>
         <plugins>
             <plugin>
diff --git 
a/flink-shaded-jackson-parent/flink-shaded-jackson-module-jsonSchema-2/pom.xml 
b/flink-shaded-jackson-parent/flink-shaded-jackson-module-jsonSchema-2/pom.xml
index a72d53c..6d9f09d 100644
--- 
a/flink-shaded-jackson-parent/flink-shaded-jackson-module-jsonSchema-2/pom.xml
+++ 
b/flink-shaded-jackson-parent/flink-shaded-jackson-module-jsonSchema-2/pom.xml
@@ -28,7 +28,7 @@ under the License.
         <version>2.12.4-16.0</version>
     </parent>
 
-    <artifactId>flink-shaded-jackson-module-jsonSchema</artifactId>
+    
<artifactId>flink-shaded-jackson-module-jsonSchema${flink.ci.license.suffix}</artifactId>
     <name>flink-shaded-jackson-module-jsonSchema-2</name>
 
     <dependencies>
@@ -50,6 +50,15 @@ under the License.
         </dependency>
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>-2</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
+
     <build>
         <plugins>
             <plugin>
diff --git a/flink-shaded-netty-4/pom.xml b/flink-shaded-netty-4/pom.xml
index b338669..8ab27f8 100644
--- a/flink-shaded-netty-4/pom.xml
+++ b/flink-shaded-netty-4/pom.xml
@@ -40,6 +40,15 @@ under the License.
         </dependency>
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>-4</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
+
     <build>
         <plugins>
             <plugin>
diff --git a/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-35/pom.xml 
b/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-35/pom.xml
index 2003d52..e975067 100644
--- a/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-35/pom.xml
+++ b/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-35/pom.xml
@@ -28,7 +28,7 @@ under the License.
         <version>16.0</version>
     </parent>
 
-    <artifactId>flink-shaded-zookeeper-3</artifactId>
+    <artifactId>flink-shaded-zookeeper-3${flink.ci.license.suffix}</artifactId>
     <name>flink-shaded-zookeeper-3.5</name>
     <version>${zookeeper.version}-16.0</version>
 
@@ -124,4 +124,13 @@ under the License.
             </dependency>
         </dependencies>
     </dependencyManagement>
+
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>5</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file
diff --git a/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-36/pom.xml 
b/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-36/pom.xml
index c8483c6..b3239dd 100644
--- a/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-36/pom.xml
+++ b/flink-shaded-zookeeper-parent/flink-shaded-zookeeper-36/pom.xml
@@ -28,7 +28,7 @@ under the License.
         <version>16.0</version>
     </parent>
 
-    <artifactId>flink-shaded-zookeeper-3</artifactId>
+    <artifactId>flink-shaded-zookeeper-3${flink.ci.license.suffix}</artifactId>
     <name>flink-shaded-zookeeper-3.6</name>
     <version>${zookeeper.version}-16.0</version>
 
@@ -149,4 +149,13 @@ under the License.
             </dependency>
         </dependencies>
     </dependencyManagement>
+
+    <profiles>
+        <profile>
+            <id>license-check</id>
+            <properties>
+                <flink.ci.license.suffix>6</flink.ci.license.suffix>
+            </properties>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 14040dc..601640a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,9 +51,23 @@ under the License.
         
<developerConnection>scm:git:https://github.com/apache/flink-shaded.git</developerConnection>
     </scm>
 
+    <pluginRepositories>
+        <pluginRepository>
+            <!-- Allows exec-maven-plugin to resolve snapshot plugin 
dependencies -->
+            <id>apache.snapshots.https</id>
+            <name>${distMgmtSnapshotsName}</name>
+            <url>${distMgmtSnapshotsUrl}</url>
+        </pluginRepository>
+    </pluginRepositories>
+
     <properties>
         <shading.prefix>org.apache.flink.shaded</shading.prefix>
         <netty.version>4.1.70.Final</netty.version>
+        <!-- The license check requires the artifactId to match the directory 
that the module resides in.
+             This is not the case for several modules in flink-shaded for 
legacy reasons.
+             This property can be used by modules to add a suffix to the 
artifactId to match the directory name on CI
+             when the 'license-check' profile is active. -->
+        <flink.ci.license.suffix/>
     </properties>
 
     <modules>
@@ -311,6 +325,35 @@ under the License.
                     </excludes>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>3.1.0</version>
+                <inherited>false</inherited>
+                <executions>
+                    <execution>
+                        <id>check-license</id>
+                        <!-- manually called -->
+                        <phase>none</phase>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    
<mainClass>org.apache.flink.tools.ci.licensecheck.LicenseChecker</mainClass>
+                    <includePluginDependencies>true</includePluginDependencies>
+                    
<includeProjectDependencies>false</includeProjectDependencies>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.flink</groupId>
+                        <artifactId>flink-ci-tools</artifactId>
+                        <version>1.16-SNAPSHOT</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/tools/ci/log4j.properties b/tools/ci/log4j.properties
new file mode 100644
index 0000000..7daf1c3
--- /dev/null
+++ b/tools/ci/log4j.properties
@@ -0,0 +1,43 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+rootLogger.level = INFO
+rootLogger.appenderRef.out.ref = ConsoleAppender
+
+# -----------------------------------------------------------------------------
+# Console (use 'console')
+# -----------------------------------------------------------------------------
+
+appender.console.name = ConsoleAppender
+appender.console.type = CONSOLE
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{HH:mm:ss,SSS} [%20t] %-5p %-60c %x - %m%n
+
+# -----------------------------------------------------------------------------
+# File (use 'file')
+# -----------------------------------------------------------------------------
+appender.file.name = FileAppender
+appender.file.type = FILE
+appender.file.fileName = ${sys:log.dir}/mvn-${sys:mvn.forkNumber:-output}.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d{HH:mm:ss,SSS} [%20t] %-5p %-60c %x - %m%n
+appender.file.createOnDemand = true
+
+# suppress the irrelevant (wrong) warnings from the netty channel handler
+logger.netty.name = org.jboss.netty.channel.DefaultChannelPipeline
+logger.netty.level = ERROR

Reply via email to