From b181b7797f67a4b0e227ca7138fad121105bcb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Thu, 1 Mar 2018 08:07:40 -0800 Subject: [PATCH] Check PATENTS does not creep into files Summary: Some files have crept into the repo with the old license header. These are usually from PRs that were opened prior to the re-licensing of the project. Let the script run, prior to fixing the errant files. The script outputs the following: ``` PATENTS crept into some new files? --- /dev/fd/63 2018-03-01 01:42:48.250153746 +0000 +++ /dev/fd/62 2018-03-01 01:42:48.250153746 +0000 @@ -1 +1,9 @@ +Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h +Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m +ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java +ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +ReactCommon/yoga/yoga/YGLayout.cpp +ReactCommon/yoga/yoga/YGLayout.h +ReactCommon/yoga/yoga/YGStyle.cpp +ReactCommon/yoga/yoga/YGStyle.h scripts/circleci/check_license.sh Exited with code 1 ``` Fix the headers in these files and run the script again. No output, exit code 0. Closes https://github.com/facebook/react-native/pull/18143 Reviewed By: sophiebits Differential Revision: D7119356 Pulled By: hramos fbshipit-source-id: d238e4d4a3ae320a2c8e625c2fa29690057a4814 --- .circleci/config.yml | 12 +++++++++--- .../NativeAnimation/Nodes/RCTTrackingAnimatedNode.h | 6 ++---- .../NativeAnimation/Nodes/RCTTrackingAnimatedNode.m | 6 ++---- .../react/animated/TrackingAnimatedNode.java | 6 ++---- .../react/views/text/CustomLetterSpacingSpan.java | 6 ++---- ReactCommon/yoga/yoga/YGLayout.cpp | 7 +++---- ReactCommon/yoga/yoga/YGLayout.h | 7 +++---- ReactCommon/yoga/yoga/YGStyle.cpp | 7 +++---- ReactCommon/yoga/yoga/YGStyle.h | 7 +++---- scripts/circleci/check_license.sh | 13 +++++++++++++ 10 files changed, 42 insertions(+), 35 deletions(-) create mode 100755 scripts/circleci/check_license.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 12a44b30a..2cfbaf4f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -152,6 +152,11 @@ aliases: command: yarn flow check when: always + - &run-license-checks + name: Check license + command: ./scripts/circleci/check_license.sh + when: always + - &build-android-app name: Build Android App command: | @@ -275,7 +280,7 @@ jobs: # Runs JavaScript lint and flow checks. # Currently will fail a PR if lint/flow raises issues. - js_checks: + analyze: <<: *js_defaults steps: - attach_workspace: @@ -283,6 +288,7 @@ jobs: - run: *run-lint-checks - run: *run-flow-checks + - run: *run-license-checks - store_test_results: path: ~/react-native/reports/junit @@ -576,8 +582,8 @@ workflows: - checkout_code: filters: *filter-ignore-gh-pages - # Run lint and flow checks - - js_checks: + # Run lint, flow, and other checks + - analyze: filters: *filter-ignore-gh-pages requires: - checkout_code diff --git a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h index 8f3281789..99e9bd111 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ #import "RCTAnimatedNode.h" diff --git a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m index e77b773e0..42150285d 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ #import "RCTTrackingAnimatedNode.h" diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java index db312d235..a339780df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ package com.facebook.react.animated; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java index 004d26138..d41338ccd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java @@ -1,10 +1,8 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ package com.facebook.react.views.text; diff --git a/ReactCommon/yoga/yoga/YGLayout.cpp b/ReactCommon/yoga/yoga/YGLayout.cpp index 208a6fe3f..4d798476a 100644 --- a/ReactCommon/yoga/yoga/YGLayout.cpp +++ b/ReactCommon/yoga/yoga/YGLayout.cpp @@ -1,11 +1,10 @@ /** * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + #include "YGLayout.h" #include "Utils.h" diff --git a/ReactCommon/yoga/yoga/YGLayout.h b/ReactCommon/yoga/yoga/YGLayout.h index 125a6d0b0..cfe559f64 100644 --- a/ReactCommon/yoga/yoga/YGLayout.h +++ b/ReactCommon/yoga/yoga/YGLayout.h @@ -1,11 +1,10 @@ /** * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + #pragma once #include "Yoga-internal.h" diff --git a/ReactCommon/yoga/yoga/YGStyle.cpp b/ReactCommon/yoga/yoga/YGStyle.cpp index 56b5a1e69..f3bc16fe1 100644 --- a/ReactCommon/yoga/yoga/YGStyle.cpp +++ b/ReactCommon/yoga/yoga/YGStyle.cpp @@ -1,11 +1,10 @@ /** * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + #include "YGStyle.h" const YGValue kYGValueUndefined = {YGUndefined, YGUnitUndefined}; diff --git a/ReactCommon/yoga/yoga/YGStyle.h b/ReactCommon/yoga/yoga/YGStyle.h index a95b4a297..74b9d6e0b 100644 --- a/ReactCommon/yoga/yoga/YGStyle.h +++ b/ReactCommon/yoga/yoga/YGStyle.h @@ -1,11 +1,10 @@ /** * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + #pragma once #include "Yoga-internal.h" #include "Yoga.h" diff --git a/scripts/circleci/check_license.sh b/scripts/circleci/check_license.sh new file mode 100755 index 000000000..68b41d6ac --- /dev/null +++ b/scripts/circleci/check_license.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +# Make sure we don't introduce accidental references to PATENTS. +EXPECTED='scripts/circleci/check_license.sh' +ACTUAL=$(git grep -l PATENTS) + +if [ "$EXPECTED" != "$ACTUAL" ]; then + echo "PATENTS crept into some new files?" + diff -u <(echo "$EXPECTED") <(echo "$ACTUAL") || true + exit 1 +fi