Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::working-with-windows-bash-001[]
mvn -pl common package -Dcodename1.platform=windows -Dcodename1.buildTarget=windows-device
mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device
// end::working-with-windows-bash-001[]
26 changes: 10 additions & 16 deletions docs/developer-guide/Introduction.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ Codename One uses a SaaS-based approach so the information in this appendix migh

Since Android is already based on Java, Codename One is already native to Android and works with the Android VM (ART/Dalvik).

On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit and later introduced bitcode support to iOS. ParparVM needed no modifications to meet those changes.
On iOS, Codename One built and open-sourced ParparVM, which is a conservative VM. ParparVM features a concurrent, non-blocking GC and is written entirely in Java/C. ParparVM is a transpiler that generates C source code matching the given Java bytecode. This means that an Xcode project is generated and compiled on the build servers. It's as if you hand-coded a native app and is thus future-proof against changes that Apple introduces. For example, Apple migrated to 64-bit, then introduced bitcode, then withdrew bitcode again. ParparVM needed no modifications for any of those changes.

NOTE: Codename One translates the bytecode to C, which is faster than Swift/Objective-C. The port code that invokes iOS APIs is hand coded in Objective-C

Codename One earlier offered a UWP (Universal Windows Platform) target based on iKVM. That target was discontinued in release 7.0.229 and is preserved as historical context in older documentation and blog posts.

JavaScript build targets use TeaVM to do the translation statically. TeaVM supports threading using JavaScript by breaking the app down in a rather elaborate way. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.
JavaScript build targets translate the bytecode statically with ParparVM, the same translator that generates the C sources for iOS. Cloud builds keep the original TeaVM-based compiler as a compatibility fallback, which you select with the `javascript.port` build hint. To support the complex UI Codename One uses the HTML5 Canvas API which allows absolute flexibility for building applications.

For desktop builds Codename One uses `javapackager`, since both Macs and Windows machines are available in the cloud, the platform-specific nature of `javapackager` isn't a problem.

Expand All@@ -87,7 +87,7 @@ Lightweight components date back to Smalltalk frameworks, this notion was popula

===== Why ParparVM

On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC as well as 64 bit/bitcode support. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.
On iOS, Codename One uses https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] which translates Java bytecode to C code and boasts a non-blocking GC. This VM is fully open source in the https://github.com/codenameone/CodenameOne/[Codename One git repository]. In the past Codename One used http://www.xmlvm.org/[XMLVM] to generate native code similarly, but the XMLVM solution was too generic for the needs of Codename One. https://github.com/codenameone/CodenameOne/tree/master/vm[ParparVM] boasts a unique architecture of translating code to C (similarly to XMLVM), because of that Codename One is the only solution of its kind that can **guarantee** future iOS compatibility since the officially supported iOS toolchain is always used instead of undocumented behaviors.

NOTE: XMLVM could guarantee that as well, but it's no longer maintained and lacked the API layer support

Expand All@@ -107,7 +107,7 @@ NOTE: The UWP target was discontinued in release 7.0.229 and is no longer part o

===== JavaScript port

The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original http://teavm.org:[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.
The JavaScript port of Codename One uses ParparVM to translate Java bytecode into JavaScript. Cloud builds retain the original https://teavm.org/[TeaVM-based builder] as a compatibility fallback, selected with the public `javascript.port=teavm` build hint.

The JavaScript port allows unmodified Codename One applications to run within a desktop or mobile browser. The port itself is based on the HTML5 Canvas API, which provides a pixel-perfect implementation of the Codename One API.

Expand DownExpand Up@@ -175,9 +175,9 @@ Scrolling poses another challenge in touch-based interfaces. In desktop applicat

Some developers single out this wide range of resolutions and densities as "`device fragmentation.`" While it does contribute to development complexity, it isn't a challenging problem to overcome.

Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. For example, 7 months after the Android 8 (Oreo) release in 2018, it was still available on 1.1% of the devices. The damning statistic is that 12% of the devices in mid 2018 run Android 4.4 Kitkat released in 2013! (((Google)))
Densities aren't the cause of device fragmentation. Device fragmentation is caused by many OS versions with different behaviors. This is clear on Android and relates to the slow rollout of Android vendor versions compared to Google rollout. A new release reaches only a small fraction of devices in its first year, and handsets several major versions behind stay in circulation long after their vendor stops shipping updates for them. (((Google)))

This makes QA difficult as the disparity between these versions is pretty big. These numbers will be out of date by the time you read this, but the core problem remains. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.
This makes QA difficult as the disparity between these versions is pretty big. It's hard to get all device manufacturers aligned, so this problem will probably remain in the foreseeable future despite everything.

==== Performance

Expand DownExpand Up@@ -414,7 +414,7 @@ First, the good news:

In iOS Apple issues the certificates for your applications. That way the certificate is trusted by Apple and is assigned to your Apple iOS developer account. One important caveat applies: You need an iOS Developer Account and Apple charges a 99USD Annual fee for that.

TIP: The 99USD price and need have been around since the introduction of the iOS developer program for 10 years at the time of this writing. It might change at some point though
TIP: The fee and the requirement have been part of the iOS developer program since it was introduced. Check Apple's developer site for the current price.

Apple also requires a "`provisioning profile`" which is a special file bound to your certificate and app. This file describes some details about the app to the iOS installation process. One of the details it includes during development is the list of permitted devices.

Expand DownExpand Up@@ -453,23 +453,17 @@ One important aspect of provisioning on iOS is the device list in the provisioni

WARNING: Many apps and tools offer the UDID of the device, but they aren't necessarily reliable and might give a fake number!

.Get the UDID of a Device
image::img/get-device-udid.png[Get the UDID of a Device]

TIP: You can right-click the UDID and select #copy# to copy it

The simplest and most reliable process for getting a UDID is through iTunes. Other approaches have worked in the past but this approach is guaranteed.
The <<_whats_udid,UDID section of the signing chapter>> covers the reliable ways to read that value.

NOTE: Ad hoc provisioning allows 1000 beta testers for your application but it's a more complex process that you won't discuss here although it's supported by Codename One

===== Build and install

Before you continue with the build you should sign up at https://www.codenameone.com/build-server.html where you can soon follow the progress of your builds. You need a Codename One account to build for the device.

Now that you have certificates, the process of device builds is a right click away for both OSes. You can right-click the project and select #Codename One# -> #Send iOS Debug Build# or #Codename One# -> #Send Android Build#.
Now that you have certificates, a device build is a single Maven goal. From the project's root directory run `mvn cn1:buildAndroid` for Android, or `mvn cn1:buildIos` for an iOS debug build. Each one packages the app, sends it to the Codename One build servers and reports where the result lands.

.Right click menu options for sending device builds
image::img/getting-started-right-click-menu.png[Right click menu options for sending device builds,scaledwidth=50%]
WARNING: Run these from the root, not from a module. The build goals skip any project that isn't the execution root, so `mvn -pl common cn1:buildAndroid` prints "`Skipping execution for non-root project`" and then reports success without building anything.

NOTE: The first time you send a build you will be prompted for the email and password you provided when signing up for Codename One

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/Working-With-Windows.asciidoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,7 @@ above. Trigger it like any other cloud target:
include::../demos/common/src/main/snippets/developer-guide/working-with-windows.sh[tag=working-with-windows-bash-001,indent=0]
----

The convenience goal `mvn -pl common cn1:buildWin32` does the same thing. A regular
The convenience goal `mvn cn1:buildWin32`, run from the project root, does the same thing. A regular
Comment thread
shai-almog marked this conversation as resolved.
Comment thread
shai-almog marked this conversation as resolved.
(release) build returns **two** binaries -- x64 and arm64, both stripped release exes. Setting the
`windows.debug` build hint instead returns a **single** x64 exe with symbols, for
diagnosis. (To build locally on a Windows box, use
Expand Down
Binary file removeddocs/developer-guide/img/get-device-udid.png
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,14 @@
public class BuildWin32Mojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
public class BuildWindowsDeviceMojo extends AbstractBuildWrapperMojo {
@Override
protected String getPlatform() {
return "windows";
// "win", not "windows". This value activates the module profile in the
// generated project's root pom, and that profile matches the value the
// win module itself declares -- which is "win". Passing "windows"
// matched no profile, so the win module never entered the reactor and
// the wrapper's nested build reported success having produced nothing.
// Nothing else reads the platform as "windows"; the build TARGET stays
// "windows-device", which is a separate namespace.
return "win";
}

@Override
Expand Down
1 change: 0 additions & 1 deletion scripts/developer-guide/guide-links-baseline.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,6 @@ Advanced-Topics-Under-The-Hood.asciidoc http://jruby.org/
Advanced-Topics-Under-The-Hood.asciidoc http://shannah.github.io/cn1-freshdesk/
Advanced-Topics-Under-The-Hood.asciidoc http://stackoverflow.com/questions/11421048/android-ios-custom-uri-protocol-handling
Advanced-Topics-Under-The-Hood.asciidoc http://www.mirah.org/
Introduction.asciidoc http://teavm.org
Introduction.asciidoc http://www.xmlvm.org/
Miscellaneous-Features.asciidoc http://wiki.akosma.com/IPhone_URL_Schemes
The-Components-Of-Codename-One.asciidoc http://awoiaf.westeros.org/index.php/A_Game_of_Thrones
Expand Down
Loading