Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62736

Add support for static resources included with CPP binaries

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • QE 2022-02-07, QE 2022-01-24

      Add new CppResource pseudo-builder that would allow for addition of arbitrary source files to the output cpp binary and support listing/retrieving contents of those files during execution.

      Proposed usage:

      SConscript file:
          env.CppResource(
              target='my_resources.cpp',
              exportname='mongo::my_namespace::MyResources',
              source=[
                  'A.txt', 
                  'B.png',
              ],
          )
      
      Cpp source code:
          #include "mongo/util/static_resources.h"
          extern const StaticResources mongo::my_namespace::MyResources;
          ...    // Get all the resources:
          const std::map<string, StringData>& resourceMap = mongo::my_namespace::MyResources.items();    // Get the contents of a specific resource.
          std::cout << "Resource contents:" << mongo::my_namespace::MyResources.getResourceByName("src/mongo/my_project_path/A.txt")->toString() << std::endl;
      

            Assignee:
            anna.wawrzyniak@mongodb.com Anna Wawrzyniak
            Reporter:
            anna.wawrzyniak@mongodb.com Anna Wawrzyniak
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: