Skip to content

Commit 24982c6

Browse files
committedOct 31, 2016
Update README
1 parent bea8615 commit 24982c6

File tree

1 file changed

+95
-8
lines changed

1 file changed

+95
-8
lines changed
 

‎README.md

+95-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Vaadin gwt-api-generator is a tool that produces GWT Java APIs for JavaScript li
44

55
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.
66

7-
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.
7+
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.
88

99
## Installation and Usage
1010

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

4747
## Pre-built packages
4848

49-
### Paper, Iron and Vaadin-Core elements
49+
### Paper, Iron, App, Platinum, and Vaadin-Core elements
5050

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

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

63+
## Using your own Web Components in your App.
64+
65+
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.
66+
67+
1. Create a `package.json` with the `gwt-api-generator` package dependency:
68+
69+
{
70+
"name": "my-app",
71+
"description": "my-app",
72+
"version": "1.0",
73+
"license": "my-prefered-license",
74+
"dependencies": {
75+
"gwt-api-generator": "vaadin/gwt-api-generator"
76+
}
77+
}
78+
79+
80+
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:
81+
82+
{
83+
"name": "my-app",
84+
"description": "my-app",
85+
"main": "",
86+
"license": "my-prefered-license",
87+
"dependencies": {
88+
"vaadin-pouchdb": "manolo/vaadin-pouchdb"
89+
}
90+
}
91+
92+
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:
93+
94+
<!-- install node, npm, bower, and your components -->
95+
<plugin>
96+
<groupId>com.github.eirslett</groupId>
97+
<artifactId>frontend-maven-plugin</artifactId>
98+
<executions>
99+
<execution>
100+
<id>install node and npm</id>
101+
<phase>generate-resources</phase>
102+
<goals>
103+
<goal>install-node-and-npm</goal>
104+
</goals>
105+
<configuration>
106+
<nodeVersion>v6.2.0</nodeVersion>
107+
</configuration>
108+
</execution>
109+
<execution>
110+
<id>npm install</id>
111+
<goals>
112+
<goal>npm</goal>
113+
</goals>
114+
<configuration>
115+
<arguments>install</arguments>
116+
</configuration>
117+
</execution>
118+
<execution>
119+
<id>bower install</id>
120+
<goals>
121+
<goal>bower</goal>
122+
</goals>
123+
<configuration>
124+
<arguments>install</arguments>
125+
</configuration>
126+
</execution>
127+
</executions>
128+
</plugin>
129+
130+
<!-- Generate java code for all web downloaded components -->
131+
<plugin>
132+
<artifactId>maven-antrun-plugin</artifactId>
133+
<version>1.7</version>
134+
<executions>
135+
<execution>
136+
<phase>generate-resources</phase>
137+
<configuration>
138+
<target>
139+
<exec
140+
dir="${project.basedir}"
141+
executable="node_modules/.bin/gwt-api-generator">
142+
</exec>
143+
</target>
144+
</configuration>
145+
<goals>
146+
<goal>run</goal>
147+
</goals>
148+
</execution>
149+
</executions>
150+
</plugin>
61151

62-
## About GWT 2.7/2.8 compatibility
63152

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

66-
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.
154+
## About GWT 2.7/2.8 compatibility
67155

68-
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.
156+
Vaadin gwt-api-generator produces `@JsType` interfaces for JS Element level access from Java Objects.
69157

70-
Additionally JsInterop has suffered a complete API change in 2.8.0, so old syntax will be deprecated and remove.
158+
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.
71159

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

0 commit comments

Comments
 (0)