From 191d8ade6df052b28727d68d58bb77970f7b4695 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 22 Sep 2023 16:29:25 +0300 Subject: [PATCH] Add license to kotlin and android --- interop/android/add_license.py | 41 ++++++++++++++++++++++++++++++++++ interop/android/bootstrap.sh | 3 +++ interop/kotlin/add_license.py | 41 ++++++++++++++++++++++++++++++++++ interop/kotlin/bootstrap.sh | 3 +++ 4 files changed, 88 insertions(+) create mode 100644 interop/android/add_license.py create mode 100644 interop/kotlin/add_license.py diff --git a/interop/android/add_license.py b/interop/android/add_license.py new file mode 100644 index 00000000..7ef87be6 --- /dev/null +++ b/interop/android/add_license.py @@ -0,0 +1,41 @@ +import os + +LICENSE: str =""" +// 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. +""" + +def main() -> None: + license: str = LICENSE.strip() + for (root_path, _, file_names) in os.walk(os.path.dirname(os.path.realpath(__file__))): + for file_name in file_names: + if not file_name.endswith('.kt'): + continue + + file_path: str = os.path.join(root_path, file_name) + + with open(file_path, 'r') as file: + content: str = file.read() + + if license not in content: + content = license + '\n\n' + content + + with open(file_path, 'w') as file: + file.write(content) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/interop/android/bootstrap.sh b/interop/android/bootstrap.sh index 536b450d..59532764 100755 --- a/interop/android/bootstrap.sh +++ b/interop/android/bootstrap.sh @@ -16,6 +16,9 @@ mkdir -p $jni mv $artifacts/uniffi-bindings/$package/*.kt $src/$package/RET.kt test -e $src/$package/RET.kt || exit 1 +# Adding the license +python3 add_license.py + crate_name=radix-engine-toolkit-uniffi jna_architectures=( "arm64-v8a" diff --git a/interop/kotlin/add_license.py b/interop/kotlin/add_license.py new file mode 100644 index 00000000..7ef87be6 --- /dev/null +++ b/interop/kotlin/add_license.py @@ -0,0 +1,41 @@ +import os + +LICENSE: str =""" +// 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. +""" + +def main() -> None: + license: str = LICENSE.strip() + for (root_path, _, file_names) in os.walk(os.path.dirname(os.path.realpath(__file__))): + for file_name in file_names: + if not file_name.endswith('.kt'): + continue + + file_path: str = os.path.join(root_path, file_name) + + with open(file_path, 'r') as file: + content: str = file.read() + + if license not in content: + content = license + '\n\n' + content + + with open(file_path, 'w') as file: + file.write(content) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/interop/kotlin/bootstrap.sh b/interop/kotlin/bootstrap.sh index 441e1590..810fb7cd 100755 --- a/interop/kotlin/bootstrap.sh +++ b/interop/kotlin/bootstrap.sh @@ -16,6 +16,9 @@ mkdir -p $res mv $artifacts/uniffi-bindings/$package/*.kt $src/$package/RET.kt test -e $src/$package/RET.kt || exit 1 +# Adding the license +python3 add_license.py + crate_name=radix-engine-toolkit-uniffi jna_architectures=( "darwin-aarch64"