Tutorial: Publish packages to a private vcpkg registry using Git
Статия
You can create your own private registry of packages to consume via vcpkg using Git. Private
registries are ideal if you want to use private libraries or want to make non-public modifications
to existing packages. You have full control over your packages' versions and contents, so there's
really no limit on what you can put in a private registry.
vcpkg's Git-based registries are Git repositories with a specific layout that vcpkg understands.
Initialize a Git registry:
Console
mkdir vcpkg-registry
cd vcpkg-registry
git init
2 - Create the registry layout
A vcpkg Git-based registry requires the following:
a folder named ports to contain the registry's ports,
a folder named versions to contain the versions database,
a file named baseline.json in the versions folder.
Your repository can contain any other files you want, for example: scripts, a LICENSE file, a README.md
file, documentation, etc.
1 - Create the ports and versions folders:
Console
mkdir ports
mkdir versions
2 - Create a file named baseline.json in the versions folder with the following contents:
JSON
{
"default": {}
}
The minimal valid baseline.json file should include the above contents. Read the versioning
documentation to learn more about the baseline.json file and the versions
database.
Optionally, if you have a remote Git repository set up, this is a good point to push your changes.
Console
git remote add origin https://example.com/vcpkg-registry.git
git push --set-upstream origin HEAD
3 - Add ports to the registry
Copy all your package ports in the ports folder in the registry. Each port must have its own
directory containing at least a vcpkg.json file and a portfile.cmake file. Learn more about
creating ports in the tutorial on packaging GitHub
repositories.
Each port in the registry must have a corresponding version file. Version files are generated by
the vcpkg x-add-version command. This command also updates the baseline entry for each port in
version/baseline.json.
To update the versions database for all your ports at once, run:
The --x-builtin-ports-root and --x-builtin-registry-versions-dir are redirection options.
Normally, the x-add-version command operates on vcpkg's built-in registry; but by using the
redirection options, it is possible to use the command on local Git registries.
The --all option makes vcpkg scan the ports directory for all available ports and updates them
all at once. Lastly, the --verbose option makes the command print each operation it executes to
standard output, you can suppress the output by removing this option.
The x-add-version requires that all port changes have been committed to the registry's Git
repository. Read the [x-add-version command] documentation to learn more.
Източникът за това съдържание може да бъде намерен в GitHub, където можете също да създавате и преглеждате проблеми и да изтегляте искания. За повече информация вижте нашето ръководство за сътрудник.
Обратна връзка за vcpkg
vcpkg е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Work with reusable Bicep modules by using Bicep registries. Create a private registry for your organization. Publish and consume modules by using your organization's registry.