Quantcast
Channel: The book of inspiration » javascript
Viewing all articles
Browse latest Browse all 10

ReferenceWebSource

$
0
0

Good news! Your java application can now be compiled from source code on a web site. I am so excited:D

Disclaimer: This is a quick and dirty post.

by mxgraph

The new Pre-build event looks like this:

C:\util\jsc\bin\jsc.meta.exe ReferenceWebSource /ProjectFileName:”$(ProjectPath)”

Seriously, the other day I saw a blog post about how to make T4 download source code for you. At first I thought, thats just insane. It is a serious security liability. You will compile source code which you may have not written.

Update: I added the link. How long until the computer will automatically link to the posts by description? :D 5 years?

jsc.meta now supports this new command ReferenceWebSource, which basically scans your project and downloads references source files from the internet, compiles them, merges them, adds some attributes and adds the new assembly to your project as a reference. This opens up a whole new group of possibilites.

The upper projects are supposed to be external projects written by other developers. Your project is the ReferencingWebSource project. As you can see there are multiple folders in that project suffixed with WebSource. Each of those which has a references.txt file is basically a list of source codes on the web. They can point either to .vb or .cs.

ACME.X.WebSource.references.txt:

http://jsc.svn.sourceforge.net/viewvc/jsc/examples/java/ReferencingWebSource/MySnippetProject/ACME/Class1.cs

http://jsc.svn.sourceforge.net/viewvc/jsc/examples/java/ReferencingWebSource/MySnippetProjectVB/Class1.vb

The source code could be generated by the web server on the fly. Talk about WSDL in C# :) And after the downloaded code is compiled jsc.meta could apply any additional IL translation it wants to on it. It could go ahead and infer new types from existing code…

After you load your project you should do a build. This will invoke the pre build event and update the dynamic reference.

Here is an example of how I can use it in my project. Remember those Class1 types are downloaded via HTTP GET.

This feature is new and not fault tolerant. Oh and this windows forms project is also compiled to java.

Update: Future extension points:

  1. Reference source code in a zip or tar file.
  2. Reference assets within flash files
  3. Reference 3D objects within google warehouse.
  4. Reference HTML design documents
  5. Reference online wave files and compile them as inline components
  6. Reference windows forms textual design
  7. Reference game maker games for their assets
  8. Cache downloaded files for offline scenarios
  9. Check for forbidden API usage to increase security
  10. Reference HTML file with links to images and have them converted to embedded assets
  11. Reference UML diagrams and create components with (network) events?
  12. Reference XSD, XML, JSON to create serializeable DOM’s.
  13. Reference native classes. BCL assembly should be merged with the reference.
  14. Reference HTML DOM as IDL
  15. Reference static HTML file to inject dynamic code
  16. Merge current and sattelite assemblies and dump unused sattelite types to reduce code size.
  17. Reference open source .net projects and simplify by recompiling  them to be used with jsc

Tagged: javascript

Viewing all articles
Browse latest Browse all 10

Trending Articles