This is an automated email from the ASF dual-hosted git repository. chengpan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kyuubi-shaded.git
commit a11e8c57c22c35d8c1d02a4e9b7baa0f7329c857 Author: Cheng Pan <[email protected]> AuthorDate: Sun Apr 23 12:32:21 2023 +0800 [KYUUBI-SHADED #1] Initial setup project --- .github/PULL_REQUEST_TEMPLATE | 23 ++ .github/actions/setup-maven/action.yaml | 30 ++ .github/workflows/license.yml | 52 +++ .github/workflows/master.yml | 58 +++ .github/workflows/publish-snapshot-nexus.yml | 49 +++ .github/workflows/style.yml | 50 +++ .gitignore | 56 +++ build/mvn | 99 +++++ build/release/asf-settings.xml | 34 ++ build/util.sh | 38 ++ dev/checkout_pr.sh | 49 +++ dev/merge_kyuubi_pr.py | 298 +++++++++++++++ dev/reformat | 23 ++ kyuubi-shaded-force-shading/pom.xml | 32 ++ pom.xml | 537 +++++++++++++++++++++++++++ 15 files changed, 1428 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE new file mode 100644 index 0000000..9730ba7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE @@ -0,0 +1,23 @@ +<!-- +Thanks for sending a pull request! + +Here are some tips for you: + 1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html + 2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI-SHADED #XXXX]' in your PR title, e.g., '[KYUUBI-SHADED #XXXX] Your PR title ...'. + 3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI-SHADED #XXXX] Your PR title ...'. +--> + +### _Why are the changes needed?_ +<!-- +Please clarify why the changes are needed. For instance, + 1. If you add a feature, you can talk about the use case of it. + 2. If you fix a bug, you can clarify why it is a bug. +--> + + +### _How was this patch tested?_ +- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible + +- [ ] Add screenshots for manual tests if appropriate + +- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request diff --git a/.github/actions/setup-maven/action.yaml b/.github/actions/setup-maven/action.yaml new file mode 100644 index 0000000..4aabd40 --- /dev/null +++ b/.github/actions/setup-maven/action.yaml @@ -0,0 +1,30 @@ +# +# 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. +# + +name: setup-maven +description: 'Install and cache maven' +runs: + using: composite + steps: + - name: Restore cached Maven + uses: actions/cache@v3 + with: + path: build/apache-maven-* + key: setup-maven-${{ hashFiles('pom.xml') }} + - name: Install Maven + shell: bash + run: build/mvn -v diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 0000000..17e7c4b --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,52 @@ +# +# 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. +# + +name: License check + +# This GitHub workflow checks Apache License v2.0 Header is added if needed + +on: + pull_request: + branches: + - master + - branch-* + +concurrency: + group: license-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + rat: + name: License + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Setup JDK 8 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: 'maven' + check-latest: false + - run: >- + build/mvn org.apache.rat:apache-rat-plugin:check + - name: Upload rat report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: rat-report + path: "**/target/rat*.txt" diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..dbb491d --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,58 @@ +# +# 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. +# + +name: CI + +on: + push: + branches: + - master + - branch-* + pull_request: + branches: + - master + - branch-* + +concurrency: + group: test-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + MVN_OPT: -Dmaven.javadoc.skip=true -Dspotless.check.skip + +jobs: + default: + name: Kyuubi Shaded Test + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + - name: Setup JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: 'maven' + check-latest: false + - name: Setup Maven + uses: ./.github/actions/setup-maven + - name: Build and Package + run: | + build/mvn clean package diff --git a/.github/workflows/publish-snapshot-nexus.yml b/.github/workflows/publish-snapshot-nexus.yml new file mode 100644 index 0000000..8704a98 --- /dev/null +++ b/.github/workflows/publish-snapshot-nexus.yml @@ -0,0 +1,49 @@ +# +# 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. +# + +name: Publish Snapshot Nexus + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + publish-snapshot: + if: ${{ startsWith(github.repository, 'apache/') }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + branch: + - master + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ matrix.branch }} + - name: Setup JDK 8 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: 'maven' + check-latest: false + - name: Publish Snapshot Jar to Nexus + env: + ASF_USERNAME: ${{ secrets.NEXUS_USER }} + ASF_PASSWORD: ${{ secrets.NEXUS_PW }} + run: build/mvn clean deploy -s build/release/asf-settings.xml -DskipTests diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 0000000..ea16a08 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,50 @@ +# +# 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. +# + +name: Style + +on: + pull_request: + branches: + - master + - branch-* + +concurrency: + group: linter-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + linter: + name: Style check + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup JDK 8 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: 'maven' + check-latest: false + - name: Setup Maven + uses: ./.github/actions/setup-maven + - name: Spotless style check + run: | + build/mvn spotless:check diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8adf799 --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# +# 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. +# + +*#*# +*.#* +*.iml +*.ipr +*.iws +*.pyc +*.pyo +*.swp +*~ +.DS_Store +.cache +.classpath +.ensime +.ensime_cache/ +.ensime_lucene +.generated-mima* +.vscode/ +.idea/ +.idea_modules/ +.project +.pydevproject +.python-version +.scala_dependencies +.settings +build/apache-maven* +build/release/tmp +build/scala* +build/test +target/ +dist/ +apache-kyuubi-*-bin* +*.gz +logs/ +pid/ +local/ +out/ +hs_err_pid* +**/dependency-reduced-pom.xml +/work/ diff --git a/build/mvn b/build/mvn new file mode 100755 index 0000000..d0d865f --- /dev/null +++ b/build/mvn @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +# +# 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. +# + +# Determine the current working directory +_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# Preserve the calling directory +_CALLING_DIR="$(pwd)" +# Options used during compilation +_COMPILE_JVM_OPTS="-Xms2g -Xmx2g -XX:ReservedCodeCacheSize=1g -Xss128m" + +if [ "$CI" ]; then + export MAVEN_CLI_OPTS="--no-transfer-progress --errors --fail-fast" +fi + +# Installs any application tarball given a URL, the expected tarball name, +# and, optionally, a checkable binary path to determine if the binary has +# already been installed +## Arg1 - URL +## Arg2 - Tarball Name +## Arg3 - Checkable Binary +install_app() { + local remote_tarball="$1/$2" + local local_tarball="${_DIR}/$2" + local binary="${_DIR}/$3" + + # setup `curl` and `wget` silent options if we're running on Jenkins + local curl_opts="-L" + local wget_opts="" + curl_opts="--progress-bar ${curl_opts}" + wget_opts="--progress=bar:force ${wget_opts}" + + if [ -z "$3" -o ! -f "$binary" ]; then + # check if we already have the tarball + # check if we have curl installed + # download application + [ ! -f "${local_tarball}" ] && [ $(command -v curl) ] && \ + echo "exec: curl ${curl_opts} ${remote_tarball}" 1>&2 && \ + curl ${curl_opts} "${remote_tarball}" > "${local_tarball}" + # if the file still doesn't exist, lets try `wget` and cross our fingers + [ ! -f "${local_tarball}" ] && [ $(command -v wget) ] && \ + echo "exec: wget ${wget_opts} ${remote_tarball}" 1>&2 && \ + wget ${wget_opts} -O "${local_tarball}" "${remote_tarball}" + # if both were unsuccessful, exit + [ ! -f "${local_tarball}" ] && \ + echo -n "ERROR: Cannot download $2 with cURL or wget; " && \ + echo "please install manually and try again." && \ + exit 2 + cd "${_DIR}" && tar -xzf "$2" + rm -rf "$local_tarball" + fi +} + +# Determine the Maven version from the root pom.xml file and +# install maven under the build/ folder if needed. +install_mvn() { + local MVN_VERSION=`grep "<maven.version>" "${_DIR}/../pom.xml" | head -n1 | awk -F '[<>]' '{print $3}'` + MVN_BIN="$(command -v mvn)" + if [ "$MVN_BIN" ]; then + local MVN_DETECTED_VERSION="$(mvn --version | head -n1 | awk '{print $3}')" + fi + # See simple version normalization: http://stackoverflow.com/questions/16989598/bash-comparing-version-numbers + function version { echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; } + if [ $(version $MVN_DETECTED_VERSION) -ne $(version $MVN_VERSION) ]; then + local APACHE_MIRROR=${APACHE_MIRROR:-'https://archive.apache.org/dist/'} + + install_app \ + "${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries" \ + "apache-maven-${MVN_VERSION}-bin.tar.gz" \ + "apache-maven-${MVN_VERSION}/bin/mvn" + + MVN_BIN="${_DIR}/apache-maven-${MVN_VERSION}/bin/mvn" + fi +} + +install_mvn + +cd "${_CALLING_DIR}" + +# Set any `mvn` options if not already present +export MAVEN_OPTS=${MAVEN_OPTS:-"$_COMPILE_JVM_OPTS"} + +echo "Using mvn from path: $MVN_BIN" 1>&2 +${MVN_BIN} $MAVEN_CLI_OPTS "$@" diff --git a/build/release/asf-settings.xml b/build/release/asf-settings.xml new file mode 100644 index 0000000..b6388f7 --- /dev/null +++ b/build/release/asf-settings.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + <servers> + <server> + <id>apache.snapshots.https</id> + <username>${env.ASF_USERNAME}</username> + <password>${env.ASF_PASSWORD}</password> + </server> + <server> + <id>apache.releases.https</id> + <username>${env.ASF_USERNAME}</username> + <password>${env.ASF_PASSWORD}</password> + </server> + </servers> +</settings> diff --git a/build/util.sh b/build/util.sh new file mode 100755 index 0000000..7d8ca86 --- /dev/null +++ b/build/util.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# +# 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. +# + +realpath () { +( + TARGET_FILE="$1" + + cd "$(dirname "$TARGET_FILE")" + TARGET_FILE="$(basename "$TARGET_FILE")" + + COUNT=0 + while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ] + do + TARGET_FILE="$(readlink "$TARGET_FILE")" + cd $(dirname "$TARGET_FILE") + TARGET_FILE="$(basename $TARGET_FILE)" + COUNT=$(($COUNT + 1)) + done + + echo "$(pwd -P)/"$TARGET_FILE"" +) +} diff --git a/dev/checkout_pr.sh b/dev/checkout_pr.sh new file mode 100755 index 0000000..082b4e9 --- /dev/null +++ b/dev/checkout_pr.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# 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. +# + +set -o pipefail +set -e +set -x + +function usage { + echo "Usage: $(basename "${0}") [-f] <PR_NUMBER>" 2>&1 + echo ' -f force overwrite of local branch (default: fail if exists)' + exit 1 +} + +if [[ ${#} -eq 0 ]]; then + usage +fi + +FORCE="" +while getopts ":f" arg; do + case "${arg}" in + f) + FORCE="--force" + ;; + ?) + usage + ;; + esac +done +shift "$(($OPTIND -1))" + +PR_NUM=$1 + +git fetch apache pull/${PR_NUM}/head:PR_${PR_NUM} ${FORCE} +git checkout PR_${PR_NUM} diff --git a/dev/merge_kyuubi_pr.py b/dev/merge_kyuubi_pr.py new file mode 100755 index 0000000..5f5d1f9 --- /dev/null +++ b/dev/merge_kyuubi_pr.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python3 + +# +# 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. +# + +# Utility for creating well-formed pull request merges and pushing them to Kyuubi +# For committers: +# Please check your local git envs via `git remote -v` which should +# apache [email protected]:apache/kyuubi.git (fetch) +# apache [email protected]:apache/kyuubi.git (push) +# origin [email protected]:[ YOUR GITHUB USER NAME ]/kyuubi.git (fetch) +# origin [email protected]:[ YOUR GITHUB USER NAME ]/kyuubi.git (push) + +import json +import os +import re +import subprocess +import sys +from urllib.request import urlopen +from urllib.request import Request +from urllib.error import HTTPError + +KYUUBI_HOME = os.environ.get("KYUUBI_HOME", os.getcwd()) +PR_REMOTE_NAME = os.environ.get("PR_REMOTE_NAME", "apache") +PUSH_REMOTE_NAME = os.environ.get("PUSH_REMOTE_NAME", "apache") +GITHUB_OAUTH_KEY = os.environ.get("GITHUB_OAUTH_KEY") +GITHUB_API_BASE = "https://api.github.com/repos/apache/kyuubi-shaded" +BRANCH_PREFIX = "PR_TOOL" + + +def get_json(url): + try: + request = Request(url) + if GITHUB_OAUTH_KEY: + request.add_header('Authorization', 'token %s' % GITHUB_OAUTH_KEY) + return json.load(urlopen(request)) + except HTTPError as e: + if "X-RateLimit-Remaining" in e.headers and e.headers["X-RateLimit-Remaining"] == '0': + print("Exceeded the GitHub API rate limit; see the instructions in " + + "dev/merge_kyuubi_pr.py to configure an OAuth token for making authenticated " + + "GitHub requests.") + else: + print("Unable to fetch URL, exiting: %s" % url, e) + sys.exit(-1) + + +def fail(msg): + print(msg) + clean_up() + sys.exit(-1) + + +def run_cmd(cmd): + print(cmd) + if isinstance(cmd, list): + return subprocess.check_output(cmd).decode('utf-8') + else: + return subprocess.check_output(cmd.split(" ")).decode('utf-8') + + +def continue_maybe(prompt): + result = input("\n%s (y/n): " % prompt) + if result.lower() != "y": + fail("Okay, exiting") + + +def clean_up(): + if 'original_head' in globals(): + print("Restoring head pointer to %s" % original_head) + run_cmd("git checkout %s" % original_head) + + branches = run_cmd("git branch").replace(" ", "").split("\n") + + for branch in list(filter(lambda x: x.startswith(BRANCH_PREFIX), branches)): + print("Deleting local branch %s" % branch) + run_cmd("git branch -D %s" % branch) + +def fix_title(text, num): + if (re.search(r'^\[KYUUBI\s#[0-9]{3,6}\].*', text)): + return text + + return '[KYUUBI-SHADED #%s] %s' % (num, text) + +# merge the requested PR and return the merge hash +def merge_pr(pr_num, target_ref, title, body, pr_repo_desc): + pr_branch_name = "%s_MERGE_PR_%s" % (BRANCH_PREFIX, pr_num) + target_branch_name = "%s_MERGE_PR_%s_%s" % (BRANCH_PREFIX, pr_num, target_ref.upper()) + run_cmd("git fetch %s pull/%s/head:%s" % (PR_REMOTE_NAME, pr_num, pr_branch_name)) + run_cmd("git fetch %s %s:%s" % (PUSH_REMOTE_NAME, target_ref, target_branch_name)) + run_cmd("git checkout %s" % target_branch_name) + + had_conflicts = False + try: + run_cmd(['git', 'merge', pr_branch_name, '--squash']) + except Exception as e: + msg = "Error merging: %s\nWould you like to manually fix-up this merge?" % e + continue_maybe(msg) + msg = "Okay, please fix any conflicts and 'git add' conflicting files... Finished?" + continue_maybe(msg) + had_conflicts = True + + commit_authors = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name, + '--pretty=format:%an <%ae>']).split("\n") + distinct_authors = sorted(set(commit_authors), + key=lambda x: commit_authors.count(x), reverse=True) + primary_author = input( + "Enter primary author in the format of \"name <email>\" [%s]: " % + distinct_authors[0]) + if primary_author == "": + primary_author = distinct_authors[0] + else: + # When primary author is specified manually, de-dup it from author list and + # put it at the head of author list. + distinct_authors = list(filter(lambda x: x != primary_author, distinct_authors)) + distinct_authors.insert(0, primary_author) + + commits = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name, + '--pretty=format:%h [%an] %s']).split("\n\n") + + merge_message_flags = [] + + merge_message_flags += ["-m", title] + if body is not None: + # We remove @ symbols from the body to avoid triggering e-mails + # to people every time someone creates a public fork of Kyuubi. + merge_message_flags += ["-m", body.replace("@", "")] + + committer_name = run_cmd("git config --get user.name").strip() + committer_email = run_cmd("git config --get user.email").strip() + + if had_conflicts: + message = "This patch had conflicts when merged, resolved by\nCommitter: %s <%s>" % ( + committer_name, committer_email) + merge_message_flags += ["-m", message] + + # The string "Closes #%s" string is required for GitHub to correctly close the PR + merge_message_flags += ["-m", "Closes #%s from %s." % (pr_num, pr_repo_desc)] + + for issueId in re.findall("KYUUBI-SHADED #[0-9]{3,5}", title): + merge_message_flags += ["-m", issueId.replace("KYUUBI", "Closes")] + + for c in commits: + merge_message_flags += ["-m", c] + + authors = "Authored-by:" if len(distinct_authors) == 1 else "Lead-authored-by:" + authors += " %s" % (distinct_authors.pop(0)) + if len(distinct_authors) > 0: + authors += "\n" + "\n".join(["Co-authored-by: %s" % a for a in distinct_authors]) + authors += "\n" + "Signed-off-by: %s <%s>" % (committer_name, committer_email) + + merge_message_flags += ["-m", authors] + + run_cmd(['git', 'commit', '--author="%s"' % primary_author] + merge_message_flags) + + continue_maybe("Merge complete (local ref %s). Push to %s?" % ( + target_branch_name, PUSH_REMOTE_NAME)) + + try: + run_cmd('git push %s %s:%s' % (PUSH_REMOTE_NAME, target_branch_name, target_ref)) + except Exception as e: + clean_up() + fail("Exception while pushing: %s" % e) + + merge_hash = run_cmd("git rev-parse %s" % target_branch_name)[:8] + clean_up() + print("Pull request #%s merged!" % pr_num) + print("Merge hash: %s" % merge_hash) + return merge_hash + + +def cherry_pick(pr_num, merge_hash, default_branch): + pick_ref = input("Enter a branch name [%s]: " % default_branch) + if pick_ref == "": + pick_ref = default_branch + + pick_branch_name = "%s_PICK_PR_%s_%s" % (BRANCH_PREFIX, pr_num, pick_ref.upper()) + + run_cmd("git fetch %s %s:%s" % (PUSH_REMOTE_NAME, pick_ref, pick_branch_name)) + run_cmd("git checkout %s" % pick_branch_name) + + try: + run_cmd("git cherry-pick -sx %s" % merge_hash) + except Exception as e: + msg = "Error cherry-picking: %s\nWould you like to manually fix-up this merge?" % e + continue_maybe(msg) + msg = "Okay, please fix any conflicts and finish the cherry-pick. Finished?" + continue_maybe(msg) + + continue_maybe("Pick complete (local ref %s). Push to %s?" % ( + pick_branch_name, PUSH_REMOTE_NAME)) + + try: + run_cmd('git push %s %s:%s' % (PUSH_REMOTE_NAME, pick_branch_name, pick_ref)) + except Exception as e: + clean_up() + fail("Exception while pushing: %s" % e) + + pick_hash = run_cmd("git rev-parse %s" % pick_branch_name)[:8] + clean_up() + + print("Pull request #%s picked into %s!" % (pr_num, pick_ref)) + print("Pick hash: %s" % pick_hash) + return pick_ref + +def get_current_ref(): + ref = run_cmd("git rev-parse --abbrev-ref HEAD").strip() + if ref == 'HEAD': + # The current ref is a detached HEAD, so grab its SHA. + return run_cmd("git rev-parse HEAD").strip() + else: + return ref + + +def main(): + global original_head + + os.chdir(KYUUBI_HOME) + original_head = get_current_ref() + + branches = get_json("%s/branches" % GITHUB_API_BASE) + branch_names = list(filter(lambda x: x.startswith("branch-"), [x['name'] for x in branches])) + # Assumes branch names can be sorted lexicographically + latest_branch = sorted(branch_names, reverse=True)[0] + + pr_num = input("Which pull request would you like to merge? (e.g. 34): ") + pr = get_json("%s/pulls/%s" % (GITHUB_API_BASE, pr_num)) + pr_events = get_json("%s/issues/%s/events" % (GITHUB_API_BASE, pr_num)) + + url = pr["url"] + title = pr["title"] + title = fix_title(title, pr_num) + body = re.sub(re.compile(r"<!--[^>]*-->\n?", re.DOTALL), "", pr["body"]).lstrip() + target_ref = pr["base"]["ref"] + user_login = pr["user"]["login"] + base_ref = pr["head"]["ref"] + pr_repo_desc = "%s/%s" % (user_login, base_ref) + + # Merged pull requests don't appear as merged in the GitHub API; + # Instead, they're closed by asfgit. + merge_commits = \ + [e for e in pr_events if e["event"] == "closed" and e["commit_id"]] + + if merge_commits: + merge_hash = merge_commits[0]["commit_id"] + message = get_json("%s/commits/%s" % (GITHUB_API_BASE, merge_hash))["commit"]["message"] + + print("Pull request %s has already been merged, assuming you want to backport" % pr_num) + commit_is_downloaded = run_cmd(['git', 'rev-parse', '--quiet', '--verify', + "%s^{commit}" % merge_hash]).strip() != "" + if not commit_is_downloaded: + fail("Couldn't find any merge commit for #%s, you may need to update HEAD." % pr_num) + + print("Found commit %s:\n%s" % (merge_hash, message)) + cherry_pick(pr_num, merge_hash, latest_branch) + sys.exit(0) + + if not bool(pr["mergeable"]): + msg = "Pull request %s is not mergeable in its current form.\n" % pr_num + \ + "Continue? (experts only!)" + continue_maybe(msg) + + print("\n=== Pull Request #%s ===" % pr_num) + print("title:\t%s\nsource:\t%s\ntarget:\t%s\nurl:\t%s\nbody:\n\n%s" % + (title, pr_repo_desc, target_ref, url, body)) + continue_maybe("Proceed with merging pull request #%s?" % pr_num) + + merged_refs = [target_ref] + + merge_hash = merge_pr(pr_num, target_ref, title, body, pr_repo_desc) + + pick_prompt = "Would you like to pick %s into another branch?" % merge_hash + while input("\n%s (y/n): " % pick_prompt).lower() == "y": + merged_refs = merged_refs + [cherry_pick(pr_num, merge_hash, latest_branch)] + +if __name__ == "__main__": + import doctest + (failure_count, test_count) = doctest.testmod() + if failure_count: + sys.exit(-1) + try: + main() + except: + clean_up() + raise diff --git a/dev/reformat b/dev/reformat new file mode 100755 index 0000000..ca8f4e0 --- /dev/null +++ b/dev/reformat @@ -0,0 +1,23 @@ +#!/bin/bash +# +# 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. +# + +set -x + +PROJECT_DIR="$(cd "`dirname "$0"`/.."; pwd)" + +${PROJECT_DIR}/build/mvn spotless:apply diff --git a/kyuubi-shaded-force-shading/pom.xml b/kyuubi-shaded-force-shading/pom.xml new file mode 100644 index 0000000..c88a89b --- /dev/null +++ b/kyuubi-shaded-force-shading/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.kyuubi</groupId> + <artifactId>kyuubi-shaded-parent</artifactId> + <version>0.1.0-SNAPSHOT</version> + </parent> + + <artifactId>kyuubi-shaded-force-shading</artifactId> + <packaging>jar</packaging> + +</project> diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e42451c --- /dev/null +++ b/pom.xml @@ -0,0 +1,537 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>29</version> + </parent> + + <groupId>org.apache.kyuubi</groupId> + <artifactId>kyuubi-shaded-parent</artifactId> + <version>0.1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <url>https://kyuubi.apache.org/</url> + + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>manual</distribution> + </license> + </licenses> + + <mailingLists> + <mailingList> + <name>Dev Mailing List</name> + <subscribe>[email protected]</subscribe> + <unsubscribe>[email protected]</unsubscribe> + <post>[email protected]</post> + <archive>https://mail-archives.apache.org/mod_mbox/kyuubi-dev</archive> + </mailingList> + </mailingLists> + + <modules> + <module>kyuubi-shaded-force-shading</module> + </modules> + + <scm> + <connection>scm:git:[email protected]:apache/kyuubi-shaded.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/kyuubi-shaded.git</developerConnection> + <tag>HEAD</tag> + <url>scm:git:[email protected]:apache/kyuubi-shaded.git</url> + </scm> + + <issueManagement> + <system>GitHub Issues</system> + <url>https://github.com/apache/kyuubi-shaded/issues</url> + </issueManagement> + + <distributionManagement> + <repository> + <id>${distMgmtReleaseId}</id> + <name>${distMgmtReleaseName}</name> + <url>${distMgmtReleaseUrl}</url> + </repository> + <snapshotRepository> + <id>${distMgmtSnapshotsId}</id> + <name>${distMgmtSnapshotsName}</name> + <url>${distMgmtSnapshotsUrl}</url> + </snapshotRepository> + </distributionManagement> + + <properties> + <java.version>1.8</java.version> + <maven.version>3.8.7</maven.version> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + + <maven.plugin.build.helper.version>3.3.0</maven.plugin.build.helper.version> + <maven.plugin.enforcer.mojo.rules.version>1.6.1</maven.plugin.enforcer.mojo.rules.version> + <maven.plugin.surefire.version>3.0.0-M8</maven.plugin.surefire.version> + <maven.plugin.spotless.version>2.30.0</maven.plugin.spotless.version> + <maven.plugin.jacoco.version>0.8.7</maven.plugin.jacoco.version> + <maven.plugin.shade.version>3.4.1</maven.plugin.shade.version> + + <!-- Needed for consistent times --> + <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss z</maven.build.timestamp.format> + + <!-- Package to use when relocating shaded classes. --> + <kyuubi.shade.packageName>org.apache.kyuubi.shade</kyuubi.shade.packageName> + + <!-- Needed for Spotless style check--> + <spotless.java.googlejavaformat.version>1.7</spotless.java.googlejavaformat.version> + + <distMgmtReleaseId>apache.releases.https</distMgmtReleaseId> + <distMgmtReleaseName>Apache Release Distribution Repository</distMgmtReleaseName> + <distMgmtReleaseUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtReleaseUrl> + <distMgmtSnapshotsId>apache.snapshots.https</distMgmtSnapshotsId> + <distMgmtSnapshotsName>Apache Development Snapshot Repository</distMgmtSnapshotsName> + <distMgmtSnapshotsUrl>https://repository.apache.org/content/repositories/snapshots</distMgmtSnapshotsUrl> + </properties> + + <repositories> + <repository> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <id>gcs-maven-central-mirror</id> + <name>GCS Maven Central mirror Asia Pacific</name> + <url>https://maven-central-asia.storage-download.googleapis.com/maven2/</url> + </repository> + + <repository> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <id>central</id> + <name>Maven Repository</name> + <url>https://repo.maven.apache.org/maven2</url> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <id>gcs-maven-central-mirror</id> + <name>GCS Maven Central mirror Asia Pacific</name> + <url>https://maven-central-asia.storage-download.googleapis.com/maven2/</url> + </pluginRepository> + + <pluginRepository> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <id>central</id> + <url>https://repo.maven.apache.org/maven2</url> + </pluginRepository> + </pluginRepositories> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>create-tmp-dir</id> + <goals> + <goal>run</goal> + </goals> + <phase>generate-test-resources</phase> + <configuration> + <target> + <mkdir dir="${project.build.directory}/tmp"></mkdir> + </target> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>${maven.plugin.build.helper.version}</version> + <executions> + <execution> + <id>module-timestamp-property</id> + <goals> + <goal>timestamp-property</goal> + </goals> + <phase>validate</phase> + <configuration> + <name>module.build.timestamp</name> + <pattern>${maven.build.timestamp.format}</pattern> + <timeSource>current</timeSource> + <timeZone>Asia/Shanghai</timeZone> + <locale>en_US</locale> + </configuration> + </execution> + <execution> + <id>local-timestamp-property</id> + <goals> + <goal>timestamp-property</goal> + </goals> + <phase>validate</phase> + <configuration> + <name>local.build.timestamp</name> + <pattern>${maven.build.timestamp.format}</pattern> + <timeSource>build</timeSource> + <timeZone>Asia/Shanghai</timeZone> + <locale>en_US</locale> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <maxmem>1024m</maxmem> + <fork>true</fork> + <compilerArgs> + <arg>-Xlint:all,-serial,-path,-processing</arg> + </compilerArgs> + </configuration> + </plugin> + + <!-- disable surefire --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven.plugin.surefire.version}</version> + <configuration> + <skipTests>true</skipTests> + <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${maven.plugin.shade.version}</version> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>default-cli</id> + <goals> + <goal>build-classpath</goal> + </goals> + <configuration> + <!-- This includes dependencies with 'runtime' and 'compile' scopes; + see the docs for includeScope for more details --> + <includeScope>runtime</includeScope> + </configuration> + </execution> + <execution> + <id>generate-test-classpath</id> + <goals> + <goal>build-classpath</goal> + </goals> + <phase>test-compile</phase> + <configuration> + <includeScope>test</includeScope> + <outputProperty>test_classpath</outputProperty> + </configuration> + </execution> + <execution> + <id>copy-module-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>package</phase> + <configuration> + <includeScope>runtime</includeScope> + <outputDirectory>${jars.target.dir}</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>${project.basedir}</directory> + <includes> + <include>**/*.log</include> + </includes> + </fileset> + <fileset> + <directory>${project.basedir}/tmp</directory> + </fileset> + </filesets> + </configuration> + </plugin> + + <plugin> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + <version>${maven.plugin.spotless.version}</version> + <configuration> + <upToDateChecking> + <enabled>true</enabled> + </upToDateChecking> + <java> + <includes> + <include>src/main/java/**/*.java</include> + <include>src/test/java/**/*.java</include> + </includes> + <googleJavaFormat> + <version>${spotless.java.googlejavaformat.version}</version> + <style>GOOGLE</style> + </googleJavaFormat> + <removeUnusedImports></removeUnusedImports> + </java> + <pom> + <includes> + <include>pom.xml</include> + </includes> + <sortPom> + <encoding>${project.build.sourceEncoding}</encoding> + <expandEmptyElements>true</expandEmptyElements> + <indentSchemaLocation>true</indentSchemaLocation> + <nrOfIndentSpace>4</nrOfIndentSpace> + </sortPom> + </pom> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>${maven.plugin.download.version}</version> + </plugin> + + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <inherited>true</inherited> + <configuration> + <excludeSubProjects>false</excludeSubProjects> + <numUnapprovedLicenses>0</numUnapprovedLicenses> + <licenseFamilies> + <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> + <familyName>Apache License 2.0</familyName> + </licenseFamily> + </licenseFamilies> + <excludesFile>.rat-excludes</excludesFile> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + <phase>verify</phase> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.codehaus.mojo</groupId> + <artifactId>extra-enforcer-rules</artifactId> + <version>${maven.plugin.enforcer.mojo.rules.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <!-- dump test classpath into a folder --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + + <plugin> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-bytecode-version</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <enforceBytecodeVersion> + <maxJdkVersion>${java.version}</maxJdkVersion> + <ignoredScopes>test</ignoredScopes> + </enforceBytecodeVersion> + </rules> + <fail>true</fail> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>java-8</id> + <activation> + <jdk>1.8</jdk> + </activation> + <properties> + <java.version>1.8</java.version> + </properties> + </profile> + + <profile> + <id>apache-release</id> + <build> + <plugins> + <!-- Prevent the source-release-assembly execution defined in the Apache parent POM + from running so we can control it ourselves --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>source-release-assembly</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>net.nicoulaj.maven.plugins</groupId> + <artifactId>checksum-maven-plugin</artifactId> + <executions> + <execution> + <id>source-release-checksum</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <inherited>true</inherited> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <quiet>true</quiet> + <doclint>none</doclint> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-gpg-plugin</artifactId> + <executions> + <execution> + <id>sign-release-artifacts</id> + <goals> + <goal>sign</goal> + </goals> + <phase>verify</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project>
