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

[vcpkg] Add environment variable VCPKG_DEFAULT_BINARY_CACHE #12423

Merged
merged 8 commits into from
Aug 1, 2020

Conversation

Neumann-A
Copy link
Contributor

@Neumann-A Neumann-A commented Jul 14, 2020

Add an environment variable to reroute the binarychaching feature away from the users local data folder.

Somebody missed to add a user bailout from the default behavior ;)

Also:
Why the heck is that thing return const ExpectedS<fs::path>& of a static than using a lambda which returns ExpectedS<fs::path> which than again is in a function returning const ExpectedS<fs::path>&. Can we not agree to just return const ExpectedS<fs::path> for RVO instead of a function local static variable which gets turned into another function local static variable?

Docs? Not yet, somebody has to add docs for binary caching anyway in the future. I'll leave it to him/her;)

@JackBoosY JackBoosY self-assigned this Jul 14, 2020
@JackBoosY JackBoosY added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Jul 14, 2020
@ras0219
Copy link
Contributor

ras0219 commented Jul 14, 2020

From vcpkg help binarycaching:

> ./vcpkg help binarycaching
Vcpkg can cache compiled packages to accelerate restoration on a single machine or across the
network. This functionality is currently enabled by default and can be disabled by either passing
`--no-binarycaching` to every vcpkg command line or setting the environment variable
`VCPKG_FEATURE_FLAGS` to `-binarycaching`.

Once caching is enabled, it can be further configured by either passing `--binarysource=<source>`
options to every command line or setting the `VCPKG_BINARY_SOURCES` environment variable to a set of
sources (Ex: "<source>;<source>;..."). Command line sources are interpreted after environment
sources.

Valid source strings:
  clear                           Removes all previous sources
  default[,<rw>]                  Adds the default file-based location.
  files,<path>[,<rw>]             Adds a custom file-based location.
  nuget,<uri>[,<rw>]              Adds a NuGet-based source; equivalent to the `-Source` parameter
                                  of the NuGet CLI.
  nugetconfig,<path>[,<rw>]       Adds a NuGet-config-file-based source; equivalent to the `-Config`
                                  parameter of the NuGet CLI. This config should specify
                                  `defaultPushSource` for uploads.
  interactive                     Enables interactive credential management for some source types

The `<rw>` optional parameter for certain strings controls whether they will be consulted for
downloading binaries and whether on-demand builds will be uploaded to that remote. It can be
specified as 'read', 'write', or 'readwrite'.

So, the existing way to do exactly this is to define VCPKG_BINARY_SOURCES to clear;files,D:\archives,readwrite. Does this accomplish the desired behavior?

@strega-nil
Copy link
Contributor

@ras0219 you should be able to change the location of the default binary caches even without using this new binarysources thing.

@Neumann-A
Copy link
Contributor Author

@strega-nil: do i just need to rerun clang-format to resolve the conflict? Or will you resolve the conflicts?

@strega-nil
Copy link
Contributor

@Neumann-A yeah, it just needs to be LF and not CRLF.

@JackBoosY
Copy link
Contributor

@strega-nil I think we need to improve the error message.

@strega-nil
Copy link
Contributor

@JackBoosY yeah, I think you're right. I don't know how to get it to do what I want tho

@JackBoosY
Copy link
Contributor

@strega-nil I'll do that. Don't worry.

@Neumann-A
Copy link
Contributor Author

Neumann-A commented Jul 22, 2020

So, the existing way to do exactly this is to define VCPKG_BINARY_SOURCES to clear;files,D:\archives,readwrite. Does this accomplish the desired behavior?

@ras0219-msft: Either I am doing something wrong or this deactivates binary caching completly

i am doing something wrong. I copied your settings a bit too much. Found the cache on D: instead of E: where i expect it.

toolsrc/src/vcpkg/binarycaching.cpp Outdated Show resolved Hide resolved
toolsrc/src/vcpkg/binarycaching.cpp Outdated Show resolved Hide resolved
Neumann-A and others added 2 commits July 22, 2020 17:42
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
@JackBoosY
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@strega-nil
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@strega-nil
Copy link
Contributor

@Neumann-A can you rename VCPKG_BINARY_CACHE to VCPKG_DEFAULT_BINARY_CACHE?

@Neumann-A Neumann-A changed the title [vcpkg] Add environment variable VCPKG_BINARY_CACHE [vcpkg] Add environment variable VCPKG_DEFAULT_BINARY_CACHE Jul 31, 2020
@strega-nil strega-nil merged commit 4ab2180 into microsoft:master Aug 1, 2020
@strega-nil
Copy link
Contributor

Thanks @Neumann-A !

@Neumann-A Neumann-A deleted the add_env_vcpkg_binary_cache branch August 1, 2020 21:15
hellozee pushed a commit to hellozee/vcpkg that referenced this pull request Sep 11, 2020
…t#12423)

* [vcpkg] Add environment variable VCPKG_BINARY_CACHE

* apply clang-format

* change line ending

* Update toolsrc/src/vcpkg/binarycaching.cpp

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* Remove comment

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* rename to VCPKG_DEFAULT_BINARY_CACHE

* apply clang format

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
strega-nil added a commit to strega-nil/vcpkg that referenced this pull request May 5, 2021
…t#12423)

* [vcpkg] Add environment variable VCPKG_BINARY_CACHE

* apply clang-format

* change line ending

* Update toolsrc/src/vcpkg/binarycaching.cpp

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* Remove comment

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* rename to VCPKG_DEFAULT_BINARY_CACHE

* apply clang format

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants