scriptcs-contrib / edge-scs

scriptcs for edge!
Apache License 2.0
12 stars 2 forks source link

Module compiles on Windows #4

Closed richorama closed 9 years ago

richorama commented 9 years ago

Assuming you have Visual Studio (msbuild). A post install script will compile the .NET solution and copy the binaries to the lib folder.

The pre-compiled binaries have been deleted.

Not sure how to support this on mono :¬/

richorama commented 9 years ago

I have started shaving the yak for mono support. This may take some time!

glennblock commented 9 years ago

Awesome!

On Tuesday, September 23, 2014, Richard Astbury notifications@github.com wrote:

I have started shaving the yak for mono support. This may take some time!

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4#issuecomment-56536226 .

glennblock commented 9 years ago

I was thinking to have the binaries installed via Nuget

On Tuesday, September 23, 2014, Richard Astbury notifications@github.com wrote:

Assuming you have Visual Studio (msbuild). A post install script will compile the .NET solution and copy the binaries to the lib folder.

The pre-compiled binaries have been deleted.

Not sure how to support this on mono :¬/

You can merge this Pull Request by running

git pull https://github.com/richorama/edge-scs master

Or view, comment on, or merge it at:

https://github.com/scriptcs-contrib/edge-scs/pull/4 Commit Summary

  • added nuget install
  • add a build step
  • copy files after install

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4.

glennblock commented 9 years ago

What do you think about the script using nuget.exe to download the packages and pull out the binaries?

On Tuesday, September 23, 2014, Richard Astbury notifications@github.com wrote:

Assuming you have Visual Studio (msbuild). A post install script will compile the .NET solution and copy the binaries to the lib folder.

The pre-compiled binaries have been deleted.

Not sure how to support this on mono :¬/

You can merge this Pull Request by running

git pull https://github.com/richorama/edge-scs master

Or view, comment on, or merge it at:

https://github.com/scriptcs-contrib/edge-scs/pull/4 Commit Summary

  • added nuget install
  • add a build step
  • copy files after install

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4.

glennblock commented 9 years ago

Thanks for the effort here....

On Tuesday, September 23, 2014, Richard Astbury notifications@github.com wrote:

Assuming you have Visual Studio (msbuild). A post install script will compile the .NET solution and copy the binaries to the lib folder.

The pre-compiled binaries have been deleted.

Not sure how to support this on mono :¬/

You can merge this Pull Request by running

git pull https://github.com/richorama/edge-scs master

Or view, comment on, or merge it at:

https://github.com/scriptcs-contrib/edge-scs/pull/4 Commit Summary

  • added nuget install
  • add a build step
  • copy files after install

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4.

glennblock commented 9 years ago

Actually you can download the chocolatey pkg and open it up and all the binaries are there.

On Tuesday, September 23, 2014, Richard Astbury notifications@github.com wrote:

Assuming you have Visual Studio (msbuild). A post install script will compile the .NET solution and copy the binaries to the lib folder.

The pre-compiled binaries have been deleted.

Not sure how to support this on mono :¬/

You can merge this Pull Request by running

git pull https://github.com/richorama/edge-scs master

Or view, comment on, or merge it at:

https://github.com/scriptcs-contrib/edge-scs/pull/4 Commit Summary

  • added nuget install
  • add a build step
  • copy files after install

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4.

richorama commented 9 years ago

Thanks Glenn,

I started off on the nuget.exe approach, but to my surprise msbuild sorted out the nuget dependencies for me. xbuild on linux did not.

I guess there are a few options here, and I'm not sure which is the best:

1. Put all binaries in nuget

If we compiled the module and made that a nuget package too, we don't take a dependency on msbuild. The question is how do you get the nuget packages down?

2. Put all the binaries in the npm package

We could just ship all the binaries in the npm package. This seems like the most simple solution, but it feels like the wrong approach.

3. Compile the module, download the dependencies

This is the current approach, and is in keeping with how native modules generally work in npm. The problem is that msbuild has moved out of .NET, and into Visual Studio. Which is an annoying dependency to have. The story is better on mono, as xbuild ships with the framework.

Ideally there should be a repository for node binaries. Which is something I've mentioned before: https://groups.google.com/d/msg/nodejs/Ckfw2DmUqKE/EDqllcodIDsJ

glennblock commented 9 years ago

Nope, there is a fourth option ;-) You can get the binaries off chocolatey, there is no need for binaries in nuget. You can curl Chocolatey to get the package which is just a zip. If you rip it open the binaries are there.

See the binaries section here: https://github.com/scriptcs/scriptcs/wiki/Installing-on-Mac-and-Linux

This has our chocolatey daily build, but you can also use a URL against the main chocolatey feed.

On Wednesday, September 24, 2014, Richard Astbury notifications@github.com wrote:

Thanks Glenn,

I started off on the nuget.exe approach, but to my surprise msbuild sorted out the nuget dependencies for me. xbuild on linux did not.

I guess there are a few options here, and I'm not sure which is the best:

  1. Put all binaries in nuget

If we compiled the module and made that a nuget package too, we don't take a dependency on msbuild. The question is how do you get the nuget packages down?

  • Assume that nuget.exe is on the path? (probably not)
  • Bundle nuget.exe in the npm package?
  • Write a node script to download nuget.exe?
  • Write a node script to download the packages (a node version of nuget.exe)? (too much work!)
  • Write a node script to download the chocolatey package?
    1. Put all the binaries in the npm package

We could just ship all the binaries in the npm package. This seems like the most simple solution, but it feels like the wrong approach.

  1. Compile the module, download the dependencies

This is the current approach, and is in keeping with how native modules generally work in npm. The problem is that msbuild has moved out of .NET, and into Visual Studio. Which is an annoying dependency to have. The story is better on mono, as xbuild ships with the framework.

Ideally there should be a repository for node binaries. Which is something I've mentioned before: https://groups.google.com/d/msg/nodejs/Ckfw2DmUqKE/EDqllcodIDsJ

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4#issuecomment-56642062 .

richorama commented 9 years ago

Sounds good. What about the edge-scs binary? Build it?

glennblock commented 9 years ago

I would just include it as Tomek did for edge proper

On Wednesday, September 24, 2014, Richard Astbury notifications@github.com wrote:

Sounds good. What about the edge-scs binary? Build it?

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4#issuecomment-56648144 .

richorama commented 9 years ago

Super. I'll make it so.

richorama commented 9 years ago

Right, the install script now downloads the package from myget.

Unfortunately it doesn't really contribute a great deal, as most of the dependencies are already included in the bin folder of the scs project.

It does get these though:

lib/ICSharpCode.NRefactory.CSharp.dll
lib/ICSharpCode.NRefactory.dll
lib/Mono.CSharp.dll
lib/Mono.Cecil.dll
lib/Newtonsoft.Json.dll
lib/PowerArgs.dll
lib/ScriptCs.Engine.Mono.dll
lib/scriptcs.exe
lib/scriptcs.exe.config
glennblock commented 9 years ago

Hi Richard

Great.

Let's rip the dependencies and only include the JS file and the dll. The dependences can all be delivered via the install script. Thoughts?

On Wed, Sep 24, 2014 at 5:39 AM, Richard Astbury notifications@github.com wrote:

Right, the install script now downloads the package from myget.

Unfortunately it doesn't really contribute a great deal, as most of the dependencies are already included in the bin folder of the scs project.

It does get these though:

lib/ICSharpCode.NRefactory.CSharp.dll lib/ICSharpCode.NRefactory.dll lib/Mono.CSharp.dll lib/Mono.Cecil.dll lib/Newtonsoft.Json.dll lib/PowerArgs.dll lib/ScriptCs.Engine.Mono.dll lib/scriptcs.exe lib/scriptcs.exe.config

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4#issuecomment-56663431 .

richorama commented 9 years ago

Gah, I've broken something.

Stack overflow exceptions...

richorama commented 9 years ago

I've got it working, but I've had to keep scriptcs to 0.8.1.

Attempts to upgrade to 0.10.2 result in errors (key missing from a dictionary).

Ready to merge. I'll re-attempt an upgrade on another PR.

glennblock commented 9 years ago

This is probably because you need to configure the engine. Let me take your PR and upgrade it.

On Thursday, September 25, 2014, Richard Astbury notifications@github.com wrote:

I've got it working, but I've had to keep scriptcs to 0.8.1.

Attempts to upgrade to 0.10.2 result in errors (key missing from a dictionary).

Ready to merge. I'll re-attempt an upgrade on another PR.

— Reply to this email directly or view it on GitHub https://github.com/scriptcs-contrib/edge-scs/pull/4#issuecomment-56809130 .

glennblock commented 9 years ago

Hi @richorama I am testing this out now. I am getting a StackOverFlowException when I try to get edge to load edge-scs.

This after doing an npm install using the source folder and installing into a temp dir. Debugging now....

glennblock commented 9 years ago

@richorama weird, if I recompile the dll in VS it worked...stay tuned.

glennblock commented 9 years ago

OK @richorama not sure why that failed, but I am going to take the PR and then upgrade to work with the latest scriptcs.

Thanks a ton for this!

glennblock commented 9 years ago

@richorama looks like the dll that is included for edge-scs is messed up. If i recompile it's fine. I am going to push an update and see if that fixes.

glennblock commented 9 years ago

OK so that fixed it, but now I have a periodic error I am seeing related to Zlib.

I have only seen it periodically but it is troubling. I wonder if it has to do with long-name paths. When it happens if I install again it works.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Chocolatey\\lib\\nodist.0.3.12-beta\\tools\\nodist-master\\bin\\\\node.exe" "C:\\Chocolatey\\lib\\nodist.0.3.12-beta\\tools\\nodist-master\\bin\\node_modules\\npm\\cli.js" "install" "https://github.com/scriptcs-contrib/edge-scs/tarball/master"
npm ERR! cwd C:\src\test
npm ERR! node -v v0.10.20
npm ERR! npm -v 1.3.15
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\src\test\npm-debug.log
npm ERR! not ok code 0
glennblock commented 9 years ago

The plot thickens. So it turns out the installs script was not grabbing "enough", it needed to grab the Roslyn packages as well. I updated the script to now do that, and it works. You can test by doing: npm install https://github.com/scriptcs-contrib/edge-scs/tarball/master and then running this simple hello world below taken from the README:

var edge = require('edge');
var hello = edge.func('scs', function() {/*
static object Invoke(string s) {
    return s;
}
*/});

hello("Hello from scriptcs", function(error,result) {
    if (error) throw error;
    console.log(result);
}); 

It should output:

C:\src\test> node test.js
Hello from scriptcs

Now to upgrade to the latest bits and see what happens!