Skip to content

Use Bazel mirror to download externals#17

Merged
davidzchen merged 1 commit into
bazelbuild:masterfrom
jart:bzmirror
Jul 21, 2016
Merged

Use Bazel mirror to download externals#17
davidzchen merged 1 commit into
bazelbuild:masterfrom
jart:bzmirror

Conversation

@jart
Copy link
Copy Markdown
Contributor

@jart jart commented Jul 17, 2016

I've mirrored your files for guaranteed reliability, courtesy of Google Cloud Storage.

In the future, you can mirror these files too with the following command. Although you need to ask @damienmg for write access to the bucket. Or just email me the URL you want mirrored and I'll happily do it.

bzmirror() {
  local url="${1:?url}"
  if [[ "${url}" =~ ^([^:]+):([^:]+):([^:]+)$ ]]; then
    url="http://repo1.maven.org/maven2/${BASH_REMATCH[1]//.//}/${BASH_REMATCH[2]}/${BASH_REMATCH[3]}/${BASH_REMATCH[2]}-${BASH_REMATCH[3]}.jar"
  fi
  local dest="gs://bazel-mirror/${url#http*//}"
  local desturl="http://bazel-mirror.storage.googleapis.com/${url#http*//}"
  local name="$(basename "${dest}")"
  wget -O "/tmp/${name}" "${url}" || return 1
  gsutil cp -a public-read "/tmp/${name}" "${dest}" || return 1
  gsutil setmeta -h 'Cache-Control:public, max-age=31536000' "${dest}" || return 1
  curl -I "${desturl}"
  echo
  sha256sum "/tmp/${name}"
  echo "${desturl}"
  rm "/tmp/${name}" || return 1
}

@davidzchen
Copy link
Copy Markdown
Member

LGTM. Thanks! Can you open a separate PR for updating the README to use http_archive?

@davidzchen davidzchen merged commit c53f816 into bazelbuild:master Jul 21, 2016
walter-zeromatter added a commit to walter-zeromatter/rules_rust that referenced this pull request Apr 17, 2026
…tc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (bazelbuild#17)
walter-zeromatter added a commit to walter-zeromatter/rules_rust that referenced this pull request May 8, 2026
…tc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (bazelbuild#17)
walter-zeromatter added a commit to walter-zeromatter/rules_rust that referenced this pull request May 8, 2026
)

* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (bazelbuild#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
walter-zeromatter added a commit to walter-zeromatter/rules_rust that referenced this pull request May 19, 2026
)

* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (bazelbuild#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants