[SERVER-62736] Add support for static resources included with CPP binaries Created: 18/Jan/22  Updated: 03/Feb/22  Resolved: 03/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Anna Wawrzyniak Assignee: Anna Wawrzyniak
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-62735 Add unit test support for expected ou... Closed
Sprint: QE 2022-02-07, QE 2022-01-24
Participants:

 Description   

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;



 Comments   
Comment by Ethan Zhang (Inactive) [ 03/Feb/22 ]

anna.wawrzyniakshould we close this as a "won't do"?

Generated at Thu Feb 08 05:55:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.