Skip to content

Commit 43e1a9c

Browse files
[MCP] chore: Add license header check for MCP (apache#80)
* Add license check for MCP * Add license check for MCP
1 parent 55f3388 commit 43e1a9c

7 files changed

Lines changed: 525 additions & 0 deletions

File tree

.github/workflows/mcp-server.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ jobs:
6060
with:
6161
python-version: ${{ matrix.python-version }}
6262

63+
- name: Set up JDK
64+
uses: actions/setup-java@v4
65+
with:
66+
distribution: 'temurin'
67+
java-version: |
68+
21
69+
${{ matrix.java-version != '21' && matrix.java-version || '' }}
70+
- name: Setup Gradle
71+
uses: gradle/actions/setup-gradle@v4
72+
73+
- name: Check
74+
run: |
75+
cd mcp-server
76+
./gradlew rat
77+
6378
- name: Install uv
6479
run: |
6580
curl -LsSf https://astral.sh/uv/install.sh | sh

mcp-server/.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# Byte-compiled / optimized / DLL files
21+
__pycache__/
22+
*.py[cod]
23+
*$py.class
24+
25+
# C extensions
26+
*.so
27+
28+
# Distribution / packaging
29+
.Python
30+
env/
31+
build/
32+
develop-eggs/
33+
dist/
34+
downloads/
35+
eggs/
36+
.eggs/
37+
lib/
38+
lib64/
39+
parts/
40+
sdist/
41+
var/
42+
*.egg-info/
43+
.installed.cfg
44+
*.egg
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
.tox/
59+
.coverage
60+
.coverage.*
61+
.cache
62+
nosetests.xml
63+
coverage.xml
64+
*,cover
65+
.hypothesis/
66+
venv/
67+
.venv/
68+
.python-version
69+
.pytest_cache
70+
71+
# Translations
72+
*.mo
73+
*.pot
74+
75+
# Django stuff:
76+
*.log
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
target/
83+
84+
#Ipython Notebook
85+
.ipynb_checkpoints
86+
87+
# Ignore Gradle wrapper jar file
88+
gradle/wrapper/gradle-wrapper.jar
89+
gradle/wrapper/gradle-wrapper-*.sha256

mcp-server/build.gradle.kts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import org.nosphere.apache.rat.RatTask
21+
22+
plugins {
23+
id("org.nosphere.apache.rat") version "0.8.1"
24+
}
25+
26+
repositories {
27+
mavenCentral()
28+
}
29+
30+
tasks.named<RatTask>("rat").configure {
31+
// Gradle
32+
excludes.add("**/build/**")
33+
excludes.add("gradle/wrapper/gradle-wrapper*")
34+
excludes.add(".gradle")
35+
36+
excludes.add("LICENSE")
37+
excludes.add("DISCLAIMER")
38+
excludes.add("NOTICE")
39+
40+
// Git & GitHub
41+
excludes.add(".git")
42+
excludes.add(".github/pull_request_template.md")
43+
44+
// Python specific
45+
excludes.add("**/*.pyc")
46+
excludes.add("**/__pycache__/**")
47+
excludes.add(".venv/**")
48+
excludes.add("uv.lock")
49+
excludes.add("polaris_mcp.egg-info/**")
50+
excludes.add(".pytest_cache/**")
51+
52+
// Misc build artifacts
53+
excludes.add("**/.keep")
54+
excludes.add("logs/**")
55+
excludes.add("**/*.lock")
56+
57+
// Configuration files that cannot have headers
58+
excludes.add("**/*.conf")
59+
excludes.add("**/*.properties")
60+
61+
// Binary files
62+
excludes.add("**/*.jar")
63+
excludes.add("**/*.zip")
64+
excludes.add("**/*.tar.gz")
65+
excludes.add("**/*.tgz")
66+
excludes.add("**/*.class")
67+
68+
// IntelliJ
69+
excludes.add(".idea")
70+
excludes.add("**/*.iml")
71+
excludes.add("**/*.iws")
72+
73+
// Rat can't scan binary images
74+
excludes.add("**/*.png")
75+
excludes.add("**/*.svg")
76+
excludes.add("**/*.puml")
77+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
# Downloads the gradle-wrapper.jar if necessary and verifies its integrity.
20+
# Included from /.gradlew
21+
22+
# Extract the Gradle version from gradle-wrapper.properties.
23+
GRADLE_DIST_VERSION="$(grep distributionUrl= "$APP_HOME/gradle/wrapper/gradle-wrapper.properties" | sed 's/^.*gradle-\([0-9.]*\)-[a-z]*.zip$/\1/')"
24+
GRADLE_WRAPPER_SHA256="$APP_HOME/gradle/wrapper/gradle-wrapper-${GRADLE_DIST_VERSION}.jar.sha256"
25+
GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
26+
if [ -x "$(command -v sha256sum)" ] ; then
27+
SHASUM="sha256sum"
28+
else
29+
if [ -x "$(command -v shasum)" ] ; then
30+
SHASUM="shasum -a 256"
31+
else
32+
echo "Neither sha256sum nor shasum are available, install either." > /dev/stderr
33+
exit 1
34+
fi
35+
fi
36+
if [ ! -e "${GRADLE_WRAPPER_SHA256}" ]; then
37+
# Delete the wrapper jar, if the checksum file does not exist.
38+
rm -f "${GRADLE_WRAPPER_JAR}"
39+
fi
40+
if [ -e "${GRADLE_WRAPPER_JAR}" ]; then
41+
# Verify the wrapper jar, if it exists, delete wrapper jar and checksum file, if the checksums
42+
# do not match.
43+
JAR_CHECKSUM="$(${SHASUM} "${GRADLE_WRAPPER_JAR}" | cut -d\ -f1)"
44+
EXPECTED="$(cat "${GRADLE_WRAPPER_SHA256}")"
45+
if [ "${JAR_CHECKSUM}" != "${EXPECTED}" ]; then
46+
rm -f "${GRADLE_WRAPPER_JAR}" "${GRADLE_WRAPPER_SHA256}"
47+
fi
48+
fi
49+
if [ ! -e "${GRADLE_WRAPPER_SHA256}" ]; then
50+
curl --location --output "${GRADLE_WRAPPER_SHA256}" https://services.gradle.org/distributions/gradle-${GRADLE_DIST_VERSION}-wrapper.jar.sha256 || exit 1
51+
fi
52+
if [ ! -e "${GRADLE_WRAPPER_JAR}" ]; then
53+
# The Gradle version extracted from the `distributionUrl` property does not contain ".0" patch
54+
# versions. Need to append a ".0" in that case to download the wrapper jar.
55+
GRADLE_VERSION="$(echo "$GRADLE_DIST_VERSION" | sed 's/^\([0-9]*[.][0-9]*\)$/\1.0/')"
56+
curl --location --output "${GRADLE_WRAPPER_JAR}" https://raw.githubusercontent.com/gradle/gradle/v${GRADLE_VERSION}/gradle/wrapper/gradle-wrapper.jar || exit 1
57+
JAR_CHECKSUM="$(${SHASUM} "${GRADLE_WRAPPER_JAR}" | cut -d\ -f1)"
58+
EXPECTED="$(cat "${GRADLE_WRAPPER_SHA256}")"
59+
if [ "${JAR_CHECKSUM}" != "${EXPECTED}" ]; then
60+
# If the (just downloaded) checksum and the downloaded wrapper jar do not match, something
61+
# really bad is going on.
62+
echo "Expected sha256 of the downloaded gradle-wrapper.jar does not match the downloaded sha256!" > /dev/stderr
63+
exit 1
64+
fi
65+
fi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
5+
networkTimeout=10000
6+
validateDistributionUrl=true
7+
zipStoreBase=GRADLE_USER_HOME
8+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)