Conversation
|
@microsoft-github-policy-service agree company="Adobe" |
2639150 to
1c5bfcc
Compare
Working Proof of Concept (POC)Here is a working POC demonstrating the proposed workflow. By adding the following to "editable-ports": {
"path": "editable-ports",
"ports": [
"libpng"
]
}You get a directory in
Internal LogicWe defined 3 new internal variables:
This is a POC to drive future discussions and enhancements, but it proves the feasibility of this approach and outlines what is needed. Capabilities
Current Limitations
All of these cases can be enhanced, but the priority was to demonstrate that this is a viable technical direction. |
Updates
This fixes the Dirty Install State and Global Flag point described before. |
Updates
Limitations left:
|
98b36c4 to
e5a163a
Compare
|
Pushed a cleaned up version. Mostly tweaks and fixes. |
e5a163a to
df961ff
Compare
df961ff to
b1de47f
Compare
This commit modifies the install command to preserve timestamps of unmodified files. This is useful to avoid useless rebuilds in the consuming projects: before this change, all headers were touched even if a single one was modified, and thus timstamp-based build systems ended up recompile many files unnecessarily. The change is implemented by stashing files into a temporary folder instead of deleting them, installing as usual then comparing the content of the newly installed files with the stashed ones. If the content is identical, the timestamp of the new file is updated to match the stashed one, behaving as-if the file was never replaced. Doing it this way guarantees that ports are built with a clean install tree. Note that this commit removes the use of hard-links: when installing a file as a hard-link, we end up with a timestamp in the install tree that matches the original file, which can be much older. This leads to build systems not being aware of modifications (see microsoft#1899). With this commit, files are always copied, thereby ensuring that they will get a "now" timestamp on first install.
This commit introduces support for editing ports and sources (in manifest mode). The following changes were made: - add "editable-ports" field to vcpkg.json, to allow specifying a destination folder for the editable ports and the list of ports to edit. - when installing an editable port for the first time, copy the port to the editable ports folder, and use this (possibly modified) copy as an overlay port on subsequent runs. - disable binary caching for editable ports, to ensure they are always built from source and to avoid polluting the cache with possibly incorrect artifacts (and/or artifacts of intermediate builds that will never be reused). - when building an editable port, use a build directory inside the editable port folder. - for computing the ABI hash of an editable port, include the sources folder from the editable port folder, which will contain checked out sources. This ensure that the port and their dependencies will be rebuilt when sources are modified. - mark editable ports and their dependencies with a flag to indicate that they must be built incrementally (VCPKG_EDITABLE_SUBTREE). - forward editable information through cmake variables, for consumption by `vcpkg-from-git*` scripts and `vcpkg-cmake` ports. In addition to those changes in `vcpkg-tool`, the feature also require the following changes in `vcpkg`: - hook `vcpkg-from-git*` scripts to delegate the download to a separate script that will clone the repo instead of downloading an archive. - modify `vcpkg_cmake_configure` to do incremental builds of editable ports.
b1de47f to
1b7ab93
Compare
|
Somewhat repeating what I said over email: The big problem with this feature as presented is that we effectively are forced to rebuild the universe of dependencies with this, because things that are In particular, just not blowing away the sources is insufficient to achieve the outcome you're going for here, due to the interaction between ports and the installed tree. The installed tree is a shared resource that is both an input and output of the build and install process. Ports don't expect to have the bits they install already be installed, and ports do not usually have dependencies wired up correctly for incremental builds. That is, given port As we described over email if the feature as proposed can be made to work we would be happy with it in principle but we think a writeup of how that end to end scenario is supposed to work needs to happen before we should merge this part in isolation. |
|
If I understand correctly, the main goal of this PR is to be able to create and test patches without triggering a world rebuild. |
The problem is that most builds are not prepared for a previous version of themselves to already be installed. That is, when building
We already have |
|
Hello
This PR does not rebuild the universe. Editable ports have an ABI.
The outcome is achieved, this PR is used by our teams without major issue so far and it does everything we wanted it to do.
That's why we stash the install tree of the port before installing it, no issue there. It does not break incremental ability as the timestamps are restored. We don't do it for it dependencies though, unsure how needed it is but can be added. I understand that you may not have time to take a serious look at it, but most of our concerns were already covered, the implementation ... just works. There may be some caveats we did not think through, but we are already benefiting from the enhanced workflow in our daily work. |
AFAICT the actual topic is the universe of reverse dependencies, and editable ports not having an ABI hash.
|
They are tracked. Commands.build.cpp 1532 : abi_tag_entries.emplace_back("editable_sources", "0");
We specifically do not want to have binary artifact for editable ports, as those would pollute the cache. So the caching is disabled on purpose.
This is actually something wanted, if you edit zlib, you want to rebuild all zlib dependencies. And those are being correctly rebuild, incrementally, and also incrementally installed, preserving timestamps. As far as we have seen, there is no unnecessary neither missing operations that is happening during the whole workflow. |
The problem is that the ABI hash |
|
So IIUC the new code block walks through the source dir ( |
|
Yes. |
Proposed Workflow ("Editable Mode")
I propose a formal "Editable" workflow integrated into Manifest Mode.
This is an ongoing draft of my initial experimentations and is not (yet) a functional proposal.
1. Setup
I am working on
MyProjdefined byvcpkg.json.2. Materialization
I signal to vcpkg that
zlibshould be editable (via a command, environment variable, or configuration).Expected outcome:
zlibbased on the current manifest, fetches the source (preferably viagit cloneto preserve history, or source extraction), and places it in a local user-writable directory (e.g.,./vcpkg_edits/zlib).zlibport, effectively creating a temporary local overlay.3. Iteration
./vcpkg_edits/zlib.MyProj(e.g.,cmake --build .).Crucial Change (The "Dirty Build"):
MyProj) that a dependency has changed, triggering a non-standard incremental build/re-link of the consumer project against the updated binary.4. Completion
I validate my changes. I can then commit the changes (if git history was preserved or added) or generate a patch. I disable the editable state, and vcpkg returns to strict manifest compliance.
The Golden Rule: "Whatever happens in editable mode, stays in editable mode." No impact on CI, registry, shared code. Local only.