Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Oct 31, 2016
1 parent bea8615 commit 24982c6
Showing 1 changed file with 95 additions and 8 deletions.
103 changes: 95 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Vaadin gwt-api-generator is a tool that produces GWT Java APIs for JavaScript li

Currently the generator only supports Web Components written in Polymer 1.0 syntax. Support for other type of JavaScript sources might be added in the future.

Original motivation behind the project was to provide GWT community an easy access to the elements in [Vaadin Elements](https://github.com/vaadin/vaadin-elements) library.
Original motivation behind the project was to provide GWT community an easy access to the elements in [Vaadin Elements](https://github.com/vaadin/vaadin-core-elements) collection.

## Installation and Usage

Expand Down Expand Up @@ -46,10 +46,12 @@ $ npm install -g vaadin/gwt-api-generator

## Pre-built packages

### Paper, Iron and Vaadin-Core elements
### Paper, Iron, App, Platinum, and Vaadin-Core elements

Vaadin officially maintains and supports a pre-built package deployed at Maven Central repository containing all the resources needed for using Polymer
[paper-elements](https://elements.polymer-project.org/browse?package=paper-elements),
[app-elements](https://elements.polymer-project.org/browse?package=app-elements),
[platinum-elements](https://elements.polymer-project.org/browse?package=platinum-elements),
[iron-elements](https://elements.polymer-project.org/browse?package=iron-elements) and
[vaadin-core-elements](https://vaadin.com/elements)
in a GWT application.
Expand All @@ -58,15 +60,100 @@ Build script, demo and usage instructions for the project are available [here](h

You also might see all these components in action using the [Show Case](http://vaadin.github.io/gwt-polymer-elements/demo/) application

## Using your own Web Components in your App.

Whether you need a 3 party element not included in the prebuilt packages or you want to maintain your own set of components, you can setup your maven project to automatically generate Java interfaces during the build process just following the next steps.

1. Create a `package.json` with the `gwt-api-generator` package dependency:

{
"name": "my-app",
"description": "my-app",
"version": "1.0",
"license": "my-prefered-license",
"dependencies": {
"gwt-api-generator": "vaadin/gwt-api-generator"
}
}


2. Create a `bower.json` to add all 3rd party elements your application depends on, in this example we add a library for binding data to pouchdb/couchdb databases:

{
"name": "my-app",
"description": "my-app",
"main": "",
"license": "my-prefered-license",
"dependencies": {
"vaadin-pouchdb": "manolo/vaadin-pouchdb"
}
}

3. Make your maven build script to automatically install node, npm and bower, download all elements, generate java classes and bundle static stuff in your package:

<!-- install node, npm, bower, and your components -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>install node and npm</id>
<phase>generate-resources</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v6.2.0</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- Generate java code for all web downloaded components -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<exec
dir="${project.basedir}"
executable="node_modules/.bin/gwt-api-generator">
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

## About GWT 2.7/2.8 compatibility

Vaadin gwt-api-generator produces `@JsType` interfaces for JS Element level access from Java Objects.

Generated classes are written using Java 1.7 syntax, and rely on GWT JSInterop available as an experimental feature from GWT 2.7.0, and will be stable in GWT 2.8.0.
## About GWT 2.7/2.8 compatibility

But, starting with gwt-api-generator 1.2.1, GWT 2.7.0 is not supported anymore since the experimental version of jsInterop in 2.7.0 does not support JsFunctions.
Vaadin gwt-api-generator produces `@JsType` interfaces for JS Element level access from Java Objects.

Additionally JsInterop has suffered a complete API change in 2.8.0, so old syntax will be deprecated and remove.
Since `JsInterop` was a feature experimental in GWT-2.7.0 and stable in GWT-2.8.0, and its implementation has absolutly changed from the experimental to the stable API, we have decided not to support old releases anymore, starting with gwt-api-generator 1.2.1.

So, will encourage to make your project depend on GWT 2.8.0-SNAPSHOT and use new JsInterop syntax.

0 comments on commit 24982c6

Please sign in to comment.