From 5b7efbfed7250874604879a11e9d22351b93d7c6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 1 Mar 2023 14:47:27 +0200 Subject: [PATCH] Add utility script for bootstrap update Script `scripts/update-bootstrap` takes one argument with new bootstrap version, updates all required places and commit them with message "Advance bootstrap to {version}" --- scripts/update-bootstrap | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/update-bootstrap diff --git a/scripts/update-bootstrap b/scripts/update-bootstrap new file mode 100755 index 00000000000..24faf78e3fc --- /dev/null +++ b/scripts/update-bootstrap @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import sys +import subprocess + +def update_content(file_name, prefix, replacement): + with open(file_name, 'r', encoding='utf-8') as file: + data = file.readlines() + for i in range(len(data)): + line = data[i] + if prefix in line: + data[i] = replacement + with open(file_name, 'w', encoding='utf-8') as file: + file.writelines(data) + +if __name__ == '__main__': + version = sys.argv[1] + properties = 'gradle.properties' + kotlinc = '.idea/kotlinc.xml' + update_content(properties, 'bootstrap.kotlin.default.version', f'bootstrap.kotlin.default.version={version}') + update_content(kotlinc, '