SlideShare a Scribd company logo
1 of 23
Download to read offline
Hacking the Source - Part V
The iOS app is surprisingly easy when compared to the Android app. There are some nuances but overall the process is pretty simple.
cd vm/JavaAPI
ant clean jar
cd ../ByteCodeTranslator
ant jar
cd ../../Ports/iOSPort
ant jar
Compile VM & Port
First we need to compile the VM & the port. So we need to go back to the cn1 directory and execute these commands.
GIT:
https://github.com/orfjackal/retrolambda
Binary:
https://oss.sonatype.org/content/groups/public/net/orfjackal/retrolambda/
Retrolambda Download
We also need retrolambda which we can compile from https://github.com/orfjackal/retrolambda or download the binary from https://oss.sonatype.org/content/groups/
public/net/orfjackal/retrolambda/retrolambda/

I won't go into the compilation process of retrolambda as I just downloaded the binary. I created a new KitchenSinkIOS folder and placed that binary there.
mkdir kitchenClasses
java -Dretrolambda.defaultMethods=true -Dretrolambda.inputDir=../KitchenSink/build/
classes -Dretrolambda.classpath=../cn1/vm/JavaAPI/build/classes:../cn1/CodenameOne/
build/classes -Dretrolambda.outputDir=kitchenClasses -Dretrolambda.bytecodeVersion=49 -
jar retrolambda-2.5.3.jar
Retrolambda Translate
We can run retrolambda with the following command. Once this command is complete a version of kitchen sink classes targeting JDK 5 resides under the kitchenClasses
directory. I won’t go into details about this command as I think you would be better served by the documentation in the retrolambda project.
package com.codename1.demos.kitchen;
import com.codename1.ui.Display;
public class KitchenSinkStub implements Runnable {
@Override
public void run() {
KitchenSink k = new KitchenSink();
k.init(this);
k.start();
}
public static void main(String[] args) {
Display.init(new KitchenSinkStub());
}
}
KitchenSinkStub (iOS)
The next step is to create and compile the stub class which we will use to launch the implementation. In the KitchenSinkIOS folder I created a stub directory. I then added
the KitchenSinkStub.java to that directory. The one interesting thing in this stub is the fact that the implementation invokes the runnable callback when its ready.
Everything else is is really trivial.
javac -classpath kitchenClasses:../cn1/CodenameOne/build/
classes:../cn1/Ports/iOSPort/build/classes stub/
KitchenSinkStub.java -source 1.5 -target 1.5 -d stub
Compiling the Stub
This can be compiled using this command. Notice that I used source 1.5 level when compiling. This is crucial as the VM doesn't support Java 8 directly. We use
retrolambda to add support for Java 8 language features but don’t do that on the stub.
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
Once we do this we can create the output folder xcodeproj and run the VM translation code. There is a lot to digest in this command so I'll break it down to one argument
at a time.

This should be pretty easy. We are running the VM translator. It's just an executable jar.
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
Represents the VM target OS. This is currently the only supported option. In the future we might support additional targets for the VM
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
Next we have the path. Bash understands this as multiple commands so we have to put the entire path in quotes. These are the individual elements within. The first
element in the path is the stubs directory where I compiled the KitchenSinkStub before
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
The second element is the classes of the VM. This covers the java core classes supported by Codename One
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
These are the actual classes of the app after they went through the retrolambda process
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
these are the classes of the iOS port/implementation
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
these are the core implementation classes of Codename One itself
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
these are Objective-C sources that implement the native code referenced from the iOS port
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
This is the target output directory we created above this will include the output project
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
This is the name of the stub class we created
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
This is the package name of the stub and the application itself
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
These are the title and version number of the application
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
This is the target type. ios indicates a universal iPad/iPhone app but you can specify iphone or ipad here
mkdir xcodeproj
java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios
"stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/
iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/
iOSPort/nativeSources" xcodeproj KitchenSinkStub
com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios
"CoreImage.framework;QuartzCore.framework"
Generating the Code
And finally these are the included native libraries/frameworks. Codename One requires these two by default. Now that this is all done we have an xcode project under
xcodeproj/dist.
xcode Architectures
© Codename One 2017 all rights reserved
We can double click the project to launch xcode this instantly opens a ready to run file but first we need to fix a few things...

The first step is picking the main project area and select Build Settings. Then click the Architectures entry and select Standard Architectures.
Fonts
© Codename One 2017 all rights reserved
The next step is font registrations. We need two fonts, one is handlee which is used in the demo. The second is the material design font which is used for common icons
in Codename One. To do this we need to select the Build Settings tab and in it add an attribute for fonts by clicking the small + button next to one of the attributes. In iOS
you need to declare TTF files included in the project and can't use them otherwise. The build servers do that automatically.

You should be able to type “Fonts provided by application” and xcode will offer that string as you type. Once you select that you should have one entry called “Item 0”
and you should be able to add another one. Type in the font file names for the project specifically: material-design-font.ttf & Handlee-Regular.ttf. Notice that these are
case sensitive…
Update XIB’s
© Codename One 2017 all rights reserved
Notice that this step is currently necessary but it might be unnecessary in the future. We need to update the 2 xib files in the application and select the deployment target
as 8. Notice that xcode sometimes fails to accept this selection and I personally had to restart it twice.

Now that all of this is done you should be able to press play in xcode and run the Codename One application!

More Related Content

Similar to Hacking the Codename One Source Code - Part V - Transcript.pdf

Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerChris Adkin
 
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_ComposePhoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_ComposeYeong Sheng Tan
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzSteve Hoffman
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on DockerBen Hall
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsBen Hall
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725miguel dominguez
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725MortazaJohari
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Yevgeniy Brikman
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformniyof97
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool boxbpowell29a
 
Trust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker ContainersTrust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker ContainersNan Liu
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshareCavelle Benjamin
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunSaiyam Pathak
 
Jazoon12 355 aleksandra_gavrilovska-1
Jazoon12 355 aleksandra_gavrilovska-1Jazoon12 355 aleksandra_gavrilovska-1
Jazoon12 355 aleksandra_gavrilovska-1Netcetera
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 

Similar to Hacking the Codename One Source Code - Part V - Transcript.pdf (20)

Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_ComposePhoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
 
Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on Docker
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based Deployments
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Trust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker ContainersTrust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker Containers
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
 
Jazoon12 355 aleksandra_gavrilovska-1
Jazoon12 355 aleksandra_gavrilovska-1Jazoon12 355 aleksandra_gavrilovska-1
Jazoon12 355 aleksandra_gavrilovska-1
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 

More from ShaiAlmog1

The Duck Teaches Learn to debug from the masters. Local to production- kill ...
The Duck Teaches  Learn to debug from the masters. Local to production- kill ...The Duck Teaches  Learn to debug from the masters. Local to production- kill ...
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
 
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfShaiAlmog1
 
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdfcreate-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdfShaiAlmog1
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfShaiAlmog1
 
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdfcreate-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdfShaiAlmog1
 
create-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdfcreate-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdfShaiAlmog1
 
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdfcreate-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdfShaiAlmog1
 
create-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdfcreate-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdfShaiAlmog1
 
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfcreate-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfShaiAlmog1
 
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdfcreate-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdfShaiAlmog1
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfShaiAlmog1
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfShaiAlmog1
 
create-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdfcreate-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfCreating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdfCreating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdfCreating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfCreating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfCreating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfShaiAlmog1
 
Creating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdfCreating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdfShaiAlmog1
 

More from ShaiAlmog1 (20)

The Duck Teaches Learn to debug from the masters. Local to production- kill ...
The Duck Teaches  Learn to debug from the masters. Local to production- kill ...The Duck Teaches  Learn to debug from the masters. Local to production- kill ...
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
 
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdf
 
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdfcreate-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdf
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdf
 
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdfcreate-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdf
 
create-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdfcreate-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdf
 
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdfcreate-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdf
 
create-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdfcreate-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdf
 
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfcreate-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdf
 
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdfcreate-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdf
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
 
create-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdfcreate-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdf
 
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfCreating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdf
 
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdfCreating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdf
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
 
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdfCreating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdf
 
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfCreating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
 
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfCreating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdf
 
Creating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdfCreating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdf
 

Recently uploaded

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Hacking the Codename One Source Code - Part V - Transcript.pdf

  • 1. Hacking the Source - Part V The iOS app is surprisingly easy when compared to the Android app. There are some nuances but overall the process is pretty simple.
  • 2. cd vm/JavaAPI ant clean jar cd ../ByteCodeTranslator ant jar cd ../../Ports/iOSPort ant jar Compile VM & Port First we need to compile the VM & the port. So we need to go back to the cn1 directory and execute these commands.
  • 3. GIT: https://github.com/orfjackal/retrolambda Binary: https://oss.sonatype.org/content/groups/public/net/orfjackal/retrolambda/ Retrolambda Download We also need retrolambda which we can compile from https://github.com/orfjackal/retrolambda or download the binary from https://oss.sonatype.org/content/groups/ public/net/orfjackal/retrolambda/retrolambda/ I won't go into the compilation process of retrolambda as I just downloaded the binary. I created a new KitchenSinkIOS folder and placed that binary there.
  • 4. mkdir kitchenClasses java -Dretrolambda.defaultMethods=true -Dretrolambda.inputDir=../KitchenSink/build/ classes -Dretrolambda.classpath=../cn1/vm/JavaAPI/build/classes:../cn1/CodenameOne/ build/classes -Dretrolambda.outputDir=kitchenClasses -Dretrolambda.bytecodeVersion=49 - jar retrolambda-2.5.3.jar Retrolambda Translate We can run retrolambda with the following command. Once this command is complete a version of kitchen sink classes targeting JDK 5 resides under the kitchenClasses directory. I won’t go into details about this command as I think you would be better served by the documentation in the retrolambda project.
  • 5. package com.codename1.demos.kitchen; import com.codename1.ui.Display; public class KitchenSinkStub implements Runnable { @Override public void run() { KitchenSink k = new KitchenSink(); k.init(this); k.start(); } public static void main(String[] args) { Display.init(new KitchenSinkStub()); } } KitchenSinkStub (iOS) The next step is to create and compile the stub class which we will use to launch the implementation. In the KitchenSinkIOS folder I created a stub directory. I then added the KitchenSinkStub.java to that directory. The one interesting thing in this stub is the fact that the implementation invokes the runnable callback when its ready. Everything else is is really trivial.
  • 6. javac -classpath kitchenClasses:../cn1/CodenameOne/build/ classes:../cn1/Ports/iOSPort/build/classes stub/ KitchenSinkStub.java -source 1.5 -target 1.5 -d stub Compiling the Stub This can be compiled using this command. Notice that I used source 1.5 level when compiling. This is crucial as the VM doesn't support Java 8 directly. We use retrolambda to add support for Java 8 language features but don’t do that on the stub.
  • 7. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code Once we do this we can create the output folder xcodeproj and run the VM translation code. There is a lot to digest in this command so I'll break it down to one argument at a time. This should be pretty easy. We are running the VM translator. It's just an executable jar.
  • 8. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code Represents the VM target OS. This is currently the only supported option. In the future we might support additional targets for the VM
  • 9. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code Next we have the path. Bash understands this as multiple commands so we have to put the entire path in quotes. These are the individual elements within. The first element in the path is the stubs directory where I compiled the KitchenSinkStub before
  • 10. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code The second element is the classes of the VM. This covers the java core classes supported by Codename One
  • 11. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code These are the actual classes of the app after they went through the retrolambda process
  • 12. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code these are the classes of the iOS port/implementation
  • 13. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code these are the core implementation classes of Codename One itself
  • 14. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code these are Objective-C sources that implement the native code referenced from the iOS port
  • 15. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code This is the target output directory we created above this will include the output project
  • 16. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code This is the name of the stub class we created
  • 17. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code This is the package name of the stub and the application itself
  • 18. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code These are the title and version number of the application
  • 19. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code This is the target type. ios indicates a universal iPad/iPhone app but you can specify iphone or ipad here
  • 20. mkdir xcodeproj java -jar ../cn1/vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar ios "stub;../cn1/vm/JavaAPI/build/classes;kitchenClasses;../cn1/Ports/ iOSPort/build/classes;../cn1/CodenameOne/build/classes;../cn1/Ports/ iOSPort/nativeSources" xcodeproj KitchenSinkStub com.codename1.demos.kitchen "Kitchen Sink" "1.0" ios "CoreImage.framework;QuartzCore.framework" Generating the Code And finally these are the included native libraries/frameworks. Codename One requires these two by default. Now that this is all done we have an xcode project under xcodeproj/dist.
  • 21. xcode Architectures © Codename One 2017 all rights reserved We can double click the project to launch xcode this instantly opens a ready to run file but first we need to fix a few things... The first step is picking the main project area and select Build Settings. Then click the Architectures entry and select Standard Architectures.
  • 22. Fonts © Codename One 2017 all rights reserved The next step is font registrations. We need two fonts, one is handlee which is used in the demo. The second is the material design font which is used for common icons in Codename One. To do this we need to select the Build Settings tab and in it add an attribute for fonts by clicking the small + button next to one of the attributes. In iOS you need to declare TTF files included in the project and can't use them otherwise. The build servers do that automatically. You should be able to type “Fonts provided by application” and xcode will offer that string as you type. Once you select that you should have one entry called “Item 0” and you should be able to add another one. Type in the font file names for the project specifically: material-design-font.ttf & Handlee-Regular.ttf. Notice that these are case sensitive…
  • 23. Update XIB’s © Codename One 2017 all rights reserved Notice that this step is currently necessary but it might be unnecessary in the future. We need to update the 2 xib files in the application and select the deployment target as 8. Notice that xcode sometimes fails to accept this selection and I personally had to restart it twice. Now that all of this is done you should be able to press play in xcode and run the Codename One application!