From 84bdc582ea9edebc844b0e25e18a16d22c1bc587 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 31 Aug 2024 01:36:40 +0300 Subject: feat(eaglemode/plugins): bootstrap Yandex Tracker plugin Bootstraps a plugin (that doesn't do anything yet) for accessing Yandex Tracker through Eagle Mode. This commit only initialises the plugin files, it doesn't actually do anything other than print the word "Loaded". API docs for future development: https://yandex.cloud/ru/docs/tracker/about-api The next steps will be to figure out the emModel classes and the threading model for fetching the remote data. Change-Id: Ifce8bc2a61c4fd0c4a591013acbf428a9f5803f8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12398 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tools/eaglemode/plugins/yatracker/default.nix | 18 +++++++ .../etc/emCore/FpPlugins/PlYaTracker.emFpPlugin | 6 +++ tools/eaglemode/plugins/yatracker/logo.webp | Bin 0 -> 13808 bytes .../plugins/yatracker/makers/PlYaTracker.maker.pm | 47 +++++++++++++++++ .../yatracker/src/PlYaTracker/PlYaTracker.cpp | 58 +++++++++++++++++++++ 5 files changed, 129 insertions(+) create mode 100644 tools/eaglemode/plugins/yatracker/default.nix create mode 100644 tools/eaglemode/plugins/yatracker/etc/emCore/FpPlugins/PlYaTracker.emFpPlugin create mode 100644 tools/eaglemode/plugins/yatracker/logo.webp create mode 100644 tools/eaglemode/plugins/yatracker/makers/PlYaTracker.maker.pm create mode 100644 tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp diff --git a/tools/eaglemode/plugins/yatracker/default.nix b/tools/eaglemode/plugins/yatracker/default.nix new file mode 100644 index 000000000000..3ffc42029a03 --- /dev/null +++ b/tools/eaglemode/plugins/yatracker/default.nix @@ -0,0 +1,18 @@ +{ depot, pkgs, ... }: + +let + em = depot.tools.eaglemode; + emSrc = with pkgs; srcOnly eaglemode; +in +(em.buildPlugin { + name = "yatracker"; + version = "canon"; + src = ./.; + target = "PlYaTracker"; +}).overrideAttrs (_: { + postInstall = '' + mkdir -p $out/icons + ${pkgs.imagemagick}/bin/convert $src/logo.webp $out/icons/yandex-tracker.tga + ''; +}) + diff --git a/tools/eaglemode/plugins/yatracker/etc/emCore/FpPlugins/PlYaTracker.emFpPlugin b/tools/eaglemode/plugins/yatracker/etc/emCore/FpPlugins/PlYaTracker.emFpPlugin new file mode 100644 index 000000000000..637878844709 --- /dev/null +++ b/tools/eaglemode/plugins/yatracker/etc/emCore/FpPlugins/PlYaTracker.emFpPlugin @@ -0,0 +1,6 @@ +#%rec:emFpPlugin%# + +FileTypes = { ".YaTracker" } +Priority = 1.0 +Library = "PlYaTracker" +Function = "PlYaTrackerPluginFunc" diff --git a/tools/eaglemode/plugins/yatracker/logo.webp b/tools/eaglemode/plugins/yatracker/logo.webp new file mode 100644 index 000000000000..460d57d72c33 Binary files /dev/null and b/tools/eaglemode/plugins/yatracker/logo.webp differ diff --git a/tools/eaglemode/plugins/yatracker/makers/PlYaTracker.maker.pm b/tools/eaglemode/plugins/yatracker/makers/PlYaTracker.maker.pm new file mode 100644 index 000000000000..ae954260a2d1 --- /dev/null +++ b/tools/eaglemode/plugins/yatracker/makers/PlYaTracker.maker.pm @@ -0,0 +1,47 @@ +package PlYaTracker; + +use strict; +use warnings; + +sub GetDependencies +{ + return ('emCore'); +} + +sub IsEssential +{ + return 0; +} + +sub GetFileHandlingRules +{ + return (); +} + +sub GetExtraBuildOptions +{ + return (); +} + +sub Build +{ + shift; + my %options=@_; + + system( + @{$options{'unicc_call'}}, + "--math", + "--rtti", + "--exceptions", + "--bin-dir" , "bin", + "--lib-dir" , "lib", + "--obj-dir" , "obj", + "--inc-search-dir", "include", + "--link" , "emCore", + "--type" , "dynlib", + "--name" , "PlYaTracker", + "src/PlYaTracker/PlYaTracker.cpp" + )==0 or return 0; + + return 1; +} diff --git a/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp b/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp new file mode 100644 index 000000000000..9bf05a17179f --- /dev/null +++ b/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +class PlYaTrackerConfig final : public emRecFileModel, public emStructRec { + public: + static emRef Acquire(emContext& context, + const emString& name, + bool common = true); + + virtual const char* GetFormatName() const; + + emStringRec URL; + emStringRec Token; + + protected: + PlYaTrackerConfig(emContext& context, const emString& name); +}; + +emRef PlYaTrackerConfig::Acquire(emContext& context, + const emString& name, + bool common) { + EM_IMPL_ACQUIRE(PlYaTrackerConfig, context, name, common) +} + +const char* PlYaTrackerConfig::GetFormatName() const { return "PlYaTracker"; } + +PlYaTrackerConfig::PlYaTrackerConfig(emContext& context, const emString& name) + : emRecFileModel(context, name), + emStructRec(), + URL(this, "URL"), + Token(this, "Token") { + PostConstruct(*this); +} + +class PlYaTrackerFilePanel : public emFilePanel { + public: + PlYaTrackerFilePanel(ParentArg parent, const emString& name, + emRef config); + + private: + emRef Config; +}; + +PlYaTrackerFilePanel::PlYaTrackerFilePanel(ParentArg parent, + const emString& name, + emRef config) + : emFilePanel(parent, name, config), Config(config) {} + +extern "C" { +emPanel* PlYaTrackerPluginFunc(emPanel::ParentArg parent, const emString& name, + const emString& path, emFpPlugin* plugin, + emString* errorBuf) { + return new PlYaTrackerFilePanel( + parent, name, PlYaTrackerConfig::Acquire(parent.GetRootContext(), path)); +} +} -- cgit 1.4.1