NDEVR
API Documentation
CheckoutCode.h
1#pragma once
2#include <NDEVR/BuildAction.h>
3#include <NDEVR/Translator.h>
4#include <NDEVR/QTModelManager.h>
5#include <NDEVR/Scene.h>
6#include <NDEVR/ShowPropertiesSettings.h>
7#include "DeveloperVariables.h"
8#include "BuildActionDefinition.h"
9namespace NDEVR
10{
14 {
15 public:
19 static void CheckoutSource(QTModelManager* manager, PopupInfo info)
20 {
21 BuildActionDefinition workflow(Scene(_t("Checkout Source")));
23 workflow.set<NDPOC::name>(_t("Checkout Source"));
24
25 BuildActionDefinition git(workflow.createChild());
27 file.expandEnvironmentalVars();
28 if (!file.exists())
29 git.setupAsGitClone(file, "https://git-codecommit.us-east-2.amazonaws.com/v1/repos/NDEVR_Source", "b2023");
30 else
31 git.setupAsGitPull(File("$(NDEVR_SOURCE_DIR)"));
32
33 BuildActionDefinition run_setup(workflow.createChild());
34 run_setup.setupAsRun(File("$(NDEVR_SOURCE_DIR)/SetupEnvironment.bat"));
35
36 AddAndShow(workflow, manager, info);
37
38 }
39
42 static void CheckoutAPI(QTModelManager* manager, PopupInfo info)
43 {
44 BuildActionDefinition workflow(Scene(_t("Checkout API")));
46 workflow.set<NDPOC::name>(_t("Checkout API"));
47 AddAndShow(workflow, manager, info);
48 }
49
52 static void GenerateOutput(QTModelManager* manager, PopupInfo info)
53 {
54 BuildActionDefinition workflow(Scene(_t("Generate Output")));
56 workflow.set<NDPOC::name>(_t("Generate Output"));
57 AddAndShow(workflow, manager, info);
58 }
59
62 static void GeneratePKG(QTModelManager* manager, PopupInfo info)
63 {
64 BuildActionDefinition workflow(Scene(_t("Generate Package")));
66 workflow.set<NDPOC::name>(_t("Generate Package"));
67 AddAndShow(workflow, manager, info);
68 }
69
73 static void AddAndShow(BuildActionDefinition& def, QTModelManager* manager, PopupInfo info)
74 {
76 //def.setLaunchOnShow(true);
77 {
78 WLock lock(manager->writeLock());
79 manager->addModel(def);
80 }
81 ShowPropertiesSettings settings(def.get<NDPO::guid>());
83 settings.popup_origin = info;
84 settings.popup_origin.closable = true;
85 manager->ShowProperties(settings);
86 }
87 };
88}
A Model subclass that defines a single build action or workflow step, holding its action type,...
void setOnFailureAction(const OnFailureAction &action)
Sets the on-failure behavior.
void setAction(const BuildAction &action)
Sets the build action type.
void setupAsRun(const File &location, const StringView &arguments=StringView())
Configures this action as a run operation.
Provides static helper methods that create and display build action workflows for common source check...
static void CheckoutSource(QTModelManager *manager, PopupInfo info)
Creates and displays a workflow to clone or pull the NDEVR source repository.
static void AddAndShow(BuildActionDefinition &def, QTModelManager *manager, PopupInfo info)
Adds a build action definition to the model manager and shows its properties dialog.
static void GeneratePKG(QTModelManager *manager, PopupInfo info)
Creates and displays a workflow to generate an installer package.
static void CheckoutAPI(QTModelManager *manager, PopupInfo info)
Creates and displays a workflow to download the NDEVR API.
static void GenerateOutput(QTModelManager *manager, PopupInfo info)
Creates and displays a workflow to generate output files.
WLock writeLock() const
Acquires an exclusive write lock on the design object store.
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
void set(t_property_type property, const t_type &value)
Sets a property value in the database.
static EnvironmentalVariable ndevr_source_directory
Environment variable for the NDEVR source directory.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Model createChild()
Creates a new child model and appends it to this model's child list.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
virtual void ShowProperties(const ShowPropertiesSettings &settings)
Shows a properties dialog for a design object.
virtual void addModel(Model object) override
Adds a model to the manager and emits appropriate signals.
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Scene.h:52
Used to lock a particular variable for writing.
Definition RWLock.h:272
The primary namespace for the NDEVR SDK.
@ e_installer_builder
Builds an installer package.
@ e_workflow
A container action that executes child actions sequentially.
@ e_download_api
Downloads the NDEVR API.
@ e_generate_out
Generates the output directory.
@ e_stop_workflow
Stop the entire workflow.
@ name
The calculated/translated display name.
@ guid
A 128-bit globally unique identifier for the object.
@ file
The source file path associated with this object.
@ e_no_decoration
Dialog without any button decorations.
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16
bool closable
Whether the popup can be closed by the user.
Definition PopupInfo.h:42
Stores settings for setting up and displaying a DesignObjectDialog such as whether the dialog is part...
void setupForStyle(DesignDialogStyle style)
Configures the button titles and icons based on the given dialog style.
PopupInfo popup_origin
The popup positioning and display information.