forked from dmlc/xgboost
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [backport][sklearn] Fix loading model attributes. (dmlc#9808) (dmlc#9880) * [backport][py] Use the first found native library. (dmlc#9860) (dmlc#9879) * [backport] [CI] Upload libxgboost4j.dylib (M1) to S3 bucket (dmlc#9887) * [CI] Set up CI for Mac M1 (dmlc#9699) * [CI] Improve CI for Mac M1 (dmlc#9748) * [CI] Build libxgboost4j.dylib with CMAKE_OSX_DEPLOYMENT_TARGET (dmlc#9749) * [CI] Upload libxgboost4j.dylib (M1) to S3 bucket (dmlc#9886) * [jvm-packages] Fix POM for xgboost-jvm metapackage (dmlc#9893) * [jvm-packages] Fix POM for xgboost-jvm metapackage * Add script for updating the Scala version * Bump version to 2.0.3 (dmlc#9895) * Update change_scala_version.py to also change scala.version property (dmlc#9897) --------- Co-authored-by: Jiaming Yuan <jm.yuan@outlook.com> Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
- Loading branch information
1 parent
7c14732
commit e2a664c
Showing
29 changed files
with
315 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import argparse | ||
import pathlib | ||
import re | ||
import shutil | ||
|
||
|
||
def main(args): | ||
if args.scala_version == "2.12": | ||
scala_ver = "2.12" | ||
scala_patchver = "2.12.18" | ||
elif args.scala_version == "2.13": | ||
scala_ver = "2.13" | ||
scala_patchver = "2.13.11" | ||
else: | ||
raise ValueError(f"Unsupported Scala version: {args.scala_version}") | ||
|
||
# Clean artifacts | ||
if args.purge_artifacts: | ||
for target in pathlib.Path("jvm-packages/").glob("**/target"): | ||
if target.is_dir(): | ||
print(f"Removing {target}...") | ||
shutil.rmtree(target) | ||
|
||
# Update pom.xml | ||
for pom in pathlib.Path("jvm-packages/").glob("**/pom.xml"): | ||
print(f"Updating {pom}...") | ||
with open(pom, "r", encoding="utf-8") as f: | ||
lines = f.readlines() | ||
with open(pom, "w", encoding="utf-8") as f: | ||
replaced_scalaver = False | ||
replaced_scala_binver = False | ||
for line in lines: | ||
for artifact in [ | ||
"xgboost-jvm", | ||
"xgboost4j", | ||
"xgboost4j-gpu", | ||
"xgboost4j-spark", | ||
"xgboost4j-spark-gpu", | ||
"xgboost4j-flink", | ||
"xgboost4j-example", | ||
]: | ||
line = re.sub( | ||
f"<artifactId>{artifact}_[0-9\\.]*", | ||
f"<artifactId>{artifact}_{scala_ver}", | ||
line, | ||
) | ||
# Only replace the first occurrence of scala.version | ||
if not replaced_scalaver: | ||
line, nsubs = re.subn( | ||
r"<scala.version>[0-9\.]*", | ||
f"<scala.version>{scala_patchver}", | ||
line, | ||
) | ||
if nsubs > 0: | ||
replaced_scalaver = True | ||
# Only replace the first occurrence of scala.binary.version | ||
if not replaced_scala_binver: | ||
line, nsubs = re.subn( | ||
r"<scala.binary.version>[0-9\.]*", | ||
f"<scala.binary.version>{scala_ver}", | ||
line, | ||
) | ||
if nsubs > 0: | ||
replaced_scala_binver = True | ||
f.write(line) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--purge-artifacts", action="store_true") | ||
parser.add_argument( | ||
"--scala-version", | ||
type=str, | ||
required=True, | ||
help="Version of Scala to use in the JVM packages", | ||
choices=["2.12", "2.13"], | ||
) | ||
parsed_args = parser.parse_args() | ||
main(parsed_args) |
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
Oops, something went wrong.