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

manifest install: Cache compiler information for change detection #362

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
aac20fc
manifest install: Add option to check stamp file
autoantwort Feb 17, 2022
9139104
Merge branch 'main' into check-stamp
autoantwort Apr 24, 2022
5db2fb8
Check last_write_times instead of file hashes
autoantwort Apr 24, 2022
35bff02
Non apple unix
autoantwort Apr 24, 2022
944317d
Fix warning
autoantwort Apr 24, 2022
ee3d870
Format
autoantwort Apr 25, 2022
1848311
Merge branch 'main' into check-stamp
autoantwort Jun 2, 2022
d42a431
Merge branch 'main' into check-stamp
autoantwort Jun 9, 2022
bec26c8
Merge branch 'main' into check-stamp
autoantwort Jun 15, 2022
21decee
Merge branch 'main' into check-stamp
autoantwort Aug 9, 2022
d6321f4
Trigger Build
autoantwort Aug 9, 2022
446fc4f
Merge branch 'main' into check-stamp
autoantwort Aug 13, 2022
0fe5b17
Merge branch 'main' into check-stamp
autoantwort Oct 1, 2022
2e6b46c
Merge branch 'main' into check-stamp
autoantwort Oct 7, 2022
8e2a24d
Implement Compiler Info Cache
autoantwort Oct 21, 2022
1a20637
remove check-stamp-file code
autoantwort Oct 23, 2022
2589952
no white space changes
autoantwort Oct 23, 2022
58acd5a
Merge branch 'main' into check-stamp
autoantwort Oct 23, 2022
7b799c5
Merge branch 'main' into check-stamp
autoantwort Oct 28, 2022
e919aa1
Move detect_compiler files to source code
autoantwort Oct 30, 2022
2d3b228
Merge branch 'main' into check-stamp
autoantwort Oct 30, 2022
6d93b3a
Change last_write_time check from <= to !=
autoantwort Oct 30, 2022
3c10a82
fix wrong comparison
autoantwort Oct 31, 2022
b06227c
Merge branch 'main' into check-stamp
autoantwort Nov 9, 2022
c567f17
Merge branch 'main' into check-stamp
autoantwort Dec 21, 2022
2571fea
Merge branch 'main' into check-stamp
autoantwort Feb 20, 2023
84a45f5
Merge branch 'main' into check-stamp
autoantwort Mar 7, 2023
5933fcd
Merge branch 'main' into check-stamp
autoantwort Apr 6, 2023
56e7755
Merge branch 'main' into check-stamp
autoantwort Oct 12, 2023
5ccabbc
Merge branch 'main' into check-stamp
autoantwort Oct 12, 2023
d39e4d7
Merge branch 'main' into check-stamp
autoantwort Dec 13, 2023
0df3ea5
Merge branch 'main' into check-stamp
autoantwort Dec 25, 2024
6c940e5
Only use the cache for change detection. Never use cached compiler in…
autoantwort Jan 2, 2025
371e0f0
Merge branch 'main' into check-stamp
autoantwort Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ namespace vcpkg
virtual FileType symlink_status(const Path& target, std::error_code& ec) const = 0;
FileType symlink_status(const Path& target, LineInfo li) const noexcept;

virtual int64_t last_write_time(const Path& target, std::error_code& ec) const = 0;
int64_t last_write_time(const Path& target, LineInfo li) const noexcept;

// absolute/system_complete + lexically_normal + fixup_win32_path_case
// we don't use real canonical due to issues like:
// https://github.com/microsoft/vcpkg/issues/16614 (canonical breaking on some older Windows Server containers)
Expand Down
10 changes: 10 additions & 0 deletions include/vcpkg/base/jsonreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ namespace vcpkg::Json
static const NaturalNumberDeserializer instance;
};

struct Int64Deserializer final : IDeserializer<int64_t>
{
LocalizedString type_name() const override;

Optional<int64_t> visit_integer(Reader&, int64_t value) const override { return value; }

static Int64Deserializer instance;
};

struct BooleanDeserializer final : IDeserializer<bool>
{
virtual LocalizedString type_name() const override;
Expand Down Expand Up @@ -358,4 +367,5 @@ namespace vcpkg::Json
virtual Optional<std::string> visit_string(Json::Reader&, StringView sv) const override;
static const FeatureNameDeserializer instance;
};

}
1 change: 1 addition & 0 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ DECLARE_MESSAGE(AndroidHomeDirMissingProps,
"source.properties missing in {env_var} directory: {path}")
DECLARE_MESSAGE(AnExactVersionString, (), "", "an exact version string")
DECLARE_MESSAGE(AnIdentifer, (), "", "an identifier")
DECLARE_MESSAGE(AnInt64, (), "", "a 64-bit integer")
DECLARE_MESSAGE(AnObjectContainingVcpkgArtifactsMetadata,
(),
"'vcpkg-artifacts' is the name of the product feature and should not be localized",
Expand Down
2 changes: 2 additions & 0 deletions include/vcpkg/commands.build.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ namespace vcpkg
std::string id;
std::string version;
std::string hash;
Path c_compiler_path;
Path cxx_compiler_path;
};

struct AbiInfo
Expand Down
4 changes: 4 additions & 0 deletions include/vcpkg/installedpaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ namespace vcpkg
Path vcpkg_dir_updates() const { return vcpkg_dir() / "updates"; }
Path lockfile_path() const { return vcpkg_dir() / "vcpkg-lock.json"; }
Path triplet_dir(Triplet t) const { return m_root / t.canonical_name(); }
Path compiler_info_cache_file(Triplet t) const
{
return vcpkg_dir() / "compiler_info_cache" / t.canonical_name();
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
}
Path share_dir(const PackageSpec& p) const { return triplet_dir(p.triplet()) / "share" / p.name(); }
Path usage_file(const PackageSpec& p) const { return share_dir(p) / "usage"; }
Path vcpkg_port_config_cmake(const PackageSpec& p) const { return share_dir(p) / "vcpkg-port-config.cmake"; }
Expand Down
1 change: 1 addition & 0 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"AnArtifactsRegistry": "an artifacts registry",
"AnExactVersionString": "an exact version string",
"AnIdentifer": "an identifier",
"AnInt64": "a 64-bit integer",
"AnObjectContainingVcpkgArtifactsMetadata": "an object containing vcpkg-artifacts metadata",
"_AnObjectContainingVcpkgArtifactsMetadata.comment": "'vcpkg-artifacts' is the name of the product feature and should not be localized",
"AnOverlayPath": "an overlay path",
Expand Down
34 changes: 34 additions & 0 deletions src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,18 @@ namespace vcpkg
return result;
}

int64_t ReadOnlyFilesystem::last_write_time(const Path& target, LineInfo li) const noexcept
{
std::error_code ec;
auto result = this->last_write_time(target, ec);
if (ec)
{
exit_filesystem_call_error(li, ec, __func__, {target});
}

return result;
}

Path ReadOnlyFilesystem::almost_canonical(const Path& target, LineInfo li) const
{
std::error_code ec;
Expand Down Expand Up @@ -2849,6 +2861,28 @@ namespace vcpkg
#endif // ^^^ !_WIN32
}

virtual int64_t last_write_time(const Path& target, std::error_code& ec) const override
{
#if defined(_WIN32)
auto result = stdfs::last_write_time(to_stdfs_path(target), ec);
return result.time_since_epoch().count();
#else // ^^^ _WIN32 // !_WIN32 vvv
struct stat s;
if (::lstat(target.c_str(), &s) == 0)
{
ec.clear();
#ifdef __APPLE__
return s.st_mtimespec.tv_sec * 1'000'000'000 + s.st_mtimespec.tv_nsec;
#else
return s.st_mtim.tv_sec * 1'000'000'000 + s.st_mtim.tv_nsec;
#endif
}

ec.assign(errno, std::generic_category());
return {};
#endif // ^^^ !_WIN32
}

virtual Path absolute(const Path& target, std::error_code& ec) const override
{
#if defined(_WIN32)
Expand Down
4 changes: 4 additions & 0 deletions src/vcpkg/base/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,10 @@ namespace vcpkg::Json

const NaturalNumberDeserializer NaturalNumberDeserializer::instance;

LocalizedString Int64Deserializer::type_name() const { return msg::format(msgAnInt64); }

Int64Deserializer Int64Deserializer::instance;

LocalizedString BooleanDeserializer::type_name() const { return msg::format(msgABoolean); }

Optional<bool> BooleanDeserializer::visit_boolean(Reader&, bool b) const { return b; }
Expand Down
Loading