manolo / gwt-polymer-elements

Polymer Web Components for GWT. A collection of Material Design widgets for desktop and mobile.
Apache License 2.0
155 stars 49 forks source link

Update to GWT 2.8 new syntax : JS_RC #66

Closed jouni closed 8 years ago

jouni commented 8 years ago

The GWT team is preparing the 2.8 release, and we should update to use the RC once it’s out.

manolo commented 8 years ago

In the meanwhile you should not use latest 2.8.0-SNAPSHOT since it breaks former JsInterop, use this version instead.

2.8.0.VC-SNAPSHOT

Configure maven with this repo:

gwt-snapshots-tmp-repo https://github.com/manolo/gwt-snapshot/raw/master/ true true
frami commented 8 years ago

When will gwt-polymer-elements compatible with the latest JsInterop syntax?

jouni commented 8 years ago

Collateral work:

manolo commented 8 years ago

For reviewers: latest demos are deployed to gh-pages

99sono commented 8 years ago

I am wondering, what exactly is the appropriate version of GWT to use against

<dependency>
   <groupId>com.vaadin.polymer</groupId>
   <artifactId>vaadin-gwt-polymer-elements</artifactId>
   <version>1.2.3.0</version>
   <scope>provided</scope>
 </dependency>

GWT 2.7 simply comes out with compilation errors due tot he JS interop imports. Therefore the turotiral: http://www.gwtproject.org/doc/latest/polymer-tutorial/create.html

I invalid for this GWT version.

Meanwhile the documentation on git hub also states: "GWT-2.7 and will be stable in GWT-2.8.0, but starting from gwt-polymer-elements-1.2.1.0.beta1,"

Hence I wonder, the 1.2.1 release and the 1.2.3 release are targetting what GWT version exactly?

Finally, in GWT 2.8-beta1 release, if we add the jsInterop=JS to the gwt compiler configuration we get feedback the JS interop is going to be deprecated and in any case, the GWT application when it is running complains that it was not compiled using JS Interop (which is not true).

Can you please provide a pom.xml example that illustrates a setup configuration that should work with the latest release of the vaading polymer library?

Kind regards.

manolo commented 8 years ago

There are many changes coming in gwt-2.8.0, at the beginning we tried not to break backward compatibility making gwt-polymer-elements compile with 2.7 2.8 and JS and JS_RC, but due that JS has been removed, and even 2.8.0-beta1 is broken we decided support only 2.8.0-SNAPSHOT.

The best pom you can take as reference is https://github.com/vaadin/gwt-polymer-elements/blob/master/demo/pom.xml.

We are working on updating polymer tutorial as well as the starter polymer project.

Thanks

99sono commented 8 years ago

Hi Manolo,

Many thanks for your comeback. I will see if I can try the template pom you've referred me to over the weekend. I know that it is a lot of trouble to keep documentation up to date with the ongoing development, but I would recommend whenever one of you guys has the time to quickly make an update on the GWT site documentation, on the tutorial for polymer. The documentation over there lacks at least the information on the compatible version of polymer tested agains GWT 2.7. So the short paragraph you've just given me would help a lot.

One additional question, I've quickly taken a look at the pom an noticed the following:

    <optimizationLevel>9</optimizationLevel>

Is it a requirement for the jsinterop to work for this setting to be configured high, or the draf compiliation - optimization level 1 would aready be good enough? During development time I like for thinks to build fast, therefore i always set optimization level to lowest on a Profile, that I can disable for release. I suspect the optimization level does not matter for the functionality to work.

Kind regards.

confile commented 8 years ago

It seems that vaadin-gwt-polymer-elements:1.1.3.0-alpha1does build with GWT2.7 without errors. Later version do not compile.

manolo commented 8 years ago

@confile We don't support 2.7 anymore since former jsinterop implementation has been officially abandoned in gwt in favor of the new syntax.

@99sono we will update the documentation very soon. Waiting for 2.8.0-beta2 or RC for doing that, since gwt is still changing things. There is not mandatory to define the optimisation level, there were some problems with first jsinterop implementation, but latest works well with any compiler configuration

99sono commented 8 years ago

Using gwt 2.8.0 Snapshot nothing compiles at all.

Even reducing the gwt.xml to just inherit gwt-user and nothing else. And the entry point being empty the gwt 2.8.0 snapshot compiler returns a never ending list of:

Resolving javaemul.internal.DateUtil [INFO] Found type 'javaemul.internal.DateUtil' [INFO] [WARN] Unable to resolve supertype java/lang/Object

For every basic class of the java. Strings, Longs etc... Tweaking down the version of gwt library from snapshot to the beta 1 release the compilation goes back to working properly, only polymer has to be left out.

By the way, the vaadin snapshot repository does not include any publication of gwt polymer. That is not even all that important when the gwt compiler itself seems to not swallow the most basic of gwt.xml definitions.

[INFO] --- gwt-maven-plugin:2.8.0-beta1:compile (default-cli) @ polymer-frontend ---
[INFO] Compiling module org.gwtproject.tutorial.TodoList
[INFO]    Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO]    Resolving com.google.gwt.cell.client.FieldUpdater
[INFO]       Found type 'com.google.gwt.cell.client.FieldUpdater'
[INFO]          [ERROR] Unable to find class java/lang/Object

And it goes on.

To me it looks like it would be really really useful to get a newer snapshot release of both the gwt maven plugin and the gwt 2.8 snapshot along with a polymer release to make working with this library possible.

Meanwhile, I believe the best is to take confiles validation that vaadin-gwt-polymer-elements:1.1.3.0-alpha1 works with 2.7.0 and test it out.

Thanks.

confile commented 8 years ago

Using gwtVersion='2.8.0-SNAPSHOT'and

compile 'com.vaadin.polymer:vaadin-gwt-polymer-elements:1.2.3.0'

it works fine.

99sono commented 8 years ago

What version of the compiler are you using, in this case?

Here is my gwt plugin configuration.

 <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>                
                <dependencies>
                    <!--dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-codeserver</artifactId>
                    </dependency-->
                </dependencies>
                <executions>
                    <!--execution>
                        <id>gwt-i18n</id>
                      <goals>
                        <goal>i18n</goal>
                      </goals>
                    </execution-->   
                    <!-- 
                          References:
                          https://gwt-maven-plugin.github.io/gwt-maven-plugin/compile-mojo.html
                    -->
                    <execution>                       
                        <id>gwt-compile</id>                        
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <!--execution>
                      <id>gwt-generateAsync</id>  
                      <goals>
                        <goal>generateAsync</goal>
                      </goals>
                    </execution-->            
                    <execution>
                        <!-- Run tests through gwt:test, this allows reusing the plugin configuration for GWTTestCases -->
                        <id>gwt-tests</id>
                        <phase>integration-test</phase>     
                        <configuration>
                            <skip>${skipTests}</skip>
                        </configuration>       
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>

                <!-- Plugin configuration. There are many available options, 
                see gwt-maven-plugin documentation at codehaus.org --> 
                <configuration>           
                    <!-- >jsInteropMode>JS_RC</jsInteropMode-->
                    <logLevel>INFO</logLevel>
                    <extraJvmArgs>-Xmx2024M -Xss5024k</extraJvmArgs>    
                    <overlappingSourceWarnings>true</overlappingSourceWarnings>
                    <optimizationLevel>${gwt.compile.optimizationLevel}</optimizationLevel>    

                    <modules>
                        <module>org.gwtproject.tutorial.TodoList</module>
                    </modules>
                    <!-- URL that should be opened by DevMode (gwt:run). -->
                    <runTarget>TodoList.html</runTarget>

                    <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
                    <compileReport>true</compileReport>
                    <!-- Run tests using HtmlUnit -->
                    <mode>htmlunit</mode>
                    <!-- Tests patterns -->
                    <includes>**/*GWTTest.java</includes>
                    <codeServerWorkDir>${project.build.directory}/gwtCodeServerOutput</codeServerWorkDir>
                    <style>${gwt.codeStyle}</style>
                    <noServer>true</noServer>

                    <!-- Instruct GWT to write out the javascript files to a folder served by spring boot-->
                    <!--webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory-->          
                    <webappDirectory>${project.build.directory}/classes/META-INF/resources</webappDirectory>
                    <!--  Properties taken from:
                        https://github.com/vaadin/gwt-polymer-elements/blob/master/demo/pom.xml
                    -->
                    <!-- disableCastChecking>true</disableCastChecking>
                    <disableClassMetadata>true</disableClassMetadata>
                    <enableAssertions>false</enableAssertions>
                    <closureCompiler>true</closureCompiler-->
                    <!--resourceBundles>
                      <resourceBundle>com.mycompany.gwt.Bundle1</resourceBundle>
                      <resourceBundle>com.mycompany.gwt.Bundle2</resourceBundle>            
                    </resourceBundles-->
                </configuration>

            </plugin>     

And as for the repositories:

<repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
        <repository>
            <id>vaadin-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>google-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>snapshots-repo</id>
            <!--<url>https://oss.sonatype.org/content/repositories/google-snapshots</url> -->
            <url>https://oss.sonatype.org/content/repositories/public/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

Finally, if I tweak my gwtVersion to 2.8.0 beta:

INFO] 
[INFO] --- gwt-maven-plugin:2.8.0-beta1:compile (default-cli) @ polymer-frontend ---
[INFO] Compiling module org.gwtproject.tutorial.TodoList
[INFO]    Compiling 1 permutation
[INFO]       Compiling permutation 0...
[INFO]    Compile of permutations succeeded
[INFO]    Compilation succeeded -- 22.491s
[INFO] Linking into /home/user/branches/nuno/polymer-project/polymer-project-frontend/target/classes/META-INF/resources/todolist; Writing extras to /home/user/branches/nuno/polymer-project/polymer-expenses-frontend/target/extra/todolist
[INFO]    Link succeeded
[INFO]    Linking succeeded -- 0.168s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Next, if tweak exclusively the compiler to the snapshot version. I still get to compile:

[INFO] --- gwt-maven-plugin:2.8.0-SNAPSHOT:compile (default-cli) @ polymer-frontend ---
[INFO] Compiling module org.gwtproject.tutorial.TodoList
[INFO]    Compiling 1 permutation
[INFO]       Compiling permutation 0...
[INFO]    Compile of permutations succeeded
[INFO]    Compilation succeeded -- 24.234s
[INFO] Linking into /home/user/branches/nuno/polymer-project/polymer-project-frontend/target/classes/META-INF/resources/todolist; Writing extras to /home/user/branches/nuno/polymer-project/polymer-project-frontend/target/extra/todolist
[INFO]    Link succeeded
[INFO]    Linking succeeded -- 0.162s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.132s

But, as soon as I tweak the gwtVersion property upwards to SNAPSHOT.

[INFO] --- gwt-maven-plugin:2.8.0-SNAPSHOT:compile (default-cli) @ polymer-frontend ---
[INFO] Compiling module org.gwtproject.tutorial.TodoList
[INFO]    Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO]    Resolving com.google.gwt.cell.client.FieldUpdater
[INFO]       Found type 'com.google.gwt.cell.client.FieldUpdater'

And there it is broken. So the compiler does not seem to be the issue. It seems to be the gwt libraries themselves.

The module description itself is as basic as it gets.

<?xml version="1.0" encoding="UTF-8"?>
<!--
  When updating your version of GWT, you should also update this DTD reference,
  so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN"
  "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='todolist'>   

  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>
  <set-property name="user.agent" value="safari"></set-property> 

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->   

   <!-- -->
  <!-- inherits name="com.vaadin.polymer.Elements"/ -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
  <entry-point class='org.gwtproject.tutorial.client.TodoList'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

  <!-- allow Super Dev Mode -->
  <add-linker name="xsiframe"/>
</module>

Ok. We have a wining combination:

<!-- Convenience property to set the GWT version -->
    <gwtVersion>2.7.0</gwtVersion>
    <!-- gwtVersion>2.8.0-beta1</gwtVersion-->
    <!-- gwtVersion>2.8.0-SNAPSHOT</gwtVersion-->
    <polymerVersion>1.1.3.0-alpha1</polymerVersion> <---- You were right this one works with 2.7.0 the paper button now displays with jsInterop JS

    <!-- polymerVersion>1.2.3.0</polymerVersion-->
    <!-- polymerVersion>1.2.3.1-SNAPSHOT</polymerVersion-->

    <gwtMavenPluginVersion>2.7.0</gwtMavenPluginVersion>
    <!-- gwtMavenPluginVersion>2.8.0-SNAPSHOT</gwtMavenPluginVersion-->
    <!-- gwtMavenPluginVersion>2.8.0-SNAPSHOT</gwtMavenPluginVersion-->

I go for now using 2.7.0 and will await another beta release paired by a polymer release to upgrade. Is the polymer alpha1 release very broken? Or the number bugs fixed since then were more enhancement changes to keep the library compatbile with gwt changes? So not as much as bugfixes as rather enhancement development. Because then it is fine to go on using the alpha polymer release.

Many thanks.

confile commented 8 years ago

I use:

java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

and

Gradle 2.5
------------------------------------------------------------

Build time:   2015-07-08 07:38:37 UTC
Build number: none
Revision:     093765bccd3ee722ed5310583e5ed140688a8c2b

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.7.0_67 (Oracle Corporation 24.65-b04)
OS:           Mac OS X 10.10.5 x86_64
99sono commented 8 years ago

I was using

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

But i've tried as well with jdk 1.7, same thing. As soon as the gwt version goes above beta1 to snapshot nothing moves except the stderr.

In any case, the beta1 version still seem to run the alpha1 release of polymer elements. That is as high as I managed to go. alpha1 + gwt 2.8-beta1.

For now I stay at this level as it already allows me to complile everything with jdk 1.8.

Many thanks.