Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ __pycache__/
!triplets/arm64-windows.cmake
!triplets/x64-linux.cmake
!triplets/x64-osx.cmake
!triplets/x64-android.cmake
!triplets/x86-android.cmake
!triplets/arm-android.cmake
!triplets/arm64-android.cmake
#ignore custom triplets
*.exe
*.zip
Expand All @@ -319,3 +323,5 @@ __pycache__/
# vcpkg - End
############################################################
archives
.DS_Store
prefab/
78 changes: 78 additions & 0 deletions toolsrc/include/vcpkg/export.prefab.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#pragma once

#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>

#include <vector>

namespace vcpkg::Export::Prefab
{
constexpr int kFragmentSize = 3;
struct Options
{
Optional<std::string> maybe_group_id;
Optional<std::string> maybe_artifact_id;
Optional<std::string> maybe_version;
Comment thread
atkawa7 marked this conversation as resolved.
Optional<std::string> maybe_min_sdk;
Optional<std::string> maybe_target_sdk;
Optional<std::string> maybe_ndk;
};
struct NdkVersion
{
NdkVersion(int _major, int _minor, int _patch) : m_major{_major},
m_minor{_minor},
m_patch{_patch}{
}
int major() { return this->m_major; }
int minor() { return this->m_minor; }
int patch() { return this->m_patch; }
std::string to_string();
void to_string(std::string& out);

private:
int m_major;
int m_minor;
int m_patch;
};

struct ABIMetadata
{
std::string abi;
int api;
int ndk;
std::string stl;
std::string to_string();
};

struct PlatformModuleMetadata
{
std::vector<std::string> export_libraries;
std::string library_name;
std::string to_json();
};

struct ModuleMetadata
{
std::vector<std::string> export_libraries;
std::string library_name;
PlatformModuleMetadata android;
std::string to_json();
};

struct PackageMetadata
{
std::string name;
int schema;
std::vector<std::string> dependencies;
std::string version;
std::string to_json();
};



void do_export(const std::vector<Dependencies::ExportPlanAction>& export_plan,
const VcpkgPaths& paths,
const Options& prefab_options);
Optional<std::string> find_ndk_version(const std::string &content);
Optional<NdkVersion> to_version(const std::string &version);
}
5 changes: 5 additions & 0 deletions toolsrc/include/vcpkg/triplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ namespace vcpkg
static const Triplet ARM64_UWP;
static const Triplet ARM_WINDOWS;
static const Triplet ARM64_WINDOWS;

static const Triplet ARM_ANDROID;
static const Triplet ARM64_ANDROID;
static const Triplet X86_ANDROID;
Comment thread
atkawa7 marked this conversation as resolved.
static const Triplet X64_ANDROID;

const std::string& canonical_name() const;
const std::string& to_string() const;
Expand Down
2 changes: 2 additions & 0 deletions toolsrc/include/vcpkg/vcpkgpaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace vcpkg
namespace Tools
{
static const std::string SEVEN_ZIP = "7zip";
static const std::string SEVEN_ZIP_ALT = "7z";
static const std::string MAVEN = "mvn";
static const std::string CMAKE = "cmake";
static const std::string GIT = "git";
static const std::string NINJA = "ninja";
Expand Down
46 changes: 42 additions & 4 deletions toolsrc/src/vcpkg/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/export.chocolatey.h>
#include <vcpkg/export.prefab.h>
#include <vcpkg/export.h>
#include <vcpkg/export.ifw.h>
#include <vcpkg/help.h>
Expand Down Expand Up @@ -193,6 +194,7 @@ namespace vcpkg::Export
{
constexpr const ArchiveFormat ZIP(ArchiveFormat::BackingEnum::ZIP, "zip", "zip");
constexpr const ArchiveFormat SEVEN_ZIP(ArchiveFormat::BackingEnum::SEVEN_ZIP, "7z", "7zip");
constexpr const ArchiveFormat AAR(ArchiveFormat::BackingEnum::ZIP, "aar", "zip");
}

static fs::path do_archive_export(const VcpkgPaths& paths,
Expand Down Expand Up @@ -260,13 +262,15 @@ namespace vcpkg::Export
bool zip = false;
bool seven_zip = false;
bool chocolatey = false;
bool prefab = false;

Optional<std::string> maybe_output;

Optional<std::string> maybe_nuget_id;
Optional<std::string> maybe_nuget_version;

IFW::Options ifw_options;
Prefab::Options prefab_options;
Chocolatey::Options chocolatey_options;
std::vector<PackageSpec> specs;
};
Expand All @@ -289,17 +293,28 @@ namespace vcpkg::Export
static constexpr StringLiteral OPTION_CHOCOLATEY_MAINTAINER = "--x-maintainer";
static constexpr StringLiteral OPTION_CHOCOLATEY_VERSION_SUFFIX = "--x-version-suffix";

static constexpr std::array<CommandSwitch, 7> EXPORT_SWITCHES = {{
//prefab
static constexpr StringLiteral OPTION_PREFAB = "--prefab";
static constexpr StringLiteral OPTION_PREFAB_GROUP_ID = "--prefab-group-id";
static constexpr StringLiteral OPTION_PREFAB_ARTIFACT_ID = "--prefab-artifact-id";
static constexpr StringLiteral OPTION_PREFAB_VERSION = "--prefab-version";
static constexpr StringLiteral OPTION_PREFAB_SDK_MIN_VERSION = "--prefab-min-sdk";
static constexpr StringLiteral OPTION_PREFAB_SDK_TARGET_VERSION = "--prefab-target-sdk";
static constexpr StringLiteral OPTION_PREFAB_NDK_VERSION = "--prefab-ndk";
Comment thread
atkawa7 marked this conversation as resolved.
Outdated


static constexpr std::array<CommandSwitch, 8> EXPORT_SWITCHES = {{
{OPTION_DRY_RUN, "Do not actually export"},
{OPTION_RAW, "Export to an uncompressed directory"},
{OPTION_NUGET, "Export a NuGet package"},
{OPTION_IFW, "Export to an IFW-based installer"},
{OPTION_ZIP, "Export to a zip file"},
{OPTION_SEVEN_ZIP, "Export to a 7zip (.7z) file"},
{OPTION_CHOCOLATEY, "Export a Chocolatey package (experimental feature)"},
{OPTION_PREFAB, "Export to Prefab format"},
}};

static constexpr std::array<CommandSetting, 10> EXPORT_SETTINGS = {{
static constexpr std::array<CommandSetting, 16> EXPORT_SETTINGS = {{
{OPTION_OUTPUT, "Specify the output name (used to construct filename)"},
{OPTION_NUGET_ID, "Specify the id for the exported NuGet package (overrides --output)"},
{OPTION_NUGET_VERSION, "Specify the version for the exported NuGet package"},
Expand All @@ -312,6 +327,13 @@ namespace vcpkg::Export
"Specify the maintainer for the exported Chocolatey package (experimental feature)"},
{OPTION_CHOCOLATEY_VERSION_SUFFIX,
"Specify the version suffix to add for the exported Chocolatey package (experimental feature)"},
{OPTION_PREFAB_GROUP_ID, "GroupId uniquely identifies your project according maven specifications"},
{OPTION_PREFAB_ARTIFACT_ID, "Artifact Id is the name of the project according maven specifications"},
{OPTION_PREFAB_VERSION, "Version is the name of the project according maven specifications"},
Comment thread
atkawa7 marked this conversation as resolved.
{OPTION_PREFAB_SDK_MIN_VERSION, "Android minimum supported sdk version"},
{OPTION_PREFAB_SDK_TARGET_VERSION, "Android target sdk version"},
{OPTION_PREFAB_NDK_VERSION, "Ndk version"},

}};

const CommandStructure COMMAND_STRUCTURE = {
Expand Down Expand Up @@ -339,13 +361,14 @@ namespace vcpkg::Export
ret.zip = options.switches.find(OPTION_ZIP) != options.switches.cend();
ret.seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend();
ret.chocolatey = options.switches.find(OPTION_CHOCOLATEY) != options.switches.cend();
ret.prefab = options.switches.find(OPTION_PREFAB) != options.switches.cend();

ret.maybe_output = maybe_lookup(options.settings, OPTION_OUTPUT);

if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run && !ret.chocolatey)
if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run && !ret.chocolatey && !ret.prefab)
{
System::print2(System::Color::error,
"Must provide at least one export type: --raw --nuget --ifw --zip --7zip --chocolatey\n");
"Must provide at least one export type: --raw --nuget --ifw --zip --7zip --chocolatey --prefab\n");
System::print2(COMMAND_STRUCTURE.example_text);
Checks::exit_fail(VCPKG_LINE_INFO);
}
Expand Down Expand Up @@ -396,6 +419,17 @@ namespace vcpkg::Export
{OPTION_IFW_CONFIG_FILE_PATH, ret.ifw_options.maybe_config_file_path},
{OPTION_IFW_INSTALLER_FILE_PATH, ret.ifw_options.maybe_installer_file_path},
});

options_implies(OPTION_PREFAB,
ret.prefab,
{
{OPTION_PREFAB_ARTIFACT_ID, ret.prefab_options.maybe_artifact_id},
{OPTION_PREFAB_GROUP_ID, ret.prefab_options.maybe_group_id},
{OPTION_PREFAB_NDK_VERSION, ret.prefab_options.maybe_ndk},
{OPTION_PREFAB_SDK_MIN_VERSION, ret.prefab_options.maybe_min_sdk},
{OPTION_PREFAB_SDK_TARGET_VERSION, ret.prefab_options.maybe_target_sdk},
{OPTION_PREFAB_VERSION, ret.prefab_options.maybe_version},
});

options_implies(OPTION_CHOCOLATEY,
ret.chocolatey,
Expand Down Expand Up @@ -585,6 +619,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
Chocolatey::do_export(export_plan, paths, opts.chocolatey_options);
}

if(opts.prefab){
Prefab::do_export(export_plan, paths, opts.prefab_options);
}

Checks::exit_success(VCPKG_LINE_INFO);
}
}
Loading