forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements a new versioning scheme, similar to the one recently proposed with iree-org#18938 and applies it to `iree-compiler`, `iree-runtime` and the `iree-dist` tarball. The TF and TFLite compiler tools use the (legacy) versioning and need to be updated with a follow up commit. The common version number is determined based on the versions of the compiler and the runtime and the higher version is picked as the common on. In contrast to the proposed versioning scheme, version numbers of development releases are in the format `X.Y.Z.dev0+${gitcommithash}` as discussed in iree-org#19003 and not `X.Y.Z.dev` as originally proposed. Not yet addressed is the refactoring of the workflows thus that the `version-local.json` files get only written once (and not for every OS) and to provide then to subsequent steps as artifacts.
- Loading branch information
Showing
13 changed files
with
302 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
# Ensure a recent cmake | ||
cmake>=3.18.4 | ||
ninja | ||
packaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright 2024 The IREE Authors | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This scripts grabs the X.Y.Z[.dev]` version identifier from the | ||
# compiler's and runtime's `version.json` files and computes the | ||
# shared version. | ||
|
||
import argparse | ||
from pathlib import Path | ||
import json | ||
from datetime import datetime | ||
import subprocess | ||
|
||
from packaging.version import Version | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
release_type = parser.add_mutually_exclusive_group() | ||
release_type.add_argument("-rc", "--nightly-release", action="store_true") | ||
release_type.add_argument("-dev", "--development-release", action="store_true") | ||
release_type.add_argument("--custom-string", action="store", type=str) | ||
args = parser.parse_args() | ||
|
||
THIS_DIR = Path(__file__).parent.resolve() | ||
|
||
VERSION_FILE_COMPILER = THIS_DIR / "../../compiler/version.json" | ||
VERSION_FILE_RUNTIME = THIS_DIR / "../../runtime/version.json" | ||
|
||
|
||
def load_version_info(version_file): | ||
with open(version_file, "rt") as f: | ||
return json.load(f) | ||
|
||
|
||
compiler_version = load_version_info(VERSION_FILE_COMPILER) | ||
COMPILER_PACKAGE_VERSION = compiler_version.get("package-version") | ||
COMPILER_BASE_VERSION = Version(COMPILER_PACKAGE_VERSION).base_version | ||
|
||
runtime_version = load_version_info(VERSION_FILE_RUNTIME) | ||
RUNTIME_PACKAGE_VERSION = runtime_version.get("package-version") | ||
RUNTIME_BASE_VERSION = Version(RUNTIME_PACKAGE_VERSION).base_version | ||
|
||
if RUNTIME_BASE_VERSION > COMPILER_BASE_VERSION: | ||
CURRENT_VERSION = RUNTIME_BASE_VERSION | ||
else: | ||
CURRENT_VERSION = COMPILER_BASE_VERSION | ||
|
||
if args.nightly_release: | ||
CURRENT_VERSION += "rc" + datetime.today().strftime("%Y%m%d") | ||
|
||
if args.development_release: | ||
CURRENT_VERSION += ( | ||
".dev+" | ||
+ subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() | ||
) | ||
|
||
if args.custom_string: | ||
CURRENT_VERSION += args.custom_string | ||
|
||
print(CURRENT_VERSION) |
Oops, something went wrong.