Skip to content

Commit

Permalink
Add license to kotlin and android
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOmarA committed Sep 22, 2023
1 parent 20f60a6 commit 191d8ad
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
41 changes: 41 additions & 0 deletions interop/android/add_license.py
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 3 additions & 0 deletions interop/android/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
41 changes: 41 additions & 0 deletions interop/kotlin/add_license.py
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 3 additions & 0 deletions interop/kotlin/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 191d8ad

Please sign in to comment.