Skip to content
This repository has been archived by the owner on Jan 3, 2020. It is now read-only.

Initial checkin for the Node.js UWP code #1

Merged
merged 12 commits into from
May 22, 2015
Prev Previous commit
Addressing pull request feedback
  • Loading branch information
Munyiri Kamau committed May 22, 2015
commit 4997de396da52d386fbd7319d68d4bc237820f42
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ Prerequisites:
* Windows 10 (latest)
* Python 2.6 or 2.7
* Visual Studio 2015 (RC or later)
* Windows 10 Tools (Bundled in Visual Studio 2015, or install separately.)
* Windows 10 Tools (Bundled in Visual Studio 2015, or install separately)
* Clone Node.js from https://github.com/microsoft/node

Steps:

* Set node_dir in build.bat to the path of your Node.js clone
* Set release_dir if desired (optional)
* build.bat [x86|x64|arm] [copyrelease]
* Open cmd window
* Set node_dir to the path of your Node.js clone
* Set release_dir if desired (optional if copyrelease is not used)
* Run "build.bat [x86|x64|arm] [copyrelease]"
31 changes: 20 additions & 11 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@echo off

if not defined node_dir (
echo Error: set node_dir to the path of your Node.js clone.
goto end
)

set batch_dir=%~dp0

set copyrelease=
Expand All @@ -21,8 +26,12 @@ goto next-arg

:args-done

set node_dir=C:\repos\node
set release_dir=c:\buildoutput\node-uwp
if defined copyrelease (
if not defined release_dir (
echo Error: release_dir needs to be set when using copyrelease.
goto end
)
)

if "%target_arch%"=="arm" goto arm
if "%target_arch%"=="x86" goto x86
Expand All @@ -33,45 +42,45 @@ set buildall=1
:arm
@rem build node.dll
call "%node_dir%\vcbuild.bat" arm chakra uwp-dll withoutssl
cd %batch_dir%
pushd %batch_dir%
@rem build nodeuwp.dll
set WindowsSdkDir=%programfiles(x86)%\Windows Kits\10\
msbuild nodeuwp.sln /p:configuration=release /p:platform=arm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumes msbuild on your path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. vcbuild.bat calls vcvarsall.bat before it creates the node project so msbuild env variables will already be set.


@rem copy to release directory
if defined copyrelease (
echo D | xcopy /y /f /i "%node_dir%\Release\node.dll" "%release_dir%\ARM"
echo D | xcopy /y /f /i %~dp0\ARM\release\nodeuwp\nodeuwp.dll "%release_dir%\ARM"
echo D | xcopy /y /f "%node_dir%\Release\node.dll" "%release_dir%\ARM"
echo D | xcopy /y /f "%~dp0\ARM\release\nodeuwp\nodeuwp.dll" "%release_dir%\ARM"
)
if not defined buildall goto end

:x86

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The x86, x64 and arm labels seem to contain almost identical commands. Consider unifying and using variable expansion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's cleaner and more readable the way it is since it's small. I'd need to introduce a loop which I would unnecessarily complicate it (esp. since I have a "buildall" option for all labels).

@rem build node.dll
call "%node_dir%\vcbuild.bat" x86 chakra uwp-dll withoutssl
cd %batch_dir%
pushd %batch_dir%
@rem build nodeuwp.dll
set WindowsSdkDir=%programfiles(x86)%\Windows Kits\10\
msbuild nodeuwp.sln /p:configuration=release /p:platform=x86

@rem copy to release directory
if defined copyrelease (
echo D | xcopy /y /f /i "%node_dir%\Release\node.dll" "%release_dir%\x86"
echo D | xcopy /y /f /i %~dp0\release\nodeuwp\nodeuwp.dll "%release_dir%\x86"
echo D | xcopy /y /f "%node_dir%\Release\node.dll" "%release_dir%\x86"
echo D | xcopy /y /f "%~dp0\release\nodeuwp\nodeuwp.dll" "%release_dir%\x86"
)
if not defined buildall goto end

:x64
@rem build node.dll
call "%node_dir%\vcbuild.bat" x64 chakra uwp-dll withoutssl
cd %batch_dir%
pushd %batch_dir%
@rem build nodeuwp.dll
set WindowsSdkDir=%programfiles(x86)%\Windows Kits\10\
msbuild nodeuwp.sln /p:configuration=release /p:platform=x64

@rem copy to release directory
if defined copyrelease (
echo D | xcopy /y /f /i "%node_dir%\Release\node.dll" "%release_dir%\x64"
echo D | xcopy /y /f /i %~dp0\x64\release\nodeuwp\nodeuwp.dll "%release_dir%\x64"
echo D | xcopy /y /f "%node_dir%\Release\node.dll" "%release_dir%\x64"
echo D | xcopy /y /f "%~dp0\x64\release\nodeuwp\nodeuwp.dll" "%release_dir%\x64"
)

:end
2 changes: 1 addition & 1 deletion nodeuwp/StartupTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace Windows::Data::Xml::Dom;
using namespace Platform::Collections;

// startupinfo.xml is used by Visual Studio to pass arguments to Node (see StartNode method).
// It's updated through Node.js UAP project properties and packaged in the project appx.
// It's updated through Node.js UWP project properties and packaged in the project appx.
#define STARTUP_FILE L"startupinfo.xml"

std::shared_ptr<char> PlatformStringToChar(const wchar_t* str, int strSize)
Expand Down
11 changes: 5 additions & 6 deletions nodeuwp/StartupTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
namespace nodeuwp
{
[Windows::Foundation::Metadata::WebHostHidden]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad alignment, tabs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually autogenerated but I've put tabs to be consistent with the cpp file.

public ref class StartupTask sealed : public Windows::ApplicationModel::Background::IBackgroundTask
{
public:
virtual void Run(Windows::ApplicationModel::Background::IBackgroundTaskInstance^ taskInstance);

};
public ref class StartupTask sealed : public Windows::ApplicationModel::Background::IBackgroundTask
{
public:
virtual void Run(Windows::ApplicationModel::Background::IBackgroundTaskInstance^ taskInstance);
};
}