Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Buggaboo/xtend-j2objc-template

Repository files navigation

Xtend 2 Java 2 Objective C (2 Swift?)

This project is a demo on how to transpile to Obj C from Xtend.

How to get this project up and running

In a (tmux) terminal:

Prepare j2objc-gradle

  1. Install brew
  2. First, install java jdk 1.7: brew tap caskroom/versions ; brew cask install caskroom/versions/java7, otherwise you will get a café babe. Caveat: Do not run the install-osx-jdk7.sh script unless you want to lose all your JDKs.
  3. Install jenv and add your jdk environments to jenv: brew install jenv ; find /Library/Java/JavaVirtualMachines -name 'Home' -exec jenv add {} \;
  4. Build the jenv shell 1.7 ; cd j2objc-gradle ; ./gradlew clean build
  5. Prepare the project itself, setup 'local.properties' for j2objc: cd xtendAllPlatforms ; ./run-me-first

Prepare Xtendroid

  1. Be consistent and build with jdk 1.7: jenv shell 1.7
  2. Determine the development branch on Xtendroid: cd Xtendroid ; git branch --all
  3. Change to the development branch: git checkout $(git branch --all | egrep -o "v[0-9]+\.[0-9]+_development")

Workflow

  1. Be consistent and build with jdk 1.7: jenv shell 1.7
  2. Import ':xtendshared' into your IDE (intellij / Android Studio), work from there as usual; ':xtendshared' has its own gradle rootProject, because ':xtendshared' requires gradle-2.10, and j2objc-gradle requires gradle-2.3.
  3. Run gradle wrapper to generate a gradlew file
  4. Every time ':xtendshared' is built (./gradlew build), the java files will be copied to the ':shared' project, ':xtendapp' can also make ':xtendshared' start building
  5. The same applies to ./gradlew cAT, these will be transpiled to Objective C as well
  6. Transpiling to j2objc, requires you run (./gradlew build j2objcBuild) in the directory xtendAllPlatforms

Roadmap

  • Create a task that determines the xtend code's package name, then obliterates ':shared' copy of the java files depending on that package name
  • Write a wiki quote apps in XCode (swift) and Android Studio (>2.0.0 alpha) that uses the :shared project, just like the wikiquotes-api project.
  • Eliminate dead code, with proguard and j2objc
  • When j2obcj-gradle finally upgrades to >gradle-2.8, then we can merge the Xtendroid part

Handy things to know

  • Forget about URI.Builder, also forget UrlBuilder, roll your own
  • Run unit tests with xtendAllPlatforms> ./gradlew cleanTest test and if you're confident ./gradlew build
  • Transpile from Xtend to java with xtendshared> ./gradlew build cAT, which triggers the copy actions
  • HttpUrlConnection is very broken when cast to a java.net.ssl.HttpsUrlConnection, IosHttpsUrlConnection seems to be promising, must do additional testing on j2objc-1.0.1.

About

Transpile xtend to java to objective C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published