Re: GWT Dagger 2

2015-02-24 Thread Vasco Andrade Silva
Jens thank you for your reply.

What's the best way to include your PR (
https://github.com/google/dagger/pull/119) in a project?

On Tuesday, February 24, 2015 at 1:54:57 PM UTC, Jens wrote:

 You need to add the generated sources as Eclipse source folder to make 
 them usable in Eclipse, e.g.: 
 http://stackoverflow.com/questions/7160006/m2e-and-having-maven-generated-source-folders-as-eclipse-source-folders

 Maybe the above also fixes the gwt:compile class path issue.

 For successful GWT compilation you also need Dagger + javax.inject sources 
 and a GWT module to make them available to GWT compiler. I have done an 
 initial pull request for Dagger to simplify that in the future: 
 https://github.com/google/dagger/pull/119

 -- J.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: GWT Dagger 2

2015-02-24 Thread Vasco Andrade Silva
Errata: 

The project class paths that are included in GWT compile command are:
/path/to/project/target/tmp/WEB-INF/classes
*/path/to/project/src/main/java*


On Tuesday, February 24, 2015 at 1:29:17 PM UTC, Vasco Andrade Silva wrote:

 Hi all,

 I've been trying Dagger 2 with GWT and have been fighting to get things 
 working. Could someone help?

 My pom:

 dependency
  groupIdcom.google.dagger/groupId
  artifactIddagger/artifactId
  version2.0-SNAPSHOT/version
 /dependency
 dependency
  groupIdcom.google.dagger/groupId
  artifactIddagger-compiler/artifactId
  version2.0-SNAPSHOT/version
  optionaltrue/optional
 /dependency


 [...]


 plugin
  groupIdorg.codehaus.mojo/groupId
  artifactIdgwt-maven-plugin/artifactId
  version${gwtVersion}/version
  executions
  execution
  goals
  goalcompile/goal
  goaltest/goal
  /goals
  /execution
  /executions
  configuration
   modulemy.Module/module
  extraJvmArgs-Xmx2048M -XX:MaxPermSize=128M/extraJvmArgs
  runTargetindex.html/runTarget
  warSourceDirectory${project.build.directory}/${tmpTargetDirectory}
 /warSourceDirectory
  buildOutputDirectory
 ${project.build.directory}/${tmpTargetDirectory}/WEB-INF/classes/
 /buildOutputDirectory
  hostedWebapp${project.build.directory}/${tmpTargetDirectory}
 /hostedWebapp
  webappDirectory${project.build.directory}/${tmpTargetDirectory}
 /webappDirectory
  webXml${project.build.directory}/${tmpTargetDirectory}/WEB-INF/webXml
  generateDirectorysrc/main/java/generateDirectory
  bindAddress0.0.0.0/bindAddress
  jsInteropModeJS/jsInteropMode
  closureCompilertrue/closureCompiler
  /configuration
 /plugin


 My issues are:

 *#1 generated sources aren't available for gwt compilation*
 running:

 mvn compile

 no errors are found in the compilation phase, dagger 2 generated sources 
 land in *target/generated-sources/annotations/*

 However running:

 mvn compile gwt:compile

 GWT compilation outputs the following error:

 [ERROR] Errors in 
 'file:/path/to/project/src/main/java/path/to/project/client/ProjectEntryPoint.java'
 [INFO] [ERROR] Line 79: No source code is available for type path.to.
 project.client.Dagger_ProjectComponent; did you forget to inherit a 
 required module? 
 [INFO] [ERROR] Hint: Check the inheritance chain from your module; it may 
 not be inheriting a required module or a module may not be adding its 
 source path entries properly



 the problem seems related with the fact that GWT compilation isn't 
 including the generated sources, as target/generated-sources/annotations/ 
 isn't included in the classpath of the GWT compiler. The project class 
 paths that are included in GWT compile command are:
 /path/to/project/target/tmp/WEB-INF/classes
 /path/to/project/target/src/main/java


 *#2 Eclipse doesn't follow Dagger 2 generate sources (not related with 
 GWT per-si)*
 I configured Eclipse (Luna edition) with m2e-apt plugin (
 http://marketplace.eclipse.org/content/m2e-apt). My project works as a 
 maven project in Eclipse.

 However when I change something in dagger (Component, Module, etc.) the 
 generated sources aren't immediately generated, I need to do Maven  
 Update Project.

 *#3 Eclipse imports errors on Dagger 2 generated files open **(not 
 related with GWT per-si)*
 When I open a file that was generated by dagger 2 (in 
 target/generated/sources/annotations) eclipse doesn't know how to import 
 other sources from target/generated/sources/annotations which lead to 
 several compile time errors in those generated files. Additionally, from 
 that point on Eclipse confuses himself and makes the project source files 
 (in src/main/java) that are referring to generated dagger files 
 (e.g. Dagger_ProjectComponent) to also be in error (eclipse doesn't know 
 anymore to import those symbols).

 To overcome this I have to do Maven  Update Project. Note, however, 
 that every time I open a dagger2 generated file, this happens again.

 --
 Has someone succeeded getting dagger 2 and GWT (and Eclipse) working 
 together smoothly?

 Also, any help to overcome the reported issues would be great (specially 
 issue #1).

 Thank you,
 Vasco


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


GWT Dagger 2

2015-02-24 Thread Vasco Andrade Silva
Hi all,

I've been trying Dagger 2 with GWT and have been fighting to get things 
working. Could someone help?

My pom:

dependency
 groupIdcom.google.dagger/groupId
 artifactIddagger/artifactId
 version2.0-SNAPSHOT/version
/dependency
dependency
 groupIdcom.google.dagger/groupId
 artifactIddagger-compiler/artifactId
 version2.0-SNAPSHOT/version
 optionaltrue/optional
/dependency


[...]


plugin
 groupIdorg.codehaus.mojo/groupId
 artifactIdgwt-maven-plugin/artifactId
 version${gwtVersion}/version
 executions
 execution
 goals
 goalcompile/goal
 goaltest/goal
 /goals
 /execution
 /executions
 configuration
  modulemy.Module/module
 extraJvmArgs-Xmx2048M -XX:MaxPermSize=128M/extraJvmArgs
 runTargetindex.html/runTarget
 warSourceDirectory${project.build.directory}/${tmpTargetDirectory}
/warSourceDirectory
 buildOutputDirectory
${project.build.directory}/${tmpTargetDirectory}/WEB-INF/classes/
/buildOutputDirectory
 hostedWebapp${project.build.directory}/${tmpTargetDirectory}
/hostedWebapp
 webappDirectory${project.build.directory}/${tmpTargetDirectory}
/webappDirectory
 webXml${project.build.directory}/${tmpTargetDirectory}/WEB-INF/webXml
 generateDirectorysrc/main/java/generateDirectory
 bindAddress0.0.0.0/bindAddress
 jsInteropModeJS/jsInteropMode
 closureCompilertrue/closureCompiler
 /configuration
/plugin


My issues are:

*#1 generated sources aren't available for gwt compilation*
running:

mvn compile

no errors are found in the compilation phase, dagger 2 generated sources 
land in *target/generated-sources/annotations/*

However running:

mvn compile gwt:compile

GWT compilation outputs the following error:

[ERROR] Errors in 
'file:/path/to/project/src/main/java/path/to/project/client/ProjectEntryPoint.java'
[INFO] [ERROR] Line 79: No source code is available for type path.to.project
.client.Dagger_ProjectComponent; did you forget to inherit a required module
? 
[INFO] [ERROR] Hint: Check the inheritance chain from your module; it may 
not be inheriting a required module or a module may not be adding its 
source path entries properly



the problem seems related with the fact that GWT compilation isn't 
including the generated sources, as target/generated-sources/annotations/ 
isn't included in the classpath of the GWT compiler. The project class 
paths that are included in GWT compile command are:
/path/to/project/target/tmp/WEB-INF/classes
/path/to/project/target/src/main/java


*#2 Eclipse doesn't follow Dagger 2 generate sources (not related with 
GWT per-si)*
I configured Eclipse (Luna edition) with m2e-apt plugin 
(http://marketplace.eclipse.org/content/m2e-apt). My project works as a 
maven project in Eclipse.

However when I change something in dagger (Component, Module, etc.) the 
generated sources aren't immediately generated, I need to do Maven  
Update Project.

*#3 Eclipse imports errors on Dagger 2 generated files open **(not related 
with GWT per-si)*
When I open a file that was generated by dagger 2 (in 
target/generated/sources/annotations) eclipse doesn't know how to import 
other sources from target/generated/sources/annotations which lead to 
several compile time errors in those generated files. Additionally, from 
that point on Eclipse confuses himself and makes the project source files 
(in src/main/java) that are referring to generated dagger files 
(e.g. Dagger_ProjectComponent) to also be in error (eclipse doesn't know 
anymore to import those symbols).

To overcome this I have to do Maven  Update Project. Note, however, that 
every time I open a dagger2 generated file, this happens again.

--
Has someone succeeded getting dagger 2 and GWT (and Eclipse) working 
together smoothly?

Also, any help to overcome the reported issues would be great (specially 
issue #1).

Thank you,
Vasco

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: GWT Dagger 2

2015-02-24 Thread Vasco Andrade Silva
Thank you Thomas and Jens.

Thomas, I was using v. 2.3.2 for maven-compiler-plugin, upgraded to 3.2 and 
everything worked without build-helper-maven-plugin as you described - 
thanks!

Jens, I did as you said and everything worked! I Hope that the Dagger 2 
team merge your PR asap - thank you!

I couldn't make Eclipse work as good as it should (still have issues #2 and 
#3) and I'm still relying on Maven  Update Project - I'll deep dive in 
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html 
and see if I can make any progress.

On Tuesday, February 24, 2015 at 5:07:04 PM UTC, Thomas Broyer wrote:



 On Tuesday, February 24, 2015 at 2:29:17 PM UTC+1, Vasco Andrade Silva 
 wrote:

 My issues are:

 *#1 generated sources aren't available for gwt compilation*
 running:

 mvn compile

 no errors are found in the compilation phase, dagger 2 generated sources 
 land in *target/generated-sources/annotations/*

 However running:

 mvn compile gwt:compile

 GWT compilation outputs the following error:

 [ERROR] Errors in 
 'file:/path/to/project/src/main/java/path/to/project/client/ProjectEntryPoint.java'
 [INFO] [ERROR] Line 79: No source code is available for type path.to.
 project.client.Dagger_ProjectComponent; did you forget to inherit a 
 required module? 
 [INFO] [ERROR] Hint: Check the inheritance chain from your module; it 
 may not be inheriting a required module or a module may not be adding 
 its source path entries properly



 the problem seems related with the fact that GWT compilation isn't 
 including the generated sources, as target/generated-sources/annotations/ 
 isn't included in the classpath of the GWT compiler. The project class 
 paths that are included in GWT compile command are:
 /path/to/project/target/tmp/WEB-INF/classes
 /path/to/project/target/src/main/java



 Which version of the maven-compiler-plugin are you using? m-compiler-p 
 didn't add the generated-sources to the compileSourceRoots until version 
 3.2: https://jira.codehaus.org/browse/MCOMPILER-157, so you had to use 
 the build-helper-maven-plugin to add it.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Troubles Getting Started with JsInterop

2015-02-14 Thread Vasco Andrade Silva
Thank you Joseph for your comment.

Just a little bit more info, I've also tried with GWT 2.8.0-SNAPSHOT without 
success from:

repository
  idgoogle-snapshots/id
  urlhttps://oss.sonatype.org/content/repositories/google-snapshots//url
  releases
enabledfalse/enabled
  /releases
  snapshots
enabledtrue/enabled
  /snapshots
 /repository


What I find very odd is both the Nextgen GWT/JS Interop (Public) 
https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#
 and 
the talk refer to the Js.js method and @JsExport in such a clear way..

On Saturday, February 14, 2015 at 4:52:35 AM UTC, Joseph Gardi wrote:

 I was disappointed that there was no Js.js. I think there is no Js.js 
 because according to the release notes they just started implementing 
 experimental js annotations. It didn't say anything about Js.js. Js.js will 
 probably be in 2.8. I think 2.8 will come out within the next couple of 
 months although you can never be sure with an open source project. I don't 
 know how to fix you're exporting problem but I wasn't able to get it 
 working either. The release notes did say that there'd be bugs and this 
 might be one of them. 

 On Friday, February 13, 2015 at 8:47:20 PM UTC-5, Vasco Andrade Silva 
 wrote:

 Hi all,

 I'm just starting with JsInterop but I can't figure out why some of the 
 things aren't working.

 First thing first: I'm using GWT 2.7 and I've setup maven/pom 
 with -XjsInteropMode via jsInteropModeJS/jsInteropMode 
 configuration:

 !-- GWT Maven Plugin --
 plugin
   groupIdorg.codehaus.mojo/groupId
   artifactIdgwt-maven-plugin/artifactId
   version${gwtVersion}/version
   […]
   configuration
 […]
 jsInteropModeJS/jsInteropMode
   /configuration
 /plugin

 I tested that the flag was being correctly set by passing wrong values 
 and see that the compiler didn't run. I also followed 
 https://github.com/gwt-maven-plugin/gwt-maven-plugin/issues/89

 I have the following dependencies declared in my pom:
 dependency 
  groupIdcom.google.gwt/groupId 
  artifactIdgwt-user/artifactId 
  version${gwtVersion}/version 
  scopeprovided/scope 
 /dependency
 dependency 
  groupIdcom.google.gwt/groupId 
  artifactIdgwt-dev/artifactId 
  version${gwtVersion}/version 
  scopeprovided/scope
 /dependency


 So my problems are the following:

 *Issue #1: Can't find the JS.js method anywhere*
 In the Deep dive JS Interop from Ray Cromwell at GWT.create 2015 (
 slides 
 https://docs.google.com/a/byclosure.com/file/d/0ByS1wxINeBWjeGYxbkJpamxFZ28/edit)
  
 there are several slides that refer to a (static) js method. Nextgen 
 GWT/JS Interop (Public) 
 https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#
  also 
 refers this method. However I can't find this method... Where is it? How 
 can I make my application use it?

 I manage to make use of @JsType/@JsProperty via a JSNI method and an 
 Overlay Type, but I what I really wanted is not having to write any JSNI at 
 all.

 @JsType
 public interface UserJs {
 @JsProperty String getName();
 @JsProperty String getEmail();
 }

 public static native UserJs getUser() /*-{
 return $wnd.User;
 }-*/;


 *Issue #2: Can't make @JsExport work*
 I tried several combinations of @JsExport based on the previous slides 
 and Nextgen GWT/JS Interop (Public) 
 https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#
  but 
 couldn't manage to have any symbol exported to the global JS namespace. 
 E.g. I couldn't make the following example from Ray's Deep dive JS 
 Interop talk work:

 @JsNamespace(mylib)
 class Foo {
  @JsExport
  public static final int CONSTANT = 42;
 }


 mylib, Foo, or CONSTANT symbols aren't available in the JS runtime. What 
 am I doing wrong?


 Thank you in advance,
 Vasco



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Troubles Getting Started with JsInterop

2015-02-14 Thread Vasco Andrade Silva
Thank you Jens for your comment.

So my *Issue #1 *is closed until the JS.js method (or other alike) is out. 
By the way isn't there any library you know that has an implementation for 
a method like that?

However I was lazy regarding my copy for *Issue #2 *as I had the Foo class 
public - didn't work. Did you manage to get a simple @JsExport working?


On Saturday, February 14, 2015 at 7:56:57 PM UTC, Jens wrote:

 I guess you have to make your Foo class public. While code examples in the 
 doc uses default visibility I guess it is just because of laziness during 
 writing the doc ;-)

 Here is a recent commit that enforces public visibility: 

 https://gwt-review.googlesource.com/#/c/11490/

 Well and as already said the JS.js functionality is simply not yet 
 implemented. So you have to use JSNI factory methods for now.

 -- J.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Troubles Getting Started with JsInterop

2015-02-14 Thread Vasco Andrade Silva
New insights: I manage to get the things working with @JsNamespace(*$wnd.*
mylib) However, I ran in the following issues:

   - I've to reboot super dev mode each time I change the namespace
   - If I call @JsExport(name) (with a name) the symbol isn't exported to 
   the namespace no more (it only worked with @JsExport without arguments)
  - I also tested with @JsExport($wnd.name) without success
   - I couldn't mage to @JsExport to work with @JsType (not sure if I did 
   and understand everything correctly)


On Saturday, February 14, 2015 at 8:12:46 PM UTC, Vasco Andrade Silva wrote:

 Thank you Jens for your comment.

 So my *Issue #1 *is closed until the JS.js method (or other alike) is 
 out. By the way isn't there any library you know that has an implementation 
 for a method like that?

 However I was lazy regarding my copy for *Issue #2 *as I had the Foo 
 class public - didn't work. Did you manage to get a simple @JsExport 
 working?


 On Saturday, February 14, 2015 at 7:56:57 PM UTC, Jens wrote:

 I guess you have to make your Foo class public. While code examples in 
 the doc uses default visibility I guess it is just because of laziness 
 during writing the doc ;-)

 Here is a recent commit that enforces public visibility: 

 https://gwt-review.googlesource.com/#/c/11490/

 Well and as already said the JS.js functionality is simply not yet 
 implemented. So you have to use JSNI factory methods for now.

 -- J.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Troubles Getting Started with JsInterop

2015-02-13 Thread Vasco Andrade Silva
Hi all,

I'm just starting with JsInterop but I can't figure out why some of the 
things aren't working.

First thing first: I'm using GWT 2.7 and I've setup maven/pom 
with -XjsInteropMode via jsInteropModeJS/jsInteropMode 
configuration:

!-- GWT Maven Plugin --
plugin
  groupIdorg.codehaus.mojo/groupId
  artifactIdgwt-maven-plugin/artifactId
  version${gwtVersion}/version
  […]
  configuration
[…]
jsInteropModeJS/jsInteropMode
  /configuration
/plugin

I tested that the flag was being correctly set by passing wrong values and 
see that the compiler didn't run. I also followed 
https://github.com/gwt-maven-plugin/gwt-maven-plugin/issues/89

I have the following dependencies declared in my pom:
dependency 
 groupIdcom.google.gwt/groupId 
 artifactIdgwt-user/artifactId 
 version${gwtVersion}/version 
 scopeprovided/scope 
/dependency
dependency 
 groupIdcom.google.gwt/groupId 
 artifactIdgwt-dev/artifactId 
 version${gwtVersion}/version 
 scopeprovided/scope
/dependency


So my problems are the following:

*Issue #1: Can't find the JS.js method anywhere*
In the Deep dive JS Interop from Ray Cromwell at GWT.create 2015 (slides 
https://docs.google.com/a/byclosure.com/file/d/0ByS1wxINeBWjeGYxbkJpamxFZ28/edit)
 
there are several slides that refer to a (static) js method. Nextgen 
GWT/JS Interop (Public) 
https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#
 also 
refers this method. However I can't find this method... Where is it? How 
can I make my application use it?

I manage to make use of @JsType/@JsProperty via a JSNI method and an 
Overlay Type, but I what I really wanted is not having to write any JSNI at 
all.

@JsType
public interface UserJs {
@JsProperty String getName();
@JsProperty String getEmail();
}

public static native UserJs getUser() /*-{
return $wnd.User;
}-*/;


*Issue #2: Can't make @JsExport work*
I tried several combinations of @JsExport based on the previous slides and 
Nextgen 
GWT/JS Interop (Public) 
https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#
 but 
couldn't manage to have any symbol exported to the global JS namespace. 
E.g. I couldn't make the following example from Ray's Deep dive JS 
Interop talk work:

@JsNamespace(mylib)
class Foo {
 @JsExport
 public static final int CONSTANT = 42;
}


mylib, Foo, or CONSTANT symbols aren't available in the JS runtime. What am 
I doing wrong?


Thank you in advance,
Vasco

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.