[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>
This commit is contained in:
Alexander Thomas
2022-05-05 10:36:05 +00:00
committed by Commit Bot
parent 35246aee33
commit e04f5885b8
3 changed files with 29 additions and 0 deletions
+6
View File
@@ -698,6 +698,12 @@ hooks = [
'pattern': '.',
'action': ['python3', 'sdk/tools/generate_package_config.py'],
},
{
# Generate the sdk/version file.
'name': 'Generate sdk/version',
'pattern': '.',
'action': ['python3', 'sdk/tools/generate_sdk_version_file.py'],
},
{
# Pull Debian sysroot for i386 Linux
'name': 'sysroot_i386',
+2
View File
@@ -0,0 +1,2 @@
# Generated version file for the unpatched SDK
version
+21
View File
@@ -0,0 +1,21 @@
#!/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())