rust: add v1.75.0 & v1.74.0, merge related variants into +dev, add rust-analyzer (#41903)

* Add rust-analyzer as variant to rust build

* Expose cargo module only when +cargo

* rust: add v1.74.0 and v1.75.0 and remove variants in favor of +dev

* [@spackbot] updating style on behalf of alecbcs

* Fix variant typo

---------

Co-authored-by: alecbcs <alecbcs@users.noreply.github.com>
This commit is contained in:
Alec Scott 2024-01-04 12:08:20 -07:00 committed by Massimiliano Culpo
parent c0c66a0fed
commit e5f4c6ad75
No known key found for this signature in database
GPG key ID: 3E52BB992233066C
3 changed files with 31 additions and 27 deletions

View file

@ -18,7 +18,7 @@ class PyTensorboardDataServer(PythonPackage):
version("0.6.1", commit="6acf0be88b5727e546dd64a8b9b12d790601d561") version("0.6.1", commit="6acf0be88b5727e546dd64a8b9b12d790601d561")
depends_on("py-setuptools", type="build") depends_on("py-setuptools", type="build")
depends_on("rust+rustfmt", type="build") depends_on("rust+dev", type="build")
# https://github.com/tensorflow/tensorboard/issues/5713 # https://github.com/tensorflow/tensorboard/issues/5713
patch( patch(

View file

@ -21,6 +21,17 @@ class RustBootstrap(Package):
# should update these binary releases as bootstrapping requirements are # should update these binary releases as bootstrapping requirements are
# modified by new releases of Rust. # modified by new releases of Rust.
rust_releases = { rust_releases = {
"1.75.0": {
"darwin": {
"x86_64": "ad066e4dec7ae5948c4e7afe68e250c336a5ab3d655570bb119b3eba9cf22851",
"aarch64": "878ecf81e059507dd2ab256f59629a4fb00171035d2a2f5638cb582d999373b1",
},
"linux": {
"x86_64": "473978b6f8ff216389f9e89315211c6b683cf95a966196e7914b46e8cf0d74f6",
"aarch64": "30828cd904fcfb47f1ac43627c7033c903889ea4aca538f53dcafbb3744a9a73",
"powerpc64le": "2599cdfea5860b4efbceb7bca69845a96ac1c96aa50cf8261151e82280b397a0",
},
},
"1.73.0": { "1.73.0": {
"darwin": { "darwin": {
"x86_64": "ece9646bb153d4bc0f7f1443989de0cbcd8989a7d0bf3b7fb9956e1223954f0c", "x86_64": "ece9646bb153d4bc0f7f1443989de0cbcd8989a7d0bf3b7fb9956e1223954f0c",

View file

@ -18,11 +18,13 @@ class Rust(Package):
maintainers("alecbcs") maintainers("alecbcs")
license("Apache-2.0 OR MIT")
# When adding a version of Rust you may need to add an additional version # When adding a version of Rust you may need to add an additional version
# to rust-bootstrap as the minimum bootstrapping requirements increase. # to rust-bootstrap as the minimum bootstrapping requirements increase.
# As a general rule of thumb Rust can be built with either the previous major # As a general rule of thumb Rust can be built with either the previous major
# version or the current version of the compiler as shown above. # version or the current version of the compiler as shown above.
#
# Pre-release versions. # Pre-release versions.
# Note: If you plan to use these versions remember to install with # Note: If you plan to use these versions remember to install with
# `-n` to prevent Spack from failing due to failed checksums. # `-n` to prevent Spack from failing due to failed checksums.
@ -34,11 +36,21 @@ class Rust(Package):
version("nightly") version("nightly")
# Stable versions. # Stable versions.
version("1.75.0", sha256="5b739f45bc9d341e2d1c570d65d2375591e22c2d23ef5b8a37711a0386abc088")
version("1.74.0", sha256="882b584bc321c5dcfe77cdaa69f277906b936255ef7808fcd5c7492925cf1049")
version("1.73.0", sha256="96d62e6d1f2d21df7ac8acb3b9882411f9e7c7036173f7f2ede9e1f1f6b1bb3a") version("1.73.0", sha256="96d62e6d1f2d21df7ac8acb3b9882411f9e7c7036173f7f2ede9e1f1f6b1bb3a")
version("1.70.0", sha256="b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c") version("1.70.0", sha256="b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c")
version("1.65.0", sha256="5828bb67f677eabf8c384020582b0ce7af884e1c84389484f7f8d00dd82c0038") version("1.65.0", sha256="5828bb67f677eabf8c384020582b0ce7af884e1c84389484f7f8d00dd82c0038")
version("1.60.0", sha256="20ca826d1cf674daf8e22c4f8c4b9743af07973211c839b85839742314c838b7") version("1.60.0", sha256="20ca826d1cf674daf8e22c4f8c4b9743af07973211c839b85839742314c838b7")
variant(
"dev",
default=False,
description="Include rust developer tools like rustfmt, clippy, and rust-analyzer.",
)
variant("docs", default=False, description="Build Rust core documentation.")
variant("src", default=True, description="Include standard library source files.")
# Core dependencies # Core dependencies
depends_on("cmake@3.13.4:", type="build") depends_on("cmake@3.13.4:", type="build")
depends_on("curl+nghttp2") depends_on("curl+nghttp2")
@ -63,20 +75,8 @@ class Rust(Package):
depends_on("rust-bootstrap@1.64:1.65", type="build", when="@1.65") depends_on("rust-bootstrap@1.64:1.65", type="build", when="@1.65")
depends_on("rust-bootstrap@1.69:1.70", type="build", when="@1.70") depends_on("rust-bootstrap@1.69:1.70", type="build", when="@1.70")
depends_on("rust-bootstrap@1.72:1.73", type="build", when="@1.73") depends_on("rust-bootstrap@1.72:1.73", type="build", when="@1.73")
depends_on("rust-bootstrap@1.73:1.74", type="build", when="@1.74")
variant( depends_on("rust-bootstrap@1.74:1.75", type="build", when="@1.75")
"analysis",
default=False,
description="Outputs code analysis that can be consumed by other tools",
)
variant(
"clippy",
default=True,
description="A bunch of lints to catch common mistakes and improve your Rust code.",
)
variant("docs", default=False, description="Build Rust documentation.")
variant("rustfmt", default=True, description="Formatting tool for Rust code.")
variant("src", default=True, description="Include standard library source files.")
extendable = True extendable = True
executables = ["^rustc$", "^cargo$"] executables = ["^rustc$", "^cargo$"]
@ -149,23 +149,16 @@ def configure(self, spec, prefix):
# Convert opts to '--set key=value' format. # Convert opts to '--set key=value' format.
flags = [flag for opt in opts for flag in ("--set", opt)] flags = [flag for opt in opts for flag in ("--set", opt)]
# Include both cargo and rustdoc in minimal install to match # Core rust tools to install.
# standard download of rust. tools = ["cargo"]
tools = ["cargo", "rustdoc"]
# Add additional tools as directed by the package variants. # Add additional tools as directed by the package variants.
if spec.satisfies("+analysis"): if spec.satisfies("+dev"):
tools.append("analysis") tools.extend(["clippy", "rustdoc", "rustfmt", "rust-analyzer"])
if spec.satisfies("+clippy"):
tools.append("clippy")
if spec.satisfies("+src"): if spec.satisfies("+src"):
tools.append("src") tools.append("src")
if spec.satisfies("+rustfmt"):
tools.append("rustfmt")
# Compile tools into flag for configure. # Compile tools into flag for configure.
flags.append(f"--tools={','.join(tools)}") flags.append(f"--tools={','.join(tools)}")