Bug 1799952 - Add rust-analyzer scip index for Searchfox. r=asuth,glandium

Package rust-analyzer in the rust repack, and use it to generate a scip index.

Differential Revision: https://phabricator.services.mozilla.com/D161716
This commit is contained in:
Emilio Cobos Álvarez 2022-11-21 08:07:27 +00:00
parent d38d7fc847
commit 9d9d8869e5
7 changed files with 67 additions and 7 deletions

View file

@ -16,7 +16,7 @@ fn main() {
println!("cargo:rerun-if-changed=wrappers.cpp"); println!("cargo:rerun-if-changed=wrappers.cpp");
let ver = version().unwrap(); let ver = version().unwrap();
let max_oom_hook_version = Version::parse("1.66.0-alpha").unwrap(); let max_oom_hook_version = Version::parse("1.68.0-alpha").unwrap();
if ver < max_oom_hook_version { if ver < max_oom_hook_version {
println!("cargo:rustc-cfg=feature=\"oom_with_hook\""); println!("cargo:rustc-cfg=feature=\"oom_with_hook\"");

View file

@ -54,7 +54,7 @@ jobs:
- linux64-clang - linux64-clang
- linux64-nasm - linux64-nasm
- linux64-node - linux64-node
- linux64-rust - linux64-rust-nightly
- linux64-cbindgen - linux64-cbindgen
- linux64-dump_syms - linux64-dump_syms
- linux64-pkgconf - linux64-pkgconf
@ -94,7 +94,7 @@ jobs:
- linux64-libdmg - linux64-libdmg
- linux64-nasm - linux64-nasm
- linux64-node - linux64-node
- linux64-rust-macos - linux64-rust-cross-nightly
- linux64-cbindgen - linux64-cbindgen
- linux64-dump_syms - linux64-dump_syms
- macosx64-sdk - macosx64-sdk
@ -135,7 +135,7 @@ jobs:
toolchain: toolchain:
- linux64-binutils - linux64-binutils
- linux64-clang - linux64-clang
- linux64-rust-cross - linux64-rust-cross-nightly
- linux64-rust-size - linux64-rust-size
- linux64-nasm - linux64-nasm
- linux64-node - linux64-node
@ -185,6 +185,9 @@ jobs:
- android-sdk-linux - android-sdk-linux
- linux64-jdk - linux64-jdk
- linux64-clang - linux64-clang
# TODO: Change to rust-cross-nightly once
# https://github.com/rust-lang/rust/pull/104628 is merged
# (that'd provide better scip indexing).
- linux64-rust-android - linux64-rust-android
- linux64-rust-size - linux64-rust-size
- linux64-cbindgen - linux64-cbindgen

View file

@ -56,6 +56,23 @@ linux64-rust-1.65:
toolchain: toolchain:
- linux64-clang-toolchain - linux64-clang-toolchain
linux64-rust-nightly:
treeherder:
symbol: TL(rust-nightly)
run:
arguments: [
'--channel', 'nightly-2022-11-11',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
'--target', 'aarch64-unknown-linux-gnu',
'--target', 'wasm32-wasi',
'--compiler-builtins-hack',
]
fetches:
toolchain:
- linux64-clang-toolchain
# A patched rust toolchain that allows us to use sanitizers in our vendored # A patched rust toolchain that allows us to use sanitizers in our vendored
# build environment. See the rust fetch's comments for more details. # build environment. See the rust fetch's comments for more details.
linux64-rust-dev: linux64-rust-dev:
@ -78,7 +95,6 @@ linux64-rust-dev:
- linux64-clang-toolchain - linux64-clang-toolchain
- linux64-binutils - linux64-binutils
linux64-rust-cross-1.65: linux64-rust-cross-1.65:
description: "rust repack with macos and windows cross support" description: "rust repack with macos and windows cross support"
treeherder: treeherder:
@ -102,6 +118,28 @@ linux64-rust-cross-1.65:
] ]
toolchain-alias: linux64-rust-cross toolchain-alias: linux64-rust-cross
linux64-rust-cross-nightly:
description: "rust nightly repack with macos and windows cross support"
treeherder:
symbol: TL(rust-cross-nightly)
run:
arguments: [
'--channel', 'nightly-2022-11-11',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
'--target', 'x86_64-apple-darwin',
'--target', 'aarch64-apple-darwin',
'--target', 'x86_64-pc-windows-msvc',
'--target', 'i686-pc-windows-msvc',
'--target', 'aarch64-pc-windows-msvc',
'--target', 'armv7-linux-androideabi',
'--target', 'thumbv7neon-linux-androideabi',
'--target', 'aarch64-linux-android',
'--target', 'i686-linux-android',
'--target', 'x86_64-linux-android',
]
linux64-rust-static-1.65: linux64-rust-static-1.65:
description: "rust repack with static linking support" description: "rust repack with static linking support"
treeherder: treeherder:

View file

@ -306,7 +306,13 @@ def fetch_manifest(channel="stable", host=None, targets=()):
"available": requests.head(url).status_code == 200, "available": requests.head(url).status_code == 200,
} }
for pkg in ("cargo", "rustc", "rustfmt-preview", "clippy-preview"): for pkg in (
"cargo",
"rustc",
"rustfmt-preview",
"clippy-preview",
"rust-analyzer-preview",
):
manifest["pkg"][pkg] = { manifest["pkg"][pkg] = {
"version": "bors", "version": "bors",
"target": { "target": {
@ -395,7 +401,7 @@ def build_src(install_dir, host, targets, patches):
docs = false docs = false
sanitizers = true sanitizers = true
extended = true extended = true
tools = ["analysis", "cargo", "rustfmt", "clippy", "src"] tools = ["analysis", "cargo", "rustfmt", "clippy", "src", "rust-analyzer"]
[rust] [rust]
ignore-git = false ignore-git = false
@ -489,6 +495,7 @@ def repack(
rustsrc = fetch_package(manifest, "rust-src", host) rustsrc = fetch_package(manifest, "rust-src", host)
rustfmt = fetch_optional(manifest, "rustfmt-preview", host) rustfmt = fetch_optional(manifest, "rustfmt-preview", host)
clippy = fetch_optional(manifest, "clippy-preview", host) clippy = fetch_optional(manifest, "clippy-preview", host)
rust_analyzer = fetch_optional(manifest, "rust-analyzer-preview", host)
log("Installing packages...") log("Installing packages...")
@ -505,6 +512,8 @@ def repack(
install(os.path.basename(rustfmt["url"]), install_dir) install(os.path.basename(rustfmt["url"]), install_dir)
if clippy: if clippy:
install(os.path.basename(clippy["url"]), install_dir) install(os.path.basename(clippy["url"]), install_dir)
if rust_analyzer:
install(os.path.basename(rust_analyzer["url"]), install_dir)
for std in stds: for std in stds:
install(os.path.basename(std["url"]), install_dir) install(os.path.basename(std["url"]), install_dir)
pass pass

View file

@ -93,6 +93,7 @@ MOZSEARCH_ARCHIVE_BASENAME = $(PKG_BASENAME).mozsearch-index
MOZSEARCH_RUST_ANALYSIS_BASENAME = $(PKG_BASENAME).mozsearch-rust MOZSEARCH_RUST_ANALYSIS_BASENAME = $(PKG_BASENAME).mozsearch-rust
MOZSEARCH_RUST_STDLIB_BASENAME = $(PKG_BASENAME).mozsearch-rust-stdlib MOZSEARCH_RUST_STDLIB_BASENAME = $(PKG_BASENAME).mozsearch-rust-stdlib
MOZSEARCH_INCLUDEMAP_BASENAME = $(PKG_BASENAME).mozsearch-distinclude MOZSEARCH_INCLUDEMAP_BASENAME = $(PKG_BASENAME).mozsearch-distinclude
MOZSEARCH_SCIP_INDEX_BASENAME = $(PKG_BASENAME).mozsearch-scip-index
# Mozharness naming # Mozharness naming
MOZHARNESS_PACKAGE = mozharness.zip MOZHARNESS_PACKAGE = mozharness.zip

View file

@ -90,6 +90,14 @@ ifdef ENABLE_MOZSEARCH_PLUGIN
rustlib/$(RUST_TARGET)/analysis/ rustlib/src/ rustlib/$(RUST_TARGET)/analysis/ rustlib/src/
@echo 'Generating mozsearch distinclude map...' @echo 'Generating mozsearch distinclude map...'
cd $(topobjdir)/ && cp _build_manifests/install/dist_include '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map' cd $(topobjdir)/ && cp _build_manifests/install/dist_include '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map'
@echo 'Generating mozsearch scip index...'
$(RM) $(MOZSEARCH_SCIP_INDEX_BASENAME).zip
cd $(topsrcdir)/ && \
CARGO=$(MOZ_FETCHES_DIR)/rustc/bin/cargo \
RUSTC=$(MOZ_FETCHES_DIR)/rustc/bin/rustc \
$(MOZ_FETCHES_DIR)/rustc/bin/rust-analyzer scip . && \
zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_SCIP_INDEX_BASENAME).zip' \
index.scip
endif endif
ifeq (Darwin, $(OS_ARCH)) ifeq (Darwin, $(OS_ARCH))
@echo 'Generating macOS codesigning bundle ($(MACOS_CODESIGN_ARCHIVE_BASENAME).zip)' @echo 'Generating macOS codesigning bundle ($(MACOS_CODESIGN_ARCHIVE_BASENAME).zip)'

View file

@ -393,6 +393,7 @@ ifdef ENABLE_MOZSEARCH_PLUGIN
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip) UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip)
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_ANALYSIS_BASENAME).zip) UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_ANALYSIS_BASENAME).zip)
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_STDLIB_BASENAME).zip) UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_STDLIB_BASENAME).zip)
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_SCIP_INDEX_BASENAME).zip)
UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map) UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map)
endif endif