diff --git a/.travis.yml b/.travis.yml index ad83df28a..0b4e45b5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ dist: trusty sudo: required env: - - OPTS="--check-signed-off-travis --check-cppcheck --check-vera" + - OPTS="--check-signed-off-travis --check-cppcheck --check-vera --check-license" - OPTS="--jerry-tests --jerry-test-suite" - OPTS="--jerry-tests --jerry-test-suite --toolchain=cmake/toolchain_linux_armv7l.cmake" TIMEOUT=300 INSTALL_QEMU_ARM=yes - OPTS=--buildoption-test diff --git a/jerry-core/jrt/jrt.h b/jerry-core/jrt/jrt.h index 2613d937e..381b37bf0 100644 --- a/jerry-core/jrt/jrt.h +++ b/jerry-core/jrt/jrt.h @@ -1,6 +1,6 @@ /* Copyright 2014-2016 Samsung Electronics Co., Ltd. * Copyright 2016 University of Szeged. - + * * Licensed 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 diff --git a/targets/mbed/js/blink.js b/targets/mbed/js/blink.js index 7634cf885..034e64c98 100644 --- a/targets/mbed/js/blink.js +++ b/targets/mbed/js/blink.js @@ -1,3 +1,19 @@ +/* Copyright 2015-2016 Samsung Electronics Co., Ltd. + * Copyright 2016 University of Szeged. + * + * Licensed 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. + */ + var check = 1; function blink () diff --git a/targets/mbed/js/main.js b/targets/mbed/js/main.js index e9380ba7f..4cfb5244b 100644 --- a/targets/mbed/js/main.js +++ b/targets/mbed/js/main.js @@ -1,3 +1,18 @@ +/* Copyright 2015-2016 Samsung Electronics Co., Ltd. + * + * Licensed 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. + */ + function sysloop (ticknow) { blink (); diff --git a/targets/zephyr/src/getline-zephyr.c b/targets/zephyr/src/getline-zephyr.c index 02ec4feaa..60cb0a9dd 100644 --- a/targets/zephyr/src/getline-zephyr.c +++ b/targets/zephyr/src/getline-zephyr.c @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2016 Linaro +/* Copyright (c) 2016 Linaro * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -8,7 +7,7 @@ * 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, + * 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. diff --git a/targets/zephyr/src/getline-zephyr.h b/targets/zephyr/src/getline-zephyr.h index bc3acf0f1..a8b77c2fe 100644 --- a/targets/zephyr/src/getline-zephyr.h +++ b/targets/zephyr/src/getline-zephyr.h @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2016 Linaro +/* Copyright (c) 2016 Linaro * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -8,7 +7,7 @@ * 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, + * 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. diff --git a/targets/zephyr/src/main-zephyr.c b/targets/zephyr/src/main-zephyr.c index bd4c7b15c..2f013d792 100644 --- a/targets/zephyr/src/main-zephyr.c +++ b/targets/zephyr/src/main-zephyr.c @@ -4,7 +4,7 @@ * 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 + * 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 diff --git a/tests/jerry/date-utc.js b/tests/jerry/date-utc.js index ff2104d80..0bcfae9b8 100644 --- a/tests/jerry/date-utc.js +++ b/tests/jerry/date-utc.js @@ -1,14 +1,14 @@ // Copyright 2015 Samsung Electronics Co., Ltd. // Copyright 2015 University of Szeged. // -// Licensed under the Apache License, Version 2.0 (the License); +// Licensed 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 +// 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 +// 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. diff --git a/tests/unit/test-libm.inc.h b/tests/unit/test-libm.inc.h index f1103e416..caecbe7eb 100644 --- a/tests/unit/test-libm.inc.h +++ b/tests/unit/test-libm.inc.h @@ -1,3 +1,19 @@ +/* Copyright 2016 Samsung Electronics Co., Ltd. + * Copyright 2016 University of Szeged. + * + * Licensed 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. + */ + /* * Generated by tools/gen-test-libm.sh * DO NOT EDIT!!! diff --git a/tools/check-license.py b/tools/check-license.py new file mode 100755 index 000000000..fdfe98c92 --- /dev/null +++ b/tools/check-license.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# Copyright 2016 University of Szeged +# +# Licensed 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. + +import os +import re +import sys + + +license = re.compile( +u"""((#|//|\*) Copyright .* +)+\s?\\2 +\s?\\2 Licensed under the Apache License, Version 2.0 \(the "License"\); +\s?\\2 you may not use this file except in compliance with the License. +\s?\\2 You may obtain a copy of the License at +\s?\\2 +\s?\\2 http://www.apache.org/licenses/LICENSE-2.0 +\s?\\2 +\s?\\2 Unless required by applicable law or agreed to in writing, software +\s?\\2 distributed under the License is distributed on an "AS IS" BASIS +\s?\\2 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +\s?\\2 See the License for the specific language governing permissions and +\s?\\2 limitations under the License.""") + +dirs = [ + 'cmake', + 'jerry-core', + 'jerry-libc', + 'jerry-libm', + 'jerry-main', + 'targets', + 'tests', + 'tools', +] + +exclude_dirs = [ + 'targets/esp8266' +] + +exts = [ + '.c', + '.cpp', + '.h', + '.S', + '.js', + '.py', + '.sh', + '.tcl', + '.cmake', +] + + +def main(): + is_ok = True + + for dname in dirs: + for root, _, files in os.walk(dname): + if any(root.startswith(exclude) for exclude in exclude_dirs): + continue + for fname in files: + if any(fname.endswith(ext) for ext in exts): + fpath = os.path.join(root, fname) + with open(fpath) as f: + if not license.search(f.read()): + print('%s: incorrect license' % fpath) + is_ok = False + + if not is_ok: + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/tools/run-tests.py b/tools/run-tests.py index 60d6d645f..d624c1543 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -31,6 +31,7 @@ parser.add_argument('--check-signed-off-tolerant', action='store_true', default= parser.add_argument('--check-signed-off-travis', action='store_true', default=False, help='Run signed-off check in tolerant mode if on Travis CI and not checking a pull request') parser.add_argument('--check-cppcheck', action='store_true', default=False, help='Run cppcheck') parser.add_argument('--check-vera', action='store_true', default=False, help='Run vera check') +parser.add_argument('--check-license', action='store_true', default=False, help='Run license check') parser.add_argument('--buildoption-test', action='store_true', default=False, help='Run buildoption-test') parser.add_argument('--jerry-tests', action='store_true', default=False, help='Run jerry-tests') parser.add_argument('--jerry-test-suite', action='store_true', default=False, help='Run jerry-test-suite') @@ -197,6 +198,9 @@ def main(): if not ret and (script_args.all or script_args.check_vera): ret = run_check(VERA_SCRIPT) + if not ret and (script_args.all or script_args.check_license): + ret = run_check(LICENSE_SCRIPT) + if not ret and (script_args.all or script_args.jerry_tests): ret = run_jerry_tests() diff --git a/tools/settings.py b/tools/settings.py index 70c2c0106..6279dd355 100755 --- a/tools/settings.py +++ b/tools/settings.py @@ -27,5 +27,6 @@ BUILD_SCRIPT = path.join(TOOLS_DIR, 'build.py') CPPCHECK_SCRIPT = path.join(TOOLS_DIR, 'check-cppcheck.sh') SIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh') VERA_SCRIPT = path.join(TOOLS_DIR, 'check-vera.sh') +LICENSE_SCRIPT = path.join(TOOLS_DIR, 'check-license.py') TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.sh') UNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.sh') diff --git a/tools/unit-tests/gen-test-libm.c b/tools/unit-tests/gen-test-libm.c index dbb339c73..4c8bf4838 100644 --- a/tools/unit-tests/gen-test-libm.c +++ b/tools/unit-tests/gen-test-libm.c @@ -33,7 +33,23 @@ int main (int argc, char **args) { - printf ("/*\n" + printf ("/* Copyright 2016 Samsung Electronics Co., Ltd.\n" + " * Copyright 2016 University of Szeged.\n" + " *\n" + " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + " * you may not use this file except in compliance with the License.\n" + " * You may obtain a copy of the License at\n" + " *\n" + " * http://www.apache.org/licenses/LICENSE-2.0\n" + " *\n" + " * Unless required by applicable law or agreed to in writing, software\n" + " * distributed under the License is distributed on an \"AS IS\" BASIS\n" + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + " * See the License for the specific language governing permissions and\n" + " * limitations under the License.\n" + " */\n" + "\n" + "/*\n" " * Generated by tools/gen-test-libm.sh\n" " * DO NOT EDIT!!!\n" " */\n");