GithubHelp home page GithubHelp logo

isabella232 / jsinterop-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/jsinterop-generator

0.0 0.0 0.0 632 KB

Generates Java annotated with JsInterop from JavaScript extern sources

License: Apache License 2.0

Shell 1.94% Java 81.03% JavaScript 7.79% Starlark 9.25%

jsinterop-generator's Introduction

JsInterop Generator · Build Status

The jsinterop generator is a java program that takes closure extern files as input and generates Java classes annotated with JsInterop annotations.

This project is used for building Elemental2. Any other uses are experimental. You can use it to generate java APIs for other javascript libraries but we don't provide any official support. Feel free to open issues on the github issue tracker, though.

Run with Bazel

If your project uses Bazel. You can use jsinterop_generator rule to generate java code.

You need to add this repository as an external dependency in your WORKSPACE file

new_http_archive(
  name = "com_google_jsinterop_generator",
  url="https://github.com/google/jsinterop-generator/archive/master.zip",
  strip_prefix="jsinterop-generator-master",
)

and then define a jsinterop_generator target in your 'BUILD' file

load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator")

jsinterop_generator(
    name = "my_thirdparty_lib",
    srcs = ["my_externs.js"],
)

You can now directly depend on :my_thirdparty_lib target in your java_library rules or build the jar files with bazel build //path/to/your/BUILD/file/directory:my_thirdparty_lib. The jar files with the generated source will created in bazel-bin/path/to/your/BUILD/file/directory.

Run as a standalone java program

Build the generator from source

    $ npm install -g @bazel/bazelisk
    $ alias bazel=bazelisk
  • Clone this git repository:
    $ git clone https://github.com/google/jsinterop-generator.git
  • Build the binary:
        $ cd jsinterop-generator
        $ bazel build //java/jsinterop/generator/closure:ClosureJsinteropGenerator_deploy.jar

The generated jar file can be found at bazel-bin/java/jsinterop/generator/closure/ClosureJsinteropGenerator_deploy.jar

Or download the generator

TODO(dramaix): provides link to download the generator.

Run the generator

Now you have the jar file, just invoke

java -jar /path/to/ClosureJsinteropGenerator_deploy.jar [options] externs_file...

List of required options :

Option Meaning
--output file Path to the jar file that will contain the generated java classes
--output_dependency_file file Path to the dependency file generated by the generator.
--package_prefix string Prefix used when we build the java package
--extension_type_prefix string Value used for prefixing extension types. It's a good practice to pass the name of the library in upper camel case.

Contributing

Please refer to the contributing document.

Licensing

Please refer to the license file.

Disclaimer

This is not an official Google product.

jsinterop-generator's People

Contributors

cushon avatar gkdn avatar jdramaix avatar lauraharker avatar niloc132 avatar nreid260 avatar philwo avatar realityforge avatar rluble avatar vegegoku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.