Implement ChakraBridge in C++ (#584)
* feat(ChakraBridge) - Initial commit * feat(ChakraBridge) - Additional features * feat(ChakraBridge) - Add all major functions * feat(ChakraBridge) - removing db file * feat(ChakraBridge) - Add public facing class * feat(ChakraBridge) - Add get/set global variables * feat(ChakraBridge) - Removing JsonValue^ * feat(ChakraBridge) - Adding LoadFromScript * feat(ChakraBridge) - Updating gitignore * feat(ChakraBridge) - Adding extra methods * feat(ChakraBridge) - Removing old code * feat(ChakraBridge) - Better error handling * feat(ChakraBridge) - Turn into WinRT component * feat(ChakraBridge) - Fix files * feat(ChakraBridge) - Fix files * feat(ChakraBridge) - rename class to JsrtJavaScriptExecturo * feat(ChakraBridge) - change as per comments on #584 * feat(ChakraBridge) - Adding load from file * feat(ChakraBridge) - Removing require method stuff * feat(ChakraBridge) - Fixing debug writeln * feat(ChakraBridge) - Add serialize script * feat(ChakraBridge) - Add pseudocode for loading from file * feat(ChakraBridge) - better cleanup for methods * feat(ChakraBridge) - Add context for callbacks * feat(ChakraBridge) - Fixed callbacks * feat(ChakraBridge) - Add byte* overload for loading serialized script * feat(ChakraBridge) - renamed to ChakraBridge * feat(ChakraBridge) - fix release builds * feat(ChakraBridge) - add serialization methods to bridge * feat(ChakraBridge) - remove unneeded headers * feat(ChakraBridge) - add XML docs
This commit is contained in:
Родитель
a12302a68d
Коммит
a6fdf60dab
|
@ -116,3 +116,22 @@ packages/
|
|||
|
||||
#JavaScript files
|
||||
*.jsbundle
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Build results
|
||||
[Dd]ebugPublic/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Ll]og/
|
||||
|
|
|
@ -0,0 +1,230 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4b72c796-16d5-4e3a-81c0-3e36f531e578}</ProjectGuid>
|
||||
<Keyword>WindowsRuntimeComponent</Keyword>
|
||||
<RootNamespace>ChakraBridge</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;USE_EDGEMODE_JSRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;USE_EDGEMODE_JSRT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ChakraHost.h" />
|
||||
<ClInclude Include="NativeJavaScriptExecutor.h" />
|
||||
<ClInclude Include="ChakraStringResult.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="SerializedSourceContext.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ChakraHost.cpp" />
|
||||
<ClCompile Include="NativeJavaScriptExecutor.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>a4e4ad2b-1c8c-48ad-b1a7-45cfc1ce191a</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="ChakraHost.cpp" />
|
||||
<ClCompile Include="NativeJavaScriptExecutor.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="ChakraHost.h" />
|
||||
<ClInclude Include="ChakraStringResult.h" />
|
||||
<ClInclude Include="SerializedSourceContext.h" />
|
||||
<ClInclude Include="NativeJavaScriptExecutor.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,402 @@
|
|||
#include "pch.h"
|
||||
#include "ChakraHost.h"
|
||||
#include "SerializedSourceContext.h"
|
||||
|
||||
void ThrowException(const wchar_t* szException)
|
||||
{
|
||||
// We ignore error since we're already in an error state.
|
||||
JsValueRef errorValue;
|
||||
JsValueRef errorObject;
|
||||
JsPointerToString(szException, wcslen(szException), &errorValue);
|
||||
JsCreateError(errorValue, &errorObject);
|
||||
JsSetException(errorObject);
|
||||
};
|
||||
|
||||
JsErrorCode DefineHostCallback(JsValueRef globalObject, const wchar_t *callbackName, JsNativeFunction callback, void *callbackState)
|
||||
{
|
||||
JsPropertyIdRef propertyId;
|
||||
IfFailRet(JsGetPropertyIdFromName(callbackName, &propertyId));
|
||||
|
||||
JsValueRef function;
|
||||
IfFailRet(JsCreateFunction(callback, callbackState, &function));
|
||||
IfFailRet(JsSetProperty(globalObject, propertyId, function, true));
|
||||
|
||||
return JsNoError;
|
||||
};
|
||||
|
||||
JsValueRef InvokeConsole(const wchar_t* kind, JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
ChakraHost* self = (ChakraHost*)callbackState;
|
||||
wchar_t buff[56];
|
||||
swprintf(buff, 56, L"[JS {%s}] ", kind);
|
||||
OutputDebugStringW(buff);
|
||||
|
||||
// First argument is this-context, ignore...
|
||||
for (USHORT i = 1; i < argumentCount; i++)
|
||||
{
|
||||
JsValueRef resultJSString;
|
||||
IfFailThrow(self->JsonStringify(arguments[i], &resultJSString), L"JSON.stringify failed.");
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t szBufLen;
|
||||
IfFailThrow(JsStringToPointer(resultJSString, &szBuf, &szBufLen), L"Failed to get string from pointer.");
|
||||
|
||||
OutputDebugStringW(szBuf);
|
||||
OutputDebugStringW(L" ");
|
||||
}
|
||||
|
||||
OutputDebugStringW(L"\n");
|
||||
|
||||
#endif
|
||||
|
||||
return JS_INVALID_REFERENCE;
|
||||
};
|
||||
|
||||
JsValueRef CALLBACK ConsoleLog(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
|
||||
{
|
||||
return InvokeConsole(L"log", callee, isConstructCall, arguments, argumentCount, callbackState);
|
||||
}
|
||||
|
||||
JsValueRef CALLBACK ConsoleWarn(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
|
||||
{
|
||||
return InvokeConsole(L"warn", callee, isConstructCall, arguments, argumentCount, callbackState);
|
||||
}
|
||||
|
||||
JsValueRef CALLBACK ConsoleInfo(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
|
||||
{
|
||||
return InvokeConsole(L"info", callee, isConstructCall, arguments, argumentCount, callbackState);
|
||||
}
|
||||
|
||||
JsValueRef CALLBACK ConsoleError(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
|
||||
{
|
||||
return InvokeConsole(L"error", callee, isConstructCall, arguments, argumentCount, callbackState);
|
||||
}
|
||||
|
||||
bool CALLBACK LoadSourceCallback(JsSourceContext sourceContext, const wchar_t** scriptBuffer)
|
||||
{
|
||||
SerializedSourceContext* context = (SerializedSourceContext*)sourceContext;
|
||||
FILE* file;
|
||||
|
||||
_wfopen_s(&file, context->sourcePath, L"rb");
|
||||
|
||||
unsigned int current = ftell(file);
|
||||
fseek(file, 0, SEEK_END);
|
||||
unsigned int end = ftell(file);
|
||||
fseek(file, current, SEEK_SET);
|
||||
unsigned int lengthBytes = end - current;
|
||||
char* rawBytes = (char *)calloc(lengthBytes + 1, sizeof(char));
|
||||
|
||||
if (rawBytes == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fread((void *)rawBytes, sizeof(char), lengthBytes, file);
|
||||
fclose(file);
|
||||
|
||||
wchar_t* contents = (wchar_t *)calloc(lengthBytes + 1, sizeof(wchar_t));
|
||||
if (contents == nullptr)
|
||||
{
|
||||
free(rawBytes);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, rawBytes, lengthBytes + 1, contents, lengthBytes + 1) == 0)
|
||||
{
|
||||
free(rawBytes);
|
||||
free(contents);
|
||||
return false;
|
||||
}
|
||||
|
||||
free(rawBytes);
|
||||
*scriptBuffer = contents;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CALLBACK UnloadSourceCallback(JsSourceContext sourceContext)
|
||||
{
|
||||
SerializedSourceContext* context = (SerializedSourceContext*)sourceContext;
|
||||
delete context;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::RunSerailizedScript(BYTE* buffer, const wchar_t* szPath, const wchar_t* szSourceUri, JsValueRef* result)
|
||||
{
|
||||
SerializedSourceContext* context = new SerializedSourceContext();
|
||||
context->byteCode = buffer;
|
||||
context->sourcePath = szPath;
|
||||
context->scriptBuffer = nullptr;
|
||||
|
||||
IfFailRet(JsRunSerializedScriptWithCallback(
|
||||
&LoadSourceCallback,
|
||||
&UnloadSourceCallback,
|
||||
buffer,
|
||||
(JsSourceContext)context,
|
||||
szSourceUri,
|
||||
result));
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::RunSerializedScriptFromFile(const wchar_t* szSerializedPath, const wchar_t* szPath, const wchar_t* szSourceUri, JsValueRef* result)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
BYTE* buffer = NULL;
|
||||
if (_wfopen_s(&file, szSerializedPath, L"rb"))
|
||||
{
|
||||
return JsErrorInvalidArgument;
|
||||
}
|
||||
|
||||
unsigned int current = ftell(file);
|
||||
fseek(file, 0, SEEK_END);
|
||||
unsigned int end = ftell(file);
|
||||
fseek(file, current, SEEK_SET);
|
||||
unsigned int lengthBytes = end - current;
|
||||
buffer = (BYTE*)calloc(lengthBytes + 1, sizeof(BYTE));
|
||||
fread((void *)buffer, sizeof(BYTE), lengthBytes, file);
|
||||
fclose(file);
|
||||
|
||||
IfFailRet(RunSerailizedScript(buffer, szPath, szSourceUri, result));
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::SerializeScriptFromFile(const wchar_t* szPath, const wchar_t* szDestination)
|
||||
{
|
||||
JsErrorCode status = JsNoError;
|
||||
FILE *file;
|
||||
char *rawBytes = nullptr;
|
||||
wchar_t *contents = nullptr;
|
||||
|
||||
if (_wfopen_s(&file, szPath, L"rb"))
|
||||
{
|
||||
status = JsErrorInvalidArgument;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
unsigned int current = ftell(file);
|
||||
fseek(file, 0, SEEK_END);
|
||||
unsigned int end = ftell(file);
|
||||
fseek(file, current, SEEK_SET);
|
||||
unsigned int lengthBytes = end - current;
|
||||
rawBytes = (char *)calloc(lengthBytes + 1, sizeof(char));
|
||||
|
||||
if (rawBytes == nullptr)
|
||||
{
|
||||
status = JsErrorFatal;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fread((void *)rawBytes, sizeof(char), lengthBytes, file);
|
||||
fclose(file);
|
||||
|
||||
contents = (wchar_t *)calloc(lengthBytes + 1, sizeof(wchar_t));
|
||||
if (contents == nullptr)
|
||||
{
|
||||
status = JsErrorFatal;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, rawBytes, lengthBytes + 1, contents, lengthBytes + 1) == 0)
|
||||
{
|
||||
status = JsErrorFatal;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
IfFailCleanup(SerializeScript(contents, szDestination));
|
||||
|
||||
cleanup:
|
||||
if (rawBytes)
|
||||
{
|
||||
free(rawBytes);
|
||||
}
|
||||
if (contents)
|
||||
{
|
||||
free(contents);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::SerializeScript(const wchar_t* szScript, const wchar_t* szDestination)
|
||||
{
|
||||
JsErrorCode status;
|
||||
BYTE* buf = NULL;
|
||||
ULONG bufSize = 0L;
|
||||
IfFailCleanup(JsSerializeScript(szScript, buf, &bufSize));
|
||||
|
||||
buf = new BYTE[bufSize];
|
||||
IfFailCleanup(JsSerializeScript(szScript, buf, &bufSize));
|
||||
|
||||
FILE *file;
|
||||
if (_wfopen_s(&file, szDestination, L"wb"))
|
||||
{
|
||||
status = JsErrorInvalidArgument;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (fwrite(buf, sizeof(BYTE), bufSize, file) != bufSize)
|
||||
{
|
||||
status = JsErrorFatal;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (fclose(file))
|
||||
{
|
||||
status = JsErrorFatal;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (buf)
|
||||
{
|
||||
delete[] buf;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::RunScriptFromFile(const wchar_t* szFileName, const wchar_t* szSourceUri, JsValueRef* result)
|
||||
{
|
||||
JsErrorCode status = JsNoError;
|
||||
FILE *file;
|
||||
|
||||
if (_wfopen_s(&file, szFileName, L"rb"))
|
||||
{
|
||||
return JsErrorInvalidArgument;
|
||||
}
|
||||
|
||||
unsigned int current = ftell(file);
|
||||
fseek(file, 0, SEEK_END);
|
||||
unsigned int end = ftell(file);
|
||||
fseek(file, current, SEEK_SET);
|
||||
unsigned int lengthBytes = end - current;
|
||||
char *rawBytes = (char *)calloc(lengthBytes + 1, sizeof(char));
|
||||
|
||||
if (rawBytes == nullptr)
|
||||
{
|
||||
return JsErrorFatal;
|
||||
}
|
||||
|
||||
fread((void *)rawBytes, sizeof(char), lengthBytes, file);
|
||||
if (fclose(file))
|
||||
{
|
||||
return JsErrorFatal;
|
||||
}
|
||||
|
||||
wchar_t *contents = (wchar_t *)calloc(lengthBytes + 1, sizeof(wchar_t));
|
||||
if (contents == nullptr)
|
||||
{
|
||||
free(rawBytes);
|
||||
return JsErrorFatal;
|
||||
}
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, rawBytes, lengthBytes + 1, contents, lengthBytes + 1) == 0)
|
||||
{
|
||||
free(rawBytes);
|
||||
free(contents);
|
||||
return JsErrorFatal;
|
||||
}
|
||||
|
||||
status = RunScript(contents, szSourceUri, result);
|
||||
|
||||
free(rawBytes);
|
||||
free(contents);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::RunScript(const wchar_t* szScript, const wchar_t* szSourceUri, JsValueRef* result)
|
||||
{
|
||||
return JsRunScript(szScript, currentSourceContext++, szSourceUri, result);
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::JsonStringify(JsValueRef argument, JsValueRef* result)
|
||||
{
|
||||
JsValueRef args[2] = { globalObject, argument };
|
||||
IfFailRet(JsCallFunction(jsonStringifyObject, args, 2, result));
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::JsonParse(JsValueRef argument, JsValueRef* result)
|
||||
{
|
||||
JsValueRef args[2] = { globalObject, argument };
|
||||
IfFailRet(JsCallFunction(jsonParseObject, args, 2, result));
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::GetGlobalVariable(const wchar_t* szPropertyName, JsValueRef* result)
|
||||
{
|
||||
JsPropertyIdRef globalVarId;
|
||||
IfFailRet(JsGetPropertyIdFromName(szPropertyName, &globalVarId));
|
||||
IfFailRet(JsGetProperty(globalObject, globalVarId, result));
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::SetGlobalVariable(const wchar_t* szPropertyName, JsValueRef value)
|
||||
{
|
||||
JsPropertyIdRef globalVarId;
|
||||
IfFailRet(JsGetPropertyIdFromName(szPropertyName, &globalVarId));
|
||||
IfFailRet(JsSetProperty(globalObject, globalVarId, value, true));
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::InitJson()
|
||||
{
|
||||
JsPropertyIdRef jsonPropertyId;
|
||||
IfFailRet(JsGetPropertyIdFromName(L"JSON", &jsonPropertyId));
|
||||
JsValueRef jsonObject;
|
||||
IfFailRet(JsGetProperty(globalObject, jsonPropertyId, &jsonObject));
|
||||
|
||||
JsPropertyIdRef jsonParseId;
|
||||
IfFailRet(JsGetPropertyIdFromName(L"parse", &jsonParseId));
|
||||
IfFailRet(JsGetProperty(jsonObject, jsonParseId, &jsonParseObject));
|
||||
|
||||
JsPropertyIdRef jsonStringifyId;
|
||||
IfFailRet(JsGetPropertyIdFromName(L"stringify", &jsonStringifyId));
|
||||
IfFailRet(JsGetProperty(jsonObject, jsonStringifyId, &jsonStringifyObject));
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::InitConsole()
|
||||
{
|
||||
JsPropertyIdRef consolePropertyId;
|
||||
IfFailRet(JsGetPropertyIdFromName(L"console", &consolePropertyId));
|
||||
|
||||
JsValueRef consoleObject;
|
||||
IfFailRet(JsCreateObject(&consoleObject));
|
||||
IfFailRet(JsSetProperty(globalObject, consolePropertyId, consoleObject, true));
|
||||
|
||||
IfFailRet(DefineHostCallback(consoleObject, L"info", ConsoleInfo, this));
|
||||
IfFailRet(DefineHostCallback(consoleObject, L"log", ConsoleLog, this));
|
||||
IfFailRet(DefineHostCallback(consoleObject, L"warn", ConsoleWarn, this));
|
||||
IfFailRet(DefineHostCallback(consoleObject, L"error", ConsoleError, this));
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::Init()
|
||||
{
|
||||
currentSourceContext = 0;
|
||||
|
||||
IfFailRet(JsCreateRuntime(JsRuntimeAttributeNone, nullptr, &runtime));
|
||||
IfFailRet(JsCreateContext(runtime, &context));
|
||||
IfFailRet(JsSetCurrentContext(context));
|
||||
|
||||
IfFailRet(JsGetGlobalObject(&globalObject));
|
||||
|
||||
IfFailRet(InitJson());
|
||||
IfFailRet(InitConsole());
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
JsErrorCode ChakraHost::Destroy()
|
||||
{
|
||||
IfFailRet(JsSetCurrentContext(JS_INVALID_REFERENCE));
|
||||
IfFailRet(JsDisposeRuntime(runtime));
|
||||
|
||||
return JsNoError;
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include <jsrt.h>
|
||||
|
||||
/// <summary>
|
||||
/// This class wraps the main functionality dealing with the JSRT.
|
||||
/// </summary>
|
||||
class ChakraHost
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Initializes a JSRT session with the context, globals, JSON, and console logging.
|
||||
///</summary>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode Init();
|
||||
|
||||
/// <summary>
|
||||
/// Destorys the current JSRT session.
|
||||
///</summary>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode Destroy();
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a given script and saves it to the desired location.
|
||||
///</summary>
|
||||
/// <param name="szScript">The script string to serialize</param>
|
||||
/// <param name="szDestination">The destination to save the serialized script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode SerializeScript(const wchar_t* szScript, const wchar_t* szDestination);
|
||||
|
||||
/// <summary>
|
||||
/// Loads a script file, serializes its contents and then saves to the desired location.
|
||||
///</summary>
|
||||
/// <param name="szPath">The file path of the script to serialize.</param>
|
||||
/// <param name="szDestination">The destination to save the serialized script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode SerializeScriptFromFile(const wchar_t* szPath, const wchar_t* szDestination);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a serialized script from the given byte buffer and source URI and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="buffer">A byte buffer which contains the serialized byte code.</param>
|
||||
/// <param name="szSourceUri">The source URI for the script.</param>
|
||||
/// <param name="result">[Out] The result from running the serialized script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode RunSerailizedScript(BYTE* buffer, const wchar_t* szPath, const wchar_t* szSourceUri, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Loads a serialized script from the path, runs it with the byte buffer and source URI and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="szSerializedPath">The path containing the serialized script.</param>
|
||||
/// <param name="szSourceUri">The source URI for the script.</param>
|
||||
/// <param name="result">[Out] The result from running the serialized script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode RunSerializedScriptFromFile(const wchar_t* szSerializedPath, const wchar_t* szPath, const wchar_t* szSourceUri, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Runs the given script with the source URI and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="szScript">The script to run.</param>
|
||||
/// <param name="szSourceUri">The source URI of the script.</param>
|
||||
/// <param name="result">[Out] The result from running the script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode RunScript(const wchar_t* szScript, const wchar_t* szSourceUri, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Runs the script from the file location with the source URI and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="szPath">The location of the script to run.</param>
|
||||
/// <param name="szSourceUri">The source URI of the script.</param>
|
||||
/// <param name="result">[Out] The result from running the script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode RunScriptFromFile(const wchar_t* szPath, const wchar_t* szSourceUri, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Calls JSON stringify on the given <see cref="JsValueRef" /> and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="argument">The argument to stringify.</param>
|
||||
/// <param name="result">[Out] The result from running JSON.stringify.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode JsonStringify(JsValueRef argument, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Calls JSON parse on the given <see cref="JsValueRef" /> and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="argument">The argument to parse.</param>
|
||||
/// <param name="result">[Out] The result from running JSON.parse.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode JsonParse(JsValueRef argument, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a global variable and returns the <see cref="JsValueRef" /> result.
|
||||
///</summary>
|
||||
/// <param name="szPropertyName">The property name from global to get.</param>
|
||||
/// <param name="result">[Out] The global property value.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode GetGlobalVariable(const wchar_t* szPropertyName, JsValueRef* result);
|
||||
|
||||
/// <summary>
|
||||
/// Sets a global variable with the <see cref="JsValueRef" />.
|
||||
///</summary>
|
||||
/// <param name="szPropertyName">The property name from global to get.</param>
|
||||
/// <param name="value">The global property value to set.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
JsErrorCode SetGlobalVariable(const wchar_t* szPropertyName, JsValueRef value);
|
||||
|
||||
/// <summary>
|
||||
/// The JSRT global object for the session.
|
||||
/// </summary>
|
||||
JsValueRef globalObject;
|
||||
private:
|
||||
JsErrorCode InitJson();
|
||||
JsErrorCode InitConsole();
|
||||
|
||||
unsigned currentSourceContext;
|
||||
JsRuntimeHandle runtime;
|
||||
JsContextRef context;
|
||||
JsValueRef jsonParseObject;
|
||||
JsValueRef jsonStringifyObject;
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
using namespace Platform;
|
||||
|
||||
namespace ChakraBridge {
|
||||
|
||||
/// <summary>
|
||||
/// A compound result containing the string result and a <see cref="JsErrorCode" /> for the error.
|
||||
/// </summary>
|
||||
public value struct ChakraStringResult
|
||||
{
|
||||
/// <summary>The <see cref="JsErrorCode" /> for the operation, JsNoError if no error has occurred.</summary>
|
||||
int ErrorCode;
|
||||
/// <summary>The string result for the operation.</summary>
|
||||
String^ Result;
|
||||
};
|
||||
|
||||
};
|
|
@ -0,0 +1,217 @@
|
|||
#include "pch.h"
|
||||
#include "NativeJavaScriptExecutor.h"
|
||||
|
||||
using namespace ChakraBridge;
|
||||
|
||||
int NativeJavaScriptExecutor::InitializeHost()
|
||||
{
|
||||
return this->host.Init();
|
||||
}
|
||||
|
||||
int NativeJavaScriptExecutor::DisposeHost()
|
||||
{
|
||||
return this->host.Destroy();
|
||||
}
|
||||
|
||||
int NativeJavaScriptExecutor::SetGlobalVariable(String^ variableName, String^ stringifiedText)
|
||||
{
|
||||
JsValueRef valueStringified;
|
||||
IfFailRet(JsPointerToString(stringifiedText->Data(), stringifiedText->Length(), &valueStringified));
|
||||
|
||||
JsValueRef valueJson;
|
||||
IfFailRet(this->host.JsonParse(valueStringified, &valueJson));
|
||||
IfFailRet(this->host.SetGlobalVariable(variableName->Data(), valueJson));
|
||||
|
||||
return JsNoError;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::GetGlobalVariable(String^ variableName)
|
||||
{
|
||||
JsValueRef globalVariable;
|
||||
IfFailRetNullPtr(this->host.GetGlobalVariable(variableName->Data(), &globalVariable));
|
||||
|
||||
JsValueRef globalVariableJson;
|
||||
IfFailRetNullPtr(this->host.JsonStringify(globalVariable, &globalVariableJson));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(globalVariableJson, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::RunScript(String^ source, String^ sourceUri)
|
||||
{
|
||||
JsValueRef result;
|
||||
IfFailRetNullPtr(this->host.RunScript(source->Data(), sourceUri->Data(), &result));
|
||||
|
||||
JsValueRef resultJson;
|
||||
IfFailRetNullPtr(this->host.JsonStringify(result, &resultJson));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(resultJson, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::RunScriptFromFile(String^ sourceFilePath, String^ sourceUri)
|
||||
{
|
||||
JsValueRef result;
|
||||
IfFailRetNullPtr(this->host.RunScriptFromFile(sourceFilePath->Data(), sourceUri->Data(), &result));
|
||||
|
||||
JsValueRef resultJson;
|
||||
IfFailRetNullPtr(this->host.JsonStringify(result, &resultJson));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(resultJson, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
int NativeJavaScriptExecutor::SerializeScript(String^ source, String^ destination) {
|
||||
return this->host.SerializeScript(source->Data(), destination->Data());
|
||||
}
|
||||
|
||||
int NativeJavaScriptExecutor::SerializeScriptFromFile(String^ file, String^ destination)
|
||||
{
|
||||
return this->host.SerializeScriptFromFile(file->Data(), destination->Data());
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::RunSerializedScript(const Array<byte>^ buffer, String^ sourceFilePath, String^ sourceUri)
|
||||
{
|
||||
JsValueRef result;
|
||||
IfFailRetNullPtr(this->host.RunSerailizedScript(buffer->Data, sourceFilePath->Data(), sourceUri->Data(), &result));
|
||||
|
||||
JsValueRef resultJson;
|
||||
IfFailRetNullPtr(this->host.JsonStringify(result, &resultJson));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(resultJson, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::RunSerializedScriptFromFile(String^ serializedPath, String^ sourceFilePath, String^ sourceUri)
|
||||
{
|
||||
JsValueRef result;
|
||||
IfFailRetNullPtr(this->host.RunSerializedScriptFromFile(serializedPath->Data(), sourceFilePath->Data(), sourceUri->Data(), &result));
|
||||
|
||||
JsValueRef resultJson;
|
||||
IfFailRetNullPtr(this->host.JsonStringify(result, &resultJson));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(resultJson, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::CallFunctionAndReturnFlushedQueue(String^ moduleName, String^ methodName, String^ args)
|
||||
{
|
||||
JsPropertyIdRef modulePropertyId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(moduleName->Data(), &modulePropertyId));
|
||||
|
||||
JsValueRef moduleObject;
|
||||
IfFailRetNullPtr(JsGetProperty(host.globalObject, modulePropertyId, &moduleObject));
|
||||
|
||||
JsPropertyIdRef methodPropertyId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(methodName->Data(), &methodPropertyId));
|
||||
|
||||
JsValueRef methodObject;
|
||||
IfFailRetNullPtr(JsGetProperty(moduleObject, methodPropertyId, &methodObject));
|
||||
|
||||
JsValueRef argObj;
|
||||
IfFailRetNullPtr(JsPointerToString(args->Data(), args->Length(), &argObj));
|
||||
|
||||
JsValueRef jsonObj;
|
||||
IfFailRetNullPtr(host.JsonParse(argObj, &jsonObj));
|
||||
|
||||
JsValueRef result;
|
||||
JsValueRef newArgs[2] = { host.globalObject, jsonObj };
|
||||
IfFailRetNullPtr(JsCallFunction(methodObject, newArgs, 2, &result));
|
||||
|
||||
JsValueRef stringifiedResult;
|
||||
IfFailRetNullPtr(host.JsonStringify(result, &stringifiedResult));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(stringifiedResult, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::InvokeCallbackAndReturnFlushedQueue(int callbackId, String^ args)
|
||||
{
|
||||
JsPropertyIdRef fbBridgeId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(L"__fbBatchedBridge", &fbBridgeId));
|
||||
|
||||
JsValueRef fbBridgeObj;
|
||||
IfFailRetNullPtr(JsGetProperty(host.globalObject, fbBridgeId, &fbBridgeObj));
|
||||
|
||||
JsPropertyIdRef methodId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(L"invokeCallbackAndReturnFlushedQueue", &methodId));
|
||||
|
||||
JsValueRef method;
|
||||
IfFailRetNullPtr(JsGetProperty(fbBridgeObj, methodId, &method));
|
||||
|
||||
JsValueRef callbackIdRef;
|
||||
IfFailRetNullPtr(JsIntToNumber(callbackId, &callbackIdRef));
|
||||
|
||||
JsValueRef argsObj;
|
||||
IfFailRetNullPtr(JsPointerToString(args->Data(), args->Length(), &argsObj));
|
||||
|
||||
JsValueRef argsJson;
|
||||
IfFailRetNullPtr(host.JsonParse(argsObj, &argsJson));
|
||||
|
||||
JsValueRef result;
|
||||
JsValueRef newArgs[3] = { host.globalObject, callbackIdRef, argsJson };
|
||||
IfFailRetNullPtr(JsCallFunction(method, newArgs, 3, &result));
|
||||
|
||||
JsValueRef stringifiedResult;
|
||||
IfFailRetNullPtr(host.JsonStringify(result, &stringifiedResult));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(stringifiedResult, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
ChakraStringResult NativeJavaScriptExecutor::FlushedQueue()
|
||||
{
|
||||
JsPropertyIdRef fbBridgeId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(L"__fbBatchedBridge", &fbBridgeId));
|
||||
|
||||
JsValueRef fbBridgeObj;
|
||||
IfFailRetNullPtr(JsGetProperty(host.globalObject, fbBridgeId, &fbBridgeObj));
|
||||
|
||||
JsPropertyIdRef methodId;
|
||||
IfFailRetNullPtr(JsGetPropertyIdFromName(L"flushedQueue", &methodId));
|
||||
|
||||
JsValueRef method;
|
||||
IfFailRetNullPtr(JsGetProperty(fbBridgeObj, methodId, &method));
|
||||
|
||||
JsValueRef result;
|
||||
JsValueRef newArgs[1] = { host.globalObject };
|
||||
IfFailRetNullPtr(JsCallFunction(method, newArgs, 1, &result));
|
||||
|
||||
JsValueRef stringifiedResult;
|
||||
IfFailRetNullPtr(host.JsonStringify(result, &stringifiedResult));
|
||||
|
||||
const wchar_t* szBuf;
|
||||
size_t bufLen;
|
||||
IfFailRetNullPtr(JsStringToPointer(stringifiedResult, &szBuf, &bufLen));
|
||||
|
||||
ChakraStringResult finalResult = { JsNoError, ref new String(szBuf, bufLen) };
|
||||
return finalResult;
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "ChakraHost.h"
|
||||
#include "ChakraStringResult.h"
|
||||
|
||||
using namespace Platform;
|
||||
|
||||
namespace ChakraBridge {
|
||||
|
||||
/// <summary>
|
||||
/// This class interfaces with the unmanaged JSRT Chakra Host.
|
||||
/// </summary>
|
||||
public ref class NativeJavaScriptExecutor sealed
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Initializes the JSRT session.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
int InitializeHost();
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the current JSRT session.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
int DisposeHost();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the global variable value.
|
||||
/// </summary>
|
||||
/// <param name="variableName">The global variable to get.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult GetGlobalVariable(String^ variableName);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the global variable
|
||||
/// </summary>
|
||||
/// <param name="variableName">The variable name to set.</param>
|
||||
/// <param name="value">The value to set on the global variable.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
int SetGlobalVariable(String^ variableName, String^ value);
|
||||
|
||||
/// <summary>
|
||||
/// Runs the given script with the source URI and returns the result.
|
||||
/// </summary>
|
||||
/// <param name="source">The source of the script to run.</param>
|
||||
/// <param name="sourceUri">The source URI of the script to run.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult RunScript(String^ source, String^ sourceUri);
|
||||
|
||||
/// <summary>
|
||||
/// Runs the script from the file location and source URI and returns the result.
|
||||
/// </summary>
|
||||
/// <param name="sourceFilePath">The file path which contains the source to run.</param>
|
||||
/// <param name="sourceUri">The source URI of the script to run.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult RunScriptFromFile(String^ sourceFilePath, String^ sourceUri);
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a source script to a file destination.
|
||||
/// </summary>
|
||||
/// <param name="source">The source script to serialize.</param>
|
||||
/// <param name="destination">The destination to save the serialized script.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
int SerializeScript(String^ source, String^ destination);
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a script from a file location with source URI.
|
||||
/// </summary>
|
||||
/// <param name="file">The location of the source file to serialize.</param>
|
||||
/// <param name="destination">The destination to save the serialized source.</param>
|
||||
/// <returns>
|
||||
/// JsNoError is no error, else a JsErrorCode with the appropriate error.
|
||||
/// </returns>
|
||||
int SerializeScriptFromFile(String^ file, String^ destination);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a serialized script from the byte array, source file path, and source URI.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer containing the serialized script.</param>
|
||||
/// <param name="sourceFilePath">The path of the source file.</param>
|
||||
/// <param name="sourceUri">The source URI.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult RunSerializedScript(const Array<byte>^ buffer, String^ sourceFilePath, String^ sourceUri);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a serialzed script from the serialized path, the source file path and source URI.
|
||||
/// </summary>
|
||||
/// <param name="serializedPath">The path containing the serailized script.</param>
|
||||
/// <param name="sourceFilePath">The path of the source file.</param>
|
||||
/// <param name="sourceUri">The source URI.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult RunSerializedScriptFromFile(String^ serializedPath, String^ sourceFilePath, String^ sourceUri);
|
||||
|
||||
/// <summary>
|
||||
/// Calls the underlying function with the given module and method name and JSON stringified arguments.
|
||||
/// </summary>
|
||||
/// <param name="moduleName">The module name to call.</param>
|
||||
/// <param name="methodName">The method name on the module to call.</param>
|
||||
/// <param name="args">JSON stringified arguments to call on the module.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult CallFunctionAndReturnFlushedQueue(String^ moduleName, String^ methodName, String^ args);
|
||||
|
||||
/// <summary>
|
||||
/// Calls the underlying function with the callback ID and JSON stringified arguments.
|
||||
/// </summary>
|
||||
/// <param name="callbackId">The callback ID.</param>
|
||||
/// <param name="args">JSON stringified arguments to call on the module.</param>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult InvokeCallbackAndReturnFlushedQueue(int callbackId, String^ args);
|
||||
|
||||
/// <summary>
|
||||
/// Calls the flush queue function.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A compount result with the JSON stringified value and an error code if any occurred.
|
||||
/// </returns>
|
||||
ChakraStringResult FlushedQueue();
|
||||
private:
|
||||
ChakraHost host;
|
||||
};
|
||||
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <jsrt.h>
|
||||
|
||||
struct SerializedSourceContext
|
||||
{
|
||||
BYTE* byteCode;
|
||||
const wchar_t* sourcePath;
|
||||
wchar_t* scriptBuffer;
|
||||
|
||||
~SerializedSourceContext()
|
||||
{
|
||||
delete[] byteCode;
|
||||
delete[] sourcePath;
|
||||
if (scriptBuffer)
|
||||
{
|
||||
delete[] scriptBuffer;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
#include "pch.h"
|
|
@ -0,0 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
#include <collection.h>
|
||||
#include <ppltasks.h>
|
||||
#include <jsrt.h>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include "ChakraStringResult.h"
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define IfFailRetNullPtr(v) \
|
||||
{ \
|
||||
JsErrorCode status = (v); \
|
||||
if (status != JsNoError) \
|
||||
{ \
|
||||
ChakraStringResult stringResult; \
|
||||
stringResult.ErrorCode = status; \
|
||||
return stringResult; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define IfFailRet(v) \
|
||||
{ \
|
||||
JsErrorCode error = (v); \
|
||||
if (error != JsNoError) \
|
||||
{ \
|
||||
return error; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define IfFailThrow(v, e) \
|
||||
{ \
|
||||
JsErrorCode error = (v); \
|
||||
if (error != JsNoError) \
|
||||
{ \
|
||||
ThrowException((e)); \
|
||||
return JS_INVALID_REFERENCE; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define IfFailCleanup(v) \
|
||||
{ \
|
||||
status = (v); \
|
||||
if (status != JsNoError) \
|
||||
{ \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
|
||||
EndProject
|
||||
|
@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Playground", "Playground\Pl
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative.Tests", "ReactNative.Tests\ReactNative.Tests.csproj", "{5AC8108B-1C39-4C4A-8653-DBBE4ECCE691}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -145,6 +147,36 @@ Global
|
|||
{5AC8108B-1C39-4C4A-8653-DBBE4ECCE691}.ReleaseBundle|x86.ActiveCfg = Release|x86
|
||||
{5AC8108B-1C39-4C4A-8653-DBBE4ECCE691}.ReleaseBundle|x86.Build.0 = Release|x86
|
||||
{5AC8108B-1C39-4C4A-8653-DBBE4ECCE691}.ReleaseBundle|x86.Deploy.0 = Release|x86
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|Any CPU.ActiveCfg = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|Any CPU.Build.0 = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.ActiveCfg = Debug|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|ARM.Build.0 = Debug|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.ActiveCfg = Debug|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x64.Build.0 = Debug|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.ActiveCfg = Debug|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.DebugBundle|x86.Build.0 = Debug|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|Any CPU.ActiveCfg = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|Any CPU.Build.0 = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.ActiveCfg = Release|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|ARM.Build.0 = Release|ARM
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.ActiveCfg = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x64.Build.0 = Release|x64
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.ActiveCfg = Release|Win32
|
||||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.ReleaseBundle|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -430,7 +430,12 @@
|
|||
<Name>Windows Mobile Extensions for the UWP</Name>
|
||||
</SDKReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ChakraBridge\ChakraBridge.vcxproj">
|
||||
<Project>{4b72c796-16d5-4e3a-81c0-3e36f531e578}</Project>
|
||||
<Name>ChakraBridge</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче