# jsinterop-generator **Repository Path**: mirrors_google/jsinterop-generator ## Basic Information - **Project Name**: jsinterop-generator - **Description**: Generates Java annotated with JsInterop from JavaScript extern sources - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-01-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # JsInterop Generator · ![Latest Release](https://img.shields.io/github/v/release/google/jsinterop-generator) · [![Build Status](https://github.com/google/jsinterop-generator/actions/workflows/ci.yaml/badge.svg)](https://github.com/google/jsinterop-generator/actions/workflows/ci.yaml) The jsinterop generator is a java program that takes closure extern files as input and generates Java classes annotated with [JsInterop annotations](https://goo.gl/agme3T). > *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 --------------- Using Bazel 8 or later, add to your `MODULE.bazel` file: ```starlark bazel_dep(name = "jsinterop_generator", version = "") ``` Replace `RELEASE_VERSION` with an actual [release version](https://github.com/google/jsinterop-generator/releases). Then, in your `BUILD` file, load the generator rule and use it: ```bzl load("@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 - Install [Bazelisk](https://github.com/bazelbuild/bazelisk): ```shell $ npm install -g @bazel/bazelisk $ alias bazel=bazelisk ``` - Clone this git repository: ```shell $ git clone https://github.com/google/jsinterop-generator.git ``` - Build the binary: ```shell $ 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` ### 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](CONTRIBUTING.md). Licensing --------- Please refer to [the license file](LICENSE). Disclaimer ---------- This is not an official Google product.