Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Support, limited to translation only #345

Closed
gocursor opened this issue Aug 14, 2015 · 11 comments
Closed

Windows Support, limited to translation only #345

gocursor opened this issue Aug 14, 2015 · 11 comments
Assignees
Milestone

Comments

@gocursor
Copy link

j2objc-gradle plugin should also run on Windows - just cycle finder and translation to ObjectiveC as mentioned on http://j2objc.org/docs/Getting-Started.html#how-do-i-run-on-windows-or-linux (both Gradle and j2objc can run on Windows).

Prefered way of using whould be inside "gradle build" task, so it can be used within multi-project gradle structure. Currently "gradle build" fails on Windows, because OS X specific tasks can not be disabled.

@gocursor
Copy link
Author

@advayDev1: Regarding "additional tasks disabled": if I disable all known OS X specific tasks, the "build gradle" still fails...

I could disable these tasks:
j2objcPackLibrariesDebug { enabled = false }
j2objcAssembleDebug { enabled = false }
j2objcPackLibrariesRelease { enabled = false }
j2objcAssembleRelease { enabled = false }

but the plugin fails with this error:
:app-ios:clean
:app-ios:compileJava
:app-ios:processResources UP-TO-DATE
:app-ios:classes
:app-ios:compileTestJava UP-TO-DATE
:app-ios:processTestResources UP-TO-DATE
:app-ios:testClasses UP-TO-DATE
:app-ios:test UP-TO-DATE
:app-ios:j2objcPreBuild UP-TO-DATE
:app-ios:j2objcTranslate
:app-ios:j2objcAssembleSource
:app-ios:j2objcBuildObjcDebug UP-TO-DATE
:app-ios:j2objcPackLibrariesDebug SKIPPED
:app-ios:j2objcAssembleDebug SKIPPED
:app-ios:j2objcBuildObjcRelease UP-TO-DATE
:app-ios:j2objcPackLibrariesRelease SKIPPED
:app-ios:j2objcAssembleRelease SKIPPED
:app-ios:j2objcAssembleResources
:app-ios:j2objcAssemble
:app-ios:jar
:app-ios:assemble
:app-ios:j2objcCycleFinder SKIPPED
:app-ios:compileDebugTestJ2objcExecutableTestJ2objcObjc FAILED

FAILURE: Build failed with an exception.

I can not disable the task "compileDebugTestJ2objcExecutableTestJ2objcObjc"... Maybe it is possible to disable it, but I don't know how.

Another issue is the skipping of task j2objcCycleFinder which should also work on Windows...

@advayDev1
Copy link
Contributor

@gocursor -

  1. j2objcCycleFinder being skipped is not Windows-specific, see: https://github.com/j2objc-contrib/j2objc-gradle/blob/master/FAQ.md#cycle-finder-basic-setup
  2. all of the compile|link...Objc tasks will indeed fail as they rely on the Mac xcode/clang toolchain. While you are correctly skipping the part the j2objc plugin relies on, Gradle includes the compilation of those binaries automatically in the overall building of the project graph. You should be able to skip them with the following code in your build.gradle (verified to skip the proper tasks on Mac):
// Disables testing
j2objcTestDebug { enabled = false }
j2objcTestRelease { enabled = false }
// Disables compiling/linking of all j2objc sources/libraries/executables
tasks.all { Task task ->
                if ((task.name =~ /^.*((J|j)2objc(Executable|StaticLibrary|SharedLibrary|Objc))$/).matches()) {
                    task.enabled = false
                }
            }

@advayDev1
Copy link
Contributor

@brunobowden - re your point from the PR, j2objc still does not include Windows as a supported platform: http://j2objc.org/#requirements - in that sense I don't see it as different from the PR you just submitted (requirement is Mac, but there's a FAQ for Windows).

also, i'm not opposed to adding a config flag for say 'translationOnlyMode' or similar that disables everything but j2objc translate (which is useful regardless of Windows). i'm also not opposed to fixing regular defects in our Java re: cross-platform correctness (i.e. like PR #343 ). what I think we should not do is add Windows-specific code (like a 'Windows mode' that automatically disables non-translation) or formally support Windows until/unless j2objc does as well.

@gocursor
Copy link
Author

I agree that everything should be as platform independent as possible. I am also against "Windows mode". If I have gained the voting rights, I vote for 'translationOnlyMode' flag... :-)

With your help I created a configuration for "gradle build" which works under Windows:

// Disable all OS X specific tasks
j2objcPackLibrariesDebug { enabled = false }
j2objcAssembleDebug { enabled = false }
j2objcTestDebug { enabled = false }
j2objcPackLibrariesRelease { enabled = false }
j2objcAssembleRelease { enabled = false }
j2objcTestRelease { enabled = false }
tasks.all { Task task ->
    if ((task.name =~ /^.*((J|j)2objc(Executable|StaticLibrary|SharedLibrary|Objc))$/).matches()) {
        task.enabled = false
    }
}

Ideally all those tasks would be disabled with the proposed "translationOnlyMode" flag.

@advayDev1
Copy link
Contributor

So you've confirmed that works on Windows?

Btw, I've posted a question to the j2objc community here:
https://groups.google.com/forum/#!topic/j2objc-discuss/4mTtOMnwCrw

I'd like to hear others' use-cases for doing this - please add yours' too if you'd like!

@gocursor
Copy link
Author

@advayDev1 Regarding j2objcCycleFinder: I have enabled it with "j2objcCycleFinder { enabled = true }" and it works. But I had to set cycleFinderExpectedCycles to 34. Did the expected number of erroneous matches with jre_emul library change in latest J2ObjC version? Is there a way to make the default value of "cycleFinderExpectedCycles" dependent on the J2ObjC version?

@advayDev1
Copy link
Contributor

@gocursor - Please open a new issue re: cycle finder expected cycles; it should be unrelated to Windows/translation-only. I'll respond on that new issue.

@gocursor
Copy link
Author

I am confirming that the above configuration works on Windows!

Here is the "gradle build" output:

:app-ios:clean
:app-ios:compileJava
:app-ios:processResources UP-TO-DATE
:app-ios:classes
:app-ios:compileTestJava UP-TO-DATE
:app-ios:processTestResources UP-TO-DATE
:app-ios:testClasses UP-TO-DATE
:app-ios:test UP-TO-DATE
:app-ios:j2objcPreBuild UP-TO-DATE
:app-ios:j2objcTranslate
:app-ios:j2objcAssembleSource
:app-ios:j2objcBuildObjcDebug UP-TO-DATE
:app-ios:j2objcPackLibrariesDebug SKIPPED
:app-ios:j2objcAssembleDebug SKIPPED
:app-ios:j2objcBuildObjcRelease UP-TO-DATE
:app-ios:j2objcPackLibrariesRelease SKIPPED
:app-ios:j2objcAssembleRelease SKIPPED
:app-ios:j2objcAssembleResources
:app-ios:j2objcAssemble
:app-ios:jar
:app-ios:assemble
:app-ios:j2objcCycleFinder
:app-ios:compileDebugTestJ2objcExecutableTestJ2objcObjc SKIPPED
:app-ios:compileX86_64DebugApp-ios-j2objcStaticLibraryApp-ios-j2objcObjc SKIPPED
:app-ios:createX86_64DebugApp-ios-j2objcStaticLibrary SKIPPED
:app-ios:x86_64DebugApp-ios-j2objcStaticLibrary SKIPPED
:app-ios:linkDebugTestJ2objcExecutable SKIPPED
:app-ios:debugTestJ2objcExecutable SKIPPED
:app-ios:j2objcTestDebug SKIPPED
:app-ios:compileReleaseTestJ2objcExecutableTestJ2objcObjc SKIPPED
:app-ios:compileX86_64ReleaseApp-ios-j2objcStaticLibraryApp-ios-j2objcObjc SKIPPED
:app-ios:createX86_64ReleaseApp-ios-j2objcStaticLibrary SKIPPED
:app-ios:x86_64ReleaseApp-ios-j2objcStaticLibrary SKIPPED
:app-ios:linkReleaseTestJ2objcExecutable SKIPPED
:app-ios:releaseTestJ2objcExecutable SKIPPED
:app-ios:j2objcTestRelease SKIPPED
:app-ios:j2objcTest
:app-ios:check
:app-ios:j2objcBuildDebug UP-TO-DATE
:app-ios:j2objcBuildRelease UP-TO-DATE
:app-ios:j2objcBuild UP-TO-DATE
:app-ios:build

BUILD SUCCESSFUL

@advayDev1
Copy link
Contributor

Thanks, filed separate #347 to support translation-only mode.
Keeping this issue open pending decision on if and how much we support Windows specifically.

@gocursor
Copy link
Author

Thank you! :-)

advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 14, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 14, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 14, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 15, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 16, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 16, 2015
@advayDev1 advayDev1 changed the title Windows Support Windows Support, limited to translation only Aug 16, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 16, 2015
advayDev1 added a commit to madvay/j2objc-gradle that referenced this issue Aug 16, 2015
@advayDev1
Copy link
Contributor

for the limited translation functionality only, this is fixed.

@advayDev1 advayDev1 added this to the 0.5 Release milestone Aug 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants