j2objc-contrib / j2objc-gradle

This plugin is no longer actively maintained. J2ObjC Gradle Plugin: enables Java source to be part of an iOS application's build so you can write an app's non-UI code (such as application logic and data models) in Java, which is then shared by Android apps (natively Java) and iOS apps (using J2ObjC), all as part of your usual Android Gradle build.
https://github.com/j2objc-contrib/j2objc-gradle
Apache License 2.0
139 stars 43 forks source link

Download and install specific J2ObjC version #255

Open brunobowden opened 9 years ago

brunobowden commented 9 years ago

Ideally the plugin should be self-contained and download the J2ObjC release as required. Currently you're required to download the release and unzip it yourself. This would also allow easy switching of libraries. It must use the Gradle Dependency Cache so that it isn't deleted during a clean command. This is all part of making it easier to use.

Talking with Ben Muschko from Gradle: In the dependency declaration you'd have to use the "ext" attribute to tell Gradle what the file extension should be. Pulling it from a non-standard repository layout will require you to declare github.com as Ivy repository with the appropriate format.

Reference: https://docs.gradle.org/1.8-rc-1/userguide/dependency_management.html#ssub:artifact_dependencies

Example download url: https://github.com/google/j2objc/releases/download/0.9.7/j2objc-0.9.7.zip

confile commented 9 years ago

@brunobowden I like your idea. But, we should postpone this until the major bug from version are resolved.

advayDev1 commented 9 years ago

This should be optional however. I often use a particular j2objc commit built locally.

brunobowden commented 9 years ago

Of course it would be optional

On Mon, Jun 29, 2015 at 9:26 AM Advay Mengle notifications@github.com wrote:

This should be optional however. I often use a particular j2objc commit built locally.

— Reply to this email directly or view it on GitHub https://github.com/j2objc-contrib/j2objc-gradle/issues/255#issuecomment-116749899 .

advayDev1 commented 9 years ago

If we get around to doing this, we should check out: https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ToolsLocator.groovy

It would allow us to use the built-in dependency management to download a particular version of j2objc published to a particular repository. Of course, j2objc would have to publish itself to maven central or what-have-you to make this work.

brunobowden commented 9 years ago

Funny... I was thinking exactly the same thing ;-)

This'll make for a much better experience when trying the app for the first time.

On Sun, Aug 16, 2015 at 12:45 PM Advay Mengle notifications@github.com wrote:

If we get around to doing this, we should check out:

https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ToolsLocator.groovy

It would allow us to use the built-in dependency management to download a particular version of j2objc published to a particular repository. Of course, j2objc would have to publish itself to maven central or what-have-you to make this work.

— Reply to this email directly or view it on GitHub https://github.com/j2objc-contrib/j2objc-gradle/issues/255#issuecomment-131612717 .

advayDev1 commented 9 years ago

my only concern is how this will affect our up-to-date checks. the protobuf plugin references doesn't use @Input and @Output correctly like we do. they create all their tasks in afterEvaluate.

I don't know if the create a configuration + create a dependency technique will work for us :/

brunobowden commented 9 years ago

@zhangkun83 - we're working on the Gradle J2ObjC Plugin. We were interested in adding support to allow it to download and use the j2objc binaries, similarly as you recently developed it for the protoc gradle plugin: https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ToolsLocator.groovy

Please see the previous comment from @advayDev1. Have you considered using the @Input and @Output mechanisms to better handle dependencies in Gradle?

zhangkun83 commented 9 years ago

I didn't have time to look into @Input and @OutputFile etc. Based on what I have just read, I should be able to add them to my plugin. That said, I believe it only affects the handling of incremental builds, not dependencies.

brunobowden commented 9 years ago

If you do any PRs for @Output / @Input, feel free to cc me for review.

On Mon, Aug 17, 2015 at 9:50 AM Kun Zhang notifications@github.com wrote:

I didn't have time to look into @Input and @OutputFile etc. Based on what I have just read, I should be able to add them to my plugin. That said, I believe it only affects the handling of incremental builds, not dependencies.

— Reply to this email directly or view it on GitHub https://github.com/j2objc-contrib/j2objc-gradle/issues/255#issuecomment-131887193 .

advayDev1 commented 9 years ago

@brunobowden per our other discussion on this, I do not believe this is possible to do correctly. Since we must support users who do have a specific version of j2objc already installed, I believe there is no algorithm to distinguish between whether the person has merely not configured j2objc correctly (but has it installed) vs. they have no j2objc installed and they want us to do it for them without asking.

brunobowden commented 9 years ago

If they specify a specific J2ObjC version in their build.gradle file, then I take that to mean that they want us to automatically handle this. In which case, perhaps look for a j2objc.download or similar in local.properties.

On Mon, Oct 26, 2015 at 2:08 AM Advay Mengle notifications@github.com wrote:

@brunobowden https://github.com/brunobowden per our other discussion on this, I do not believe this is possible to do correctly. Since we must support users who do have a specific version of j2objc already installed, I believe there is no algorithm to distinguish between whether the person has merely not configured j2objc correctly (but has it installed) vs. they have no j2objc installed and they want us to do it for them without asking.

— Reply to this email directly or view it on GitHub https://github.com/j2objc-contrib/j2objc-gradle/issues/255#issuecomment-151068144 .