RDKEMW-3106 : Ensure modules path works in all environments#17
RDKEMW-3106 : Ensure modules path works in all environments#17Sid2001-maker wants to merge 7 commits into
Conversation
Reason for change: Cleaned up the code Test Procedure: build should be successful. Risks: low Priority: P2
38e64c1 to
f890afe
Compare
Reason for change: Cleaned up the code Test Procedure: build should be successful. Risks: low Priority: P2
f890afe to
5e51018
Compare
|
Changes are good and validated with custom build. |
| virtual void onKeyPress(struct JavaScriptKeyDetails& details); | ||
| virtual void onKeyRelease(struct JavaScriptKeyDetails& details); | ||
|
|
||
| //newly added |
There was a problem hiding this comment.
Please remove the "newly added" comments - here and in the other places.
| virtual void onKeyRelease(struct JavaScriptKeyDetails& details); | ||
|
|
||
| //newly added | ||
| static void setEnvVariable(const char* name, const char* value); |
There was a problem hiding this comment.
We don't want this method.
|
|
||
| //newly added | ||
| static std::string sModulesPath; | ||
| std::string getModulesPath(); |
There was a problem hiding this comment.
should this be static method?
| JavaScriptContextBase::JavaScriptContextBase(JavaScriptContextFeatures& features, std::string url, IJavaScriptEngine* jsEngine): mApplicationUrl(url), mEngine(jsEngine), mEmbedThunderJS(features.mEmbedThunderJS), mEmbedWebBridge(features.mEmbedWebBridge), mEnableWebSockerServer(features.mEnableWebSockerServer), mModuleSettings(features.mModuleSettings) | ||
| { | ||
| //newly added | ||
| JavaScriptContextBase::setEnvVariable("JSRUNTIME_MODULES_PATH", ""); |
There was a problem hiding this comment.
We don;t want this method. Only we need to read this env variable JSRUNTIME_MODULES_PATH and should take priority than other modules path
| if (sThunderJSCode.empty()) | ||
| { | ||
| sThunderJSCode = readFile("modules/thunderJS.js"); | ||
| std::string ThunderJS= sModulesPath + "thunderJS.js" |
There was a problem hiding this comment.
Can we keep all append inside readFile method?
madanagopalt
left a comment
There was a problem hiding this comment.
kindly address comments. Also, keep PR heading with ticketnumber:<title>
2f4d144 to
0475bf3
Compare
Reason for change: Removed unwanted comments newly added Test Procedure: build should be successful. Risks: low Priority: P2
0475bf3 to
093e915
Compare
madanagopalt
left a comment
There was a problem hiding this comment.
We have some changes to address. I will explain in meeting
| home = PWD; | ||
| } | ||
| sModulesPath = home; | ||
| if(setenv("JSRUNTIME_MODULES_PATH",home.c_str(),1)==0){ |
There was a problem hiding this comment.
1, Perfrom getenv and use it as sModulesPath if environment is set
2,Else, set module path to pwd+/modules as written
3, Don;t want multiple if else
|
|
||
| JavaScriptContextBase::JavaScriptContextBase(JavaScriptContextFeatures& features, std::string url, IJavaScriptEngine* jsEngine): mApplicationUrl(url), mEngine(jsEngine), mEmbedThunderJS(features.mEmbedThunderJS), mEmbedWebBridge(features.mEmbedWebBridge), mEnableWebSockerServer(features.mEnableWebSockerServer), mModuleSettings(features.mModuleSettings) | ||
| { | ||
| getModulesPath(); |
There was a problem hiding this comment.
Rename as populateModulesPath
| std::ifstream src_file(file); | ||
| std::stringstream src_script; | ||
| src_script << src_file.rdbuf(); | ||
| if(src_script.str().empty()) |
There was a problem hiding this comment.
1, Get one argument to readFile isModule (by default true). Pass it false, when we are calling this api for running local file/application
2, This will avoid read to fail everytime for all modules fist time.
3, Also, if isModule is set, read the file after appending modulespath, else ready directly
madanagopalt
left a comment
There was a problem hiding this comment.
kindly look at comments
Reason for change: Cleaned up the code Test Procedure: build should be successful. Risks: low Priority: P2
Reason for change: Cleaned up the code Test Procedure: build should be successful. Risks: low Priority: P2
Reason for change: Removed unwanted comments newly added Test Procedure: build should be successful. Risks: low Priority: P2
Reason for change: Cleaned up the code Test Procedure: build should be successful. Risks: low Priority: P2
Fetches modules directory path in generic way