Get ready

You can retrieve the sources using TFS or subversion. Go to "Source Code" tab for more information.

You require Visual Studio 2010 in order to work with solutions.

Projects

Projects are organized in 2 main solutions.
  • Compiler : NetWebScript.Test.sln
    • NetWebScript : The compiler ("JsClr") (includes remoting code generator)
    • NetWebScript.Metadata : Metadata shared with debugger and remoting
    • NetWebScript.CompilerCLI : Command line to execute the compiler
    • NetWebScript.Task : MsBuild Task to execute the compiler
    • NetWebScript.Test : Compiler unit tests
    • Jint : Do not make any changes here
    • Antlr3.Runtime : Do not make any changes here
    • Microsoft.Samples.Debugging : Do not make any changes here
    • MappingGenerator : JQuery API mapping generator
  • Base Class Library : NetWebScript.Test.sln
    • NetWebScript.Core : APIs (runtime, remoting, script equivalents and imports)
    • NetWebScript.Test.Material : APIs (and compiler) unit tests
    • NetWebScript.UnitTestFramework : Visual Studio Unit Test extensions and equivalents
    • NetWebScript.Test.Server : Future unit test server (to remotely execute tests on multiple browsers)
  • Debugger : NetWebScript.Debug.sln
    • NetWebScript.Debug.Server : Debugger server and library
    • NetWebScript.Debug.App : Standalone debugger
    • NetWebScript.Debug.Engine : Visual Studio Debugger integration
    • NetWebScript.Debug.Install : Visual Studio Debugger integration installation (for debug version)
    • NetWebScript.Debug.Launcher : Visual Studio AddIn (to easily launch debugger, not yet functional)
  • Packaging : NetWebScript.Install\NetWebScript.Install.sln

Note: Use "Debug" target, "Release" requires a private key that is not provided.

How to work on Compiler or on Class Library

Open NetWebScript.Test.sln. Compile solution.

Standard test projects

Some unit tests can be run directly in Visual Studio.

To run browser side unit tests, compile solution, then open in Internet Explorer (other browsers does not allow to run JavaScript on html pages from file system), [NWS Solution Directory]\NetWebScript.Test.Material\bin\Debug\nws.pretty\NetWebScript.Test.Material.htm

Custom test projects

To use compiler on a custom test project, you should use the command line interface. If you use the regular MsBuild Task, Visual Studio will lock all NetWebScript DLLs and will prevent you to compile them again.

Web Projects

The command line interface is available throw a specific MsBuild targets file, that supports the same options than the release one.

Setup your project following the standard way (see Project Setup). But with the following changes :
  • Do not use NetWebScript.Core from the GAC, but browse use the version compiled in the "bin\Debug" from the corresponding project.
  • Replace the <Import /> (in the csproj) directive by the following lines :
    <PropertyGroup>
      <NwsSolutionPath>[NWS Solution Directory]</NwsSolutionPath>
    </PropertyGroup>
    <Import Project="$(NwsSolutionPath)\NetWebScript.CompilerCLI\bin\Debug\NetWebScript.Dev.targets" />

Unit Test Project

Add reference to NetWebScript.UnitTestFramework and to NetWebScript.Core from the NWS solution, each TestClass should be ScriptAvailable, and set the following command as post-build action :
[NWS Solution Directory]\NetWebScript.CompilerCLI\bin\Debug\nwsc.exe /path "$(TargetDir)nws" /name "$(ProjectName)" /add "$(TargetDir)$(TargetFileName)" /add "$(TargetDir)NetWebScript.UnitTestFramework.dll" /page NetWebScript.UnitTestFramework.Compiler.UnitTestPageFactory
An html page will be produced in "nws" in the output directory (usually bin\Debug)

To allow the use of the debugger, add /debug to the command line
To have human readable JavaScript, add /pretty. See next paragraph on how to use/test debugger.

How to work on Debugger


Open NetWebScript.Debug.sln. Compile solution.

Standalone Debugger

In order to test the debugger, follow this sequence:
  1. Start project "NetWebScript.Debug.App"
  2. Start application to debug in a web browser
  3. In the debugger, double-click on the application (attach to application)
  4. Browse source files, and set one or more break points
  5. Refresh the application in the web browser (to debug "onload" code), or continue to use it
  6. Debug application (and debugger ;-))
  7. Close browser and debugger windows

Visual Studio Integrated Debugger

In order to test the debugger engine, follow this sequence :
  1. Solution NetWebScript.Debug.sln must be opened
  2. Launch as administrator [NWS Solution Dircetory]\NetWebScript.Debug.Install\install.cmd. Important: From now any opened Visual Studio instance will includes NWS Debugger. You will not be able to compile debugger again until you run uninstall.
  3. Launch a new instance of Visual Studio
    1. First option: Set "devenv.exe" as Start Action for Debug of project "NetWebScript.Debug.Engine", then start debug
    2. Second option: A regular instance of Visual Studio
  4. In the new instance of Visual Studio, open application to debug
  5. Launch application in a web browser
  6. Go into "Debug" menu, select "Attach to process...", choose transport "NetWebScript" (in first drop down list), then click on "Refresh"
  7. Select application, and click on "Attach"
  8. Set one or more break points
  9. Refresh the application in the web browser (to debug "onload" code), or continue to use it
  10. Debug application (and debugger ;-))
  11. Close browser and Visual Studio
  12. Launch as administrator [NWS Solution Dircetory]\NetWebScript.Debug.Install\uninstall.cmd in order to be able to compile debugger again.

Last edited Jan 14, 2012 at 5:20 PM by jetelain, version 4

Comments

No comments yet.