dart-sdk/tools/generate_sdk_version_file.py
Alexander Thomas e04f5885b8 [sdk] Generate a version file for the unpatched SDK
This will be used to analyze the unpatched SDK. The file contains only
the major and minor part of the version number. The patch version will
always be 0. This is sufficient for the analyzer to construct a language
version.

Change-Id: Ief71ce617b279f7c688e9068c425bc31394cbf5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-05-05 10:36:05 +00:00

22 lines
572 B
Python
Executable file

#!/usr/bin/env python3
# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import utils
import sys
SDK_VERSION_FILE = os.path.join(utils.DART_DIR, 'sdk', 'version')
def Main():
version = utils.ReadVersionFile()
with open(SDK_VERSION_FILE, 'w') as versionFile:
versionFile.write(f'{version.major}.{version.minor}.0\n')
return 0
if __name__ == '__main__':
sys.exit(Main())