Comments (17)
Just finished getting Guava integrated and working. Inject is now added.
Now going through the dagger 2 examples. Hopefully I'll get something up
and running tomorrow. Also thanks for sharing your own demo.
On Sun Feb 08 2015 at 8:37:17 PM Confile [email protected] wrote:
Did you make any progress on using Dagger2 with J2Objc?
I created a demo with made it work with GWT:
https://github.com/confile/GWT-Dagger2-Demo—
Reply to this email directly or view it on GitHub
https://github.com/brunobowden/j2objc-gradle/issues/4.
from j2objc-gradle.
Just look at my example project it will save you a lot of time.
The only thing which is missing is adding the dagger2 jar to J2Objc. This must be done via classpath. I did not understood how to add multiple jars to the classpath using your gradle plugin.
If you did this I would be happy if you could post it to me.
Here you can see how to configure your build.gradle for dagger2.
Here is a simple dagger example you can copy and paste. Use it like this:
MyWidgetGinjector injector = Dagger_MyWidgetGinjector.create();
SomeService service = injector.getSomeService();
Hope this helps!
from j2objc-gradle.
I manage to translate a simple project which included dagger2. Using javac
and j2objc
worked fine even with the generated classes from the Dagger Components. I mean the Dagger_....java
files.
I created this pull request: https://github.com/brunobowden/j2objc-gradle/pull/10 so you can specify the source path of the annotation processor output.
Here is the configuration I use:
translateFlags """--no-package-directories --prefixes prefixes.properties --mapping method-mappings.properties -use-arc -classpath ${projectDir}/lib/dagger-2.0-SNAPSHOT.jar"""
My generated files in build/source/apt
are:
Dagger_MyWidgetGinjector.java
MyWidgetClientModule$$ProvideSomeServiceFactory.java
(Based on this project: https://github.com/confile/GWT-Dagger2-Demo)
Here is what I get while doing the translation:
error: /Users/mg/Documents/Grails/GGTS3.6.2/TestJ2Objc/build/source/apt/com/example/incrementer/shared/test2/Dagger_MyWidgetGinjector.java:26: MyWidgetClientModule$$ProvideSomeServiceFactory cannot be resolved to a type
translating /Users/mg/Documents/Grails/GGTS3.6.2/TestJ2Objc/build/source/apt/com/example/incrementer/shared/test2/MyWidgetClientModule$$ProvideSomeServiceFactory.java
Translated 8 files: 1 errors, 0 warnings
Do you have any idea what to do here? Thank for your help.
from j2objc-gradle.
I should post my command line compile command as well. The following works perfect:
javac -d build/classes -sourcepath src/main/java:build/source/apt src/main/java/com/example/incrementer/shared/SomeEvent.java src/main/java/com/example/incrementer/shared/NumberIncrementer.java src/main/java/com/example/incrementer/shared/JSNIExample.java src/main/java/com/example/incrementer/shared/test2/SomeService.java src/main/java/com/example/incrementer/shared/test2/SomeServiceImpl.java src/main/java/com/example/incrementer/shared/test2/MyWidgetClientModule.java src/main/java/com/example/incrementer/shared/test2/MyWidgetGinjector.java build/source/apt/com/example/incrementer/shared/test2/Dagger_MyWidgetGinjector.java -classpath lib/dagger-2.0-SNAPSHOT.jar:lib/javax.inject-1.jar
The generated file MyWidgetClientModule$$ProvideSomeServiceFactory.java
is also compiled although I did not explicitly call ed it in the javac command. When I put this file in the javac classpath then I get an error
javac: file not found: build/source/apt/com/example/incrementer/shared/test2/MyWidgetClientModule55781ProvideSomeServiceFactory.java
I guess this is because of you $ sign. May be this causes you plugin to fail to translate too?
from j2objc-gradle.
@brunobowden Did you make any progress on this issue?
from j2objc-gradle.
I haven't done any additional work on this gem, and have no immediate
plans. We have ended up abandoning j2objc for our current project.
On Wed, Mar 4, 2015 at 10:15 AM, Confile [email protected] wrote:
@brunobowden https://github.com/brunobowden Did you make any progress
on this issue?—
Reply to this email directly or view it on GitHub
https://github.com/brunobowden/j2objc-gradle/issues/4#issuecomment-77175608
.
from j2objc-gradle.
And what about you @brunobowden ?
from j2objc-gradle.
Hi @confile. I'm busy with some higher priority work right now and
attending the TED conference next week. I'll likely to return to this after
that, in about two weeks tiem.
On Wed, Mar 4, 2015 at 7:53 AM Confile [email protected] wrote:
And what about you @brunobowden https://github.com/brunobowden ?
—
Reply to this email directly or view it on GitHub
https://github.com/brunobowden/j2objc-gradle/issues/4#issuecomment-77183702
.
from j2objc-gradle.
@brunobowden Hi Bruno, did you make any progress o this issue?
from j2objc-gradle.
@brunobowden This is a j2objc issue see google/j2objc#510 (comment)
from j2objc-gradle.
I reopened this issue because translation still raises error. See google/j2objc#513
from j2objc-gradle.
@brunobowden I still struggling with this issue and I need help. Translating dagger and linking to Xcode works fine using the following configuration:
translateFlags """--no-package-directories --prefixes prefixes.properties -use-arc --doc-comments --build-closure
-classpath ${projectDir}/lib/auto-factory-0.1-beta1.jar:${projectDir}/lib/auto-service-1.0-rc1.jar:${projectDir}/lib/guava-16.0.jar:${projectDir}/lib/javawriter-2.4.0.jar:${projectDir}/lib/dagger-1.2.0.jar"""
translateSourcepaths "${projectDir}/libSrc/javax.inject-1-sources.jar:${projectDir}/libSrc/dagger-2.0-SNAPSHOT-sources.jar"
The only problem is that transpiling gives the following warning:
warning: could not find source path for dagger.Provides.Type
If I linke my translated files with Xcode I get the following compiler error:
clang: error: no such file or directory: '/Users/mg/Documents/Grails/GGTS3.6.2/TestJ2Objc/build/j2objc/ApplicationModule$ProvideSomeClassXFactory.m'
clang: error: no input files
If I do not use the @Provides
annotation from dagger2 I can build in Xcode without problems.
Here is the code I use:
package com.example;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
public class ApplicationModule {
@Provides
@Singleton
SomeClassX provideSomeClassX() {
return new SomeClassX();
}
}
and
package com.example;
import dagger.Provides;
public class SomeClassX {
}
If you could solve this last part of the puzzle, then we are done.
from j2objc-gradle.
Here is the latest open issue: google/j2objc#517
from j2objc-gradle.
@confile - excellent writeup on the bug, thanks for taking the time to do
that properly
On Thu, Apr 9, 2015 at 2:33 PM Confile [email protected] wrote:
Here is the latest open issue: google/j2objc#517
https://github.com/google/j2objc/issues/517—
Reply to this email directly or view it on GitHub
https://github.com/brunobowden/j2objc-gradle/issues/4#issuecomment-91361935
.
from j2objc-gradle.
@brunobowden Well I would need a little help on this issue.
from j2objc-gradle.
@brunobowden How do you deal with java files generated with annotation processor which contains $$
from j2objc-gradle.
@brunobowden This is fixed with my latest pull request.
from j2objc-gradle.
Related Issues (20)
- Possible to add *junit* to *spec.libraries* in generated podspec? HOT 1
- Setting xcodeTargetsManualConfig to false for a multi-module project fails HOT 2
- Translation fails to link dependencies HOT 1
- Possible to run an Android build whilst skipping all tasks of the J2ObjC Gradle plugin?
- Extracting resources from source jars HOT 1
- Does not convert app android to Ios HOT 5
- Stripping reflection applies to and breaks tests
- Need to add Guava headers to native compile header search path HOT 2
- Latest version of the Android Plugin for Gradle (2.0.0) requires Gradle 2.10 or later HOT 2
- Test source cannot be moved from default location
- Require way to set extended podspec values HOT 1
- I wrote a few gradle tasks to generate `name.framework`, without pods, >3 votes -> pull request HOT 7
- How to verify translated objective c unit tests ran successfully? HOT 1
- Regexp does not remove zeros at the beginning
- j2objcTestDebug is stuck when prefixes specified HOT 1
- Is this project still active? HOT 3
- Could not compile Source project with createIos_arm64
- How to install or implement in Android studio ??? HOT 1
- Test issue
- rat checks fail with basic $ ./gradlew check on mac HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from j2objc-gradle.