Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(JLLEnvs): try to load local Artifacts.toml if existed #372

Closed
wants to merge 1 commit into from

Conversation

johnnychen94
Copy link

@johnnychen94 johnnychen94 commented Jan 30, 2022

Almost certainly I get network issues when using Clang in China unless I set proxies. This PR works around it so I figured people might want to see this change.

julia> using Clang
ERROR: InitError: Failed to connect to raw.githubusercontent.com port 443: Connection refused while requesting https://raw.githubusercontent.com/JuliaPackaging/BinaryBuilderBase.jl/master/Artifacts.toml

This commit provides two changes:

  • By default, use the stable release version of Artifacts.toml provided by
    binarybuilderbase. previously it uses the master version, which can sometimes
    be breaking and troublesome.
  • it utilizes the local disk cache and thus pkg server so that we don't need to
    fetch resources from GitHub.com and thus is more friendly to users behind the
    firewall.

As a consequence of getting rid of the need to download from remote server,
this commit makes @time using Clang much faster: from 1.7s to 0.4s in Julia
1.7, macOS Intel i9-9880H.

Comment on lines 19 to 22
if haskey(ENV, "JULIA_CLANG_SHARDS_URL") && !isempty(get(ENV, "JULIA_CLANG_SHARDS_URL", ""))
merge!(JLL_ENV_SHARDS, Artifacts.load_artifacts_toml(ENV["JULIA_CLANG_SHARDS_URL"]))
else
merge!(JLL_ENV_SHARDS, Artifacts.load_artifacts_toml(Downloads.download(JLL_ENV_SHARDS_URL)))
return
end
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still keep the JULIA_CLANG_SHARDS_URL environment flag of the highest priority so that people can still debug with specific Artifacts.toml version.

@Gnimuc
Copy link
Member

Gnimuc commented Jan 31, 2022

I'm considering directly shipping this Artifact.toml in Clang.jl.

@melonedo
Copy link
Contributor

This is very nice! I have always manually redirected that Artifacts.toml to a local file before. Additionally, we can also avoid directly calling the Pkg.download_artifact function instead of Pkg.ensure_artifact_downloaded, which respects pkg mirror.

@johnnychen94
Copy link
Author

johnnychen94 commented Jan 31, 2022

I'm considering directly shipping this Artifact.toml in Clang.jl.

I've thought about this too, but then I feel it brings more future synchronization/maintenance work to do without CompatHelper-like CI tools. Thus I took this tricky version.

This commit provides two changes:

- By default, use the stable release version of `Artifacts.toml` provided by
  binarybuilderbase. previously it uses the master version, which can sometimes
  be breaking and troublesome.
- it utilizes the local disk cache and thus pkg server so that we don't need to
  fetch resources from GitHub.com and thus is more friendly to users behind the
  firewall.

As a consequence of getting rid of the need to download from remote server,
this commit makes `@time using Clang` much faster: from 1.7s to 0.4s in Julia
1.7, macOS Intel i9-9880H.
@Gnimuc
Copy link
Member

Gnimuc commented Feb 20, 2022

closed in favor of #377

@Gnimuc Gnimuc closed this Feb 20, 2022
@johnnychen94 johnnychen94 deleted the jc/JLLEnvs branch March 8, 2022 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants