Skip to content

Commit 1fd23dd

Browse files
committed
Add license checker config and kokoro presubmit
`license-checker` is a tool that verifies each file has contains a permitted license header. See https://github.com/ben-clayton/license-checker for more information. Also add missing licenses to presubmit scripts.
1 parent 1e5ec3e commit 1fd23dd

File tree

9 files changed

+147
-3
lines changed

9 files changed

+147
-3
lines changed

clang-format-all.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
# Copyright 2020 The Marl Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
216
SRC_DIR=${ROOT_DIR}/src
317
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
418

519
# Double clang-format, as it seems that one pass isn't always enough
620
find ${SRC_DIR} -iname "*.h" -o -iname "*.cpp" | xargs ${CLANG_FORMAT} -i -style=file
7-
find ${SRC_DIR} -iname "*.h" -o -iname "*.cpp" | xargs ${CLANG_FORMAT} -i -style=file
21+
find ${SRC_DIR} -iname "*.h" -o -iname "*.cpp" | xargs ${CLANG_FORMAT} -i -style=file
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020 The Marl Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -e # Fail on any error.
18+
19+
license-checker

kokoro/license-check/presubmit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
build_file: "cppdap/kokoro/license-check/presubmit.sh"
4+

kokoro/license-check/presubmit.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -e # Fail on any error.
18+
19+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
20+
ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )"
21+
22+
docker run --rm -i \
23+
--volume "${ROOT_DIR}:${ROOT_DIR}" \
24+
--volume "${KOKORO_ARTIFACTS_DIR}:/mnt/artifacts" \
25+
--workdir "${ROOT_DIR}" \
26+
--entrypoint "${SCRIPT_DIR}/presubmit-docker.sh" \
27+
"gcr.io/shaderc-build/radial-build:latest"

kokoro/macos/presubmit.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/bash
22

3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
317
set -e # Fail on any error.
418
set -x # Display commands being run.
519

@@ -20,4 +34,4 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
2034
else
2135
echo "Unknown build system: $BUILD_SYSTEM"
2236
exit 1
23-
fi
37+
fi

kokoro/ubuntu/presubmit-docker.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/bash
22

3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
317
set -e # Fail on any error.
418

519
. /bin/using.sh # Declare the bash `using` function for configuring toolchains.
@@ -36,4 +50,4 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
3650
else
3751
echo "Unknown build system: $BUILD_SYSTEM"
3852
exit 1
39-
fi
53+
fi

kokoro/ubuntu/presubmit.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/bash
22

3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
317
set -e # Fail on any error.
418

519
ROOT_DIR=`pwd`

kokoro/windows/presubmit.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
REM Copyright 2020 Google LLC
2+
REM
3+
REM Licensed under the Apache License, Version 2.0 (the "License");
4+
REM you may not use this file except in compliance with the License.
5+
REM You may obtain a copy of the License at
6+
REM
7+
REM https://www.apache.org/licenses/LICENSE-2.0
8+
REM
9+
REM Unless required by applicable law or agreed to in writing, software
10+
REM distributed under the License is distributed on an "AS IS" BASIS,
11+
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
REM See the License for the specific language governing permissions and
13+
REM limitations under the License.
14+
115
@echo on
216

317
SETLOCAL ENABLEDELAYEDEXPANSION

license-checker.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"licenses": [
3+
"Apache-2.0-Header"
4+
],
5+
"paths": [
6+
{
7+
"exclude": [
8+
".clang-format",
9+
".gitignore",
10+
".gitmodules",
11+
".vscode/*.json",
12+
"**.md",
13+
"CONTRIBUTING",
14+
"LICENSE",
15+
"build/**",
16+
"examples/vscode/package.json",
17+
"fuzz/**",
18+
"kokoro/**.cfg",
19+
"third_party/googletest/**",
20+
"third_party/json/**"
21+
]
22+
}
23+
]
24+
}

0 commit comments

Comments
 (0)