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
1 change: 1 addition & 0 deletions docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## Tooling & Build Flow Modernization

- [ ] Rewrite `Working-With-CodenameOne-Sources.asciidoc` around the Maven multi-module build in `/maven`, including local test commands, dependency management tips, and how our GitHub Actions replace the old Ant targets for CI.【F:docs/developer-guide/Working-With-CodenameOne-Sources.asciidoc†L1-L85】【F:maven/README.adoc†L1-L68】
- [ ] Rework `Working-With-CodenameOne-Sources.asciidoc` to fold in the Maven project workflow guidance now embedded in the developer guide and eliminate duplicated setup steps between the chapters.【F:docs/developer-guide/Working-With-CodenameOne-Sources.asciidoc†L1-L85】【F:docs/developer-guide/Maven-Project-Workflow.asciidoc†L1-L14】
- [ ] Retire or substantially revise `Travis-CI-Integration.asciidoc` to highlight our current CI guidance (GitHub Actions templates, self-hosted options) and archive Travis-specific screenshots and steps.【F:docs/developer-guide/Travis-CI-Integration.asciidoc†L1-L112】
- [ ] Update the Designer/tooling coverage in `basics.asciidoc` so it walks through launching the modern Designer distribution from Maven projects without relying on `designer_1.jar` shell commands.【F:docs/developer-guide/basics.asciidoc†L1050-L1070】
- [ ] Rebuild `Working-With-The-GUI-Builder.asciidoc` around the current GUI Builder experience (with Java 11+ support, IntelliJ/VScode integration), moving legacy troubleshooting for `guibuilder_1.jar` into an appendix or "legacy" callout.【F:docs/developer-guide/Working-With-The-GUI-Builder.asciidoc†L1-L126】
Expand Down
42 changes: 1 addition & 41 deletions docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ Here is the current list of supported arguments, notice that build hints are add
|android.installLocation
|Maps to android:installLocation manifest entry defaults to auto. Can also be set to internalOnly or preferExternal.

|android.gradle
|Deprecated, this mode is no longer supported. true/false defaults to false prior to 3.3 and true after. Uses Gradle instead of Ant to build the Android app

|android.xapplication
|defaults to an empty string. Allows developers of native Android code to add text within the application block to define things such as widgets, services etc.

Expand Down Expand Up @@ -88,7 +85,7 @@ Here is the current list of supported arguments, notice that build hints are add
|*Deprecated, please android.playService.+++*+++!* Indicates whether Goolge Play Services should be included into the build, defaults to false but that might change based on the functionality of the application and other build hints. Adding Google Play Services support allows us to use a more refined location implementation and invoke some Google specific functionality from native code.

|android.playService.plus, android.playService.auth, android.playService.base, android.playService.identity, android.playService.indexing, android.playService.appInvite, android.playService.analytics, android.playService.cast, android.playService.gcm, android.playService.drive, android.playService.fitness, android.playService.location, android.playService.maps, android.playService.ads, android.playService.vision, android.playService.nearby, android.playService.panorama, android.playService.games, android.playService.safetynet, android.playService.wallet, android.playService.wearable
|Allows including only a specific play services library portion. Notice that this setting conflicts with the deprecated `android.includeGPlayServices` and only works with the gradle build (which is on by default but can be toggled using `android.gradle`). +
|Allows including only a specific play services library portion. Notice that this setting conflicts with the deprecated `android.includeGPlayServices` and only works with the Gradle-based Android build pipeline. +

If none of the services are defined to true then plus, auth, base, analytics, gcm, location, maps & ads will be set to true. If one or more of the `android.playService` entries are defined to something then all entries will default to false.

Expand Down Expand Up @@ -2156,43 +2153,6 @@ In the drop target you can override the following methods:



=== Continuous Integration & Release Engineering

Codename One was essentially built for continuous integration since the build servers are effectively a building block for such an architecture. However, there are several problems with that: the first of which is limited server capacity.

If all users would start sending builds with every commit the servers would instantly become unusable due to the heavy load. To circumvent this CI support is limited only on the Enterprise level which allows Codename One to stock more servers and cope with the rise in demand related to the feature.

To integrate with any CI solution just use the standard Ant targets such as `build-for-android-device`, `build-for-iphone-device` etc.

Normally, this would be a problem since the build is sent but since it isn't blocking you wouldn't get the build result and wouldn't be able to determine if the build passed or failed. To enable this just edit the build XML and add the attribute `automated="true"` to the codeNameOne tag in the appropriate
targets.

This will deliver a `result.zip` file under the `dist` folder containing the binaries of a successful build. It will
also block until the build is completed. This should be pretty easy to integrate with any CI system together with
our automated testing solutions .

E.g. we can do a synchronous build like this:

[source,xml]
----
<target name="build-for-javascript-sync" depends="clean,copy-javascript-override,copy-libs,jar,clean-override">
<codeNameOne
jarFile="${dist.jar}"
displayName="${codename1.displayName}"
packageName = "${codename1.packageName}"
mainClassName = "${codename1.mainName}"
version="${codename1.version}"
icon="${codename1.icon}"
vendor="${codename1.vendor}"
subtitle="${codename1.secondaryTitle}"
automated="true"
targetType="javascript"
/>
</target>
----

This allows us to build a JavaScript version of the app automatically as part of a release build script.

=== Android Lollipop ActionBar Customization

When running on Android Lollipop (5.0 or newer) the native action bar will use the Lollipop design. This isn't applicable
Expand Down
4 changes: 2 additions & 2 deletions docs/developer-guide/Index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ Import the generated Maven project into your preferred IDE and use the Codename
* *Eclipse* – use *File > Import > Existing Maven Projects*, then use the Codename One launch shortcuts provided by the plugin for simulator and build tasks.
* *Command line* – invoke Maven goals directly whenever you need to integrate with CI/CD pipelines or scripting.

For deeper coverage of the Maven goals and project structure, see the https://shannah.github.io/codenameone-maven-manual/[Codename One Maven Manual].
For deeper coverage of the Maven goals, project structure, and automation tasks, continue with <<maven-project-workflow>>.

NOTE: Arbitrary Maven dependencies probably won't work for Codename One. Many dependencies assume a full JDK which Codename One can't provide and they often assume functionality that might not be available e.g. reflection, Spring, etc.

.Legacy onboarding resources
****
The retired Ant-based IDE plugins for NetBeans, Eclipse and IntelliJ IDEA – together with the simulator screenshots from those workflows – are still available in the legacy documentation for teams maintaining older projects. New projects should follow the Maven-based instructions above.
Legacy Ant-based project instructions remain available for teams maintaining older codebases. New projects should follow the Maven workflows described in this guide.
****

==== Important Notes for New Projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ The Codename One Settings app (aka Codename One Preferences, aka Control Center)
=== Opening Codename One Settings

==== Opening Codename One Settings from Command-line
++++
<env cli ></env>
++++

Use the `run.sh` (or run.bat, if on Windows) to open Codename One settings:

Expand All @@ -20,36 +17,27 @@ Use the `run.sh` (or run.bat, if on Windows) to open Codename One settings:
----

==== Opening Codename One Settings from IntelliJ
++++
<env intellij ></env>
++++

Click on the "Configuration" menu in the upper right of the toolbar, and select "Tools" > "Codename One Settings" as shown below.

image::images/intellij-open-settings.png[]
image::img/intellij-open-settings.png[]


==== Opening Codename One Settings from NetBeans
++++
<env netbeans></env>
++++

Right-click on the project in the project inspector, and select "Maven" > "Open Control Center" as shown below:

image::images/netbeans-open-control-center.png[]
image::img/netbeans-open-control-center.png[]

==== Opening Codename One Settings from Eclipse
++++
<env eclipse ></env>
++++

Press the image:images/eclipse-run-as-button.png[] button, and select the "_My Project_ Settings" option. (Where _My Project_ is the name of your project). E.g.
Press the image:img/eclipse-run-as-button.png[] button, and select the "_My Project_ Settings" option. (Where _My Project_ is the name of your project). E.g.

image:images/eclipse-open-settings.png[]
image:img/eclipse-open-settings.png[]

[#dashboard]
=== The Dashboard

Once inside Codename One Settings, you'll see a dashboard like the following:

image::images/control-center-dashboard.png[]
image::img/control-center-dashboard.png[]
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ TIP: Codename One supports a subset of JavaSE8, as well as addition APIs for acc

Use the `cn1lib-archetype` for generating a new Codename One library project as follows:

==== CLI
++++
<env cli></env>
++++
==== Command Line

[source,bash]
----
Expand Down Expand Up @@ -74,64 +71,58 @@ And follow the prompts. This will, result in fewer prompts because you have alr

This will create a new project for you in the current directory, in a newly created directory named after the `artifactId` that you entered.

==== IntelliJ
++++
<env intellij></env>
++++
==== IntelliJ IDEA

. Select "File" > "New Project"...
+
image::images/intellij-new-project-menu.png[]
image::img/intellij-new-project-menu.png[]
. Select "Maven" in the left menu.
+
image::images/intellij-new-project-dialog-maven.png[]
. Check the "Create from Archetype" checkbox. image:images/intellij-create-from-archetype-checkbox.png[]. This should allow you to choose from of archetypes that are already known to IntelliJ.
image::img/intellij-new-project-dialog-maven.png[]
. Check the "Create from Archetype" checkbox. image:img/intellij-create-from-archetype-checkbox.png[]. This should allow you to choose from of archetypes that are already known to IntelliJ.
. If you don't see an option for "com.codenameone:cn1lib-archetype", then IntelliJ doesn't know about it yet. If, however you *do* see this option, you can skip to the next step. Press the "Add Archetype..." button. This will display a dialog for you to enter the details of the archetype.
+
image::images/intellij-add-archetype.png[]
image::img/intellij-add-archetype.png[]
+
Fill in this dialog as shown in the above image. Specifically `groupId`="com.codenameone", `artifactId`="cn1lib-archetype", and `version`="LATEST"
+
Then press "OK".
. Select the option that says "com.codenameone:cn1lib-archetype"
+
image::images/intellij-select-cn1lib-archetype.png[]
image::img/intellij-select-cn1lib-archetype.png[]
+
Then press "Next"
. This will display a form where you can enter the details of your project such as its location (where you want to create the project folder), the name, the artifact ID, and the groupID. Fill in this form as you see fit.
+
image::images/intellij-new-cn1lib-project-details-form.png[]
image::img/intellij-new-cn1lib-project-details-form.png[]
+
Then click "Next"
. The final form in this wizard summarizes the project details and gives you an opportunity to add additional properties to pass to the `archetype:generate` goal. In our case we don't need to add any additional properties. If the information looks correct, you can just press "Next".
+
image::images/intellij-new-cn1lib-project-details-summary.png[]
image::img/intellij-new-cn1lib-project-details-summary.png[]

At this point you will be prompted to open the project.

==== NetBeans
++++
<env netbeans></env>
++++

. Select "File" > "New Project..."
+
image::images/netbeans-new-project-menu.png[]
image::img/netbeans-new-project-menu.png[]
. In the "New Project" dialog, select "Java with Maven" in the left panel, and "Project from Archetype" in the right panel, as shown below.
+
image::images/netbeans-new-project-maven-dialog.png[]
image::img/netbeans-new-project-maven-dialog.png[]
+
Then press "Next"
. This will bring you to the "Maven Archetype" dialog as shown below:
+
image::images/netbeans-maven-archetype-cn1lib-dialog.png[]
image::img/netbeans-maven-archetype-cn1lib-dialog.png[]
+
Enter "com.codenameone" or "cn1lib-archetype" into the search field. Then select "cn1lib-archetype" in the "Known archetypes:" panel. This will prefill the *Group ID*, *Artifact ID* and *Version* fields for you. You may want to change *Version* to LATEST to ensure that it tries to use the latest available version of the archetype.
+
Then click "Next"
. This will bring you to the "Name and Location" panel of the wizard.
+
image::images/netbeans-new-project-name-and-location.png[]
image::img/netbeans-new-project-name-and-location.png[]
+
Enter in the project name (which you'll be forced to use as the artifact ID also), project location, groupId,
version, and package. The "Package" is unimportant here as it isn't used anywhere in the project.
Expand All @@ -140,28 +131,25 @@ Once you have entered the information to your liking press the "Finish" button.

This will create a new libary project for you at the location you specified.

==== Eclipse
++++
<env eclipse></env>
++++
==== Eclipse IDE

. Select "File" > "New Project..."
. In the _New Project_ dialog, expand the _Maven_ item, and select _Maven Project_
+
image::images/eclipse-new-project-wizard.png[]
image::img/eclipse-new-project-wizard.png[]
+
Then press "Next"
. The next panel will look like the below image. The default settings on this panel should be fine. Press _Next_
+
image::images/eclipse-new-project-wizard-new-maven-project.png[]
image::img/eclipse-new-project-wizard-new-maven-project.png[]
. In the next panel, enter "cn1lib" in the _Filter_ field. After a moment the _cn1lib-archetype_ should appear in the area below as shown here:
+
image::images/eclipse-new-maven-project-cn1lib.png[]
image::img/eclipse-new-maven-project-cn1lib.png[]
+
Select that option, and press _Next_
. The next panel, allows you to enter your project details, such as group ID, and artifact ID. Your project information here and then press _Finish_.
+
image:images/eclipse-new-maven-project-details.png[]
image:img/eclipse-new-maven-project-details.png[]

This will create a new libary project for you at the location you specified.

Expand All @@ -185,61 +173,49 @@ tests::
An application project for writing unit tests against your library. This module is in the "tests" directory of the main project.


===== IntelliJ
++++
<env intellij></env>
++++
===== IntelliJ IDEA IDEA

The project inspector will look like:

image::images/intellij-myfirstlib-project-inspector.png[]
image::img/intellij-myfirstlib-project-inspector.png[]

This top-level view of the module structure may seem daunting. Most of your development will occur inside the "common" module. If we expand that module it will look more familiar to developers who have used the old Ant project structure:

image::images/intellij-myfirstlibrary-common-project-files.png[]
image::img/intellij-myfirstlibrary-common-project-files.png[]

Your cross-platform Java source would go in the `common/src/main/java` directory. Your CSS files go in the `common/src/main/css` directory.

===== NetBeans
++++
<env netbeans></env>
++++

The project inspector will look like:

image::images/netbeans-myfirstlibrary-project-inspector.png[]
image::img/netbeans-myfirstlibrary-project-inspector.png[]

This top-level view of the modules doesn't provide a clear view of the project landscape, however, since 99% of your development will occur inside the `common` submodule. Let's open that "common" sub-module project as well and take a peek.

Right click on the "Common" sub-module, and select "Open Project" as shown below:

image::images/netbeans-myfirstlibrary-open-common-submodule.png[]
image::img/netbeans-myfirstlibrary-open-common-submodule.png[]

With the common subproject open, the project inspector will look like:

image::images/netbeans-myfirstlibrary-project-inspector-with-common.png[]
image::img/netbeans-myfirstlibrary-project-inspector-with-common.png[]

In this screenshot I have expanded "Source Packages" and "Other Sources/css" to highlight where your Java source files and CSS source files will be located.

The project inspector hides a few important files, however, so here is a screenshot of the File inspector for the common project:

image::images/netbeans-my-first-library-file-inspector-common.png[]
image::img/netbeans-my-first-library-file-inspector-common.png[]

===== Eclipse
++++
<env eclipse></env>
++++
===== Eclipse IDE IDE

The package explorer will look like:

image::images/eclipse-cn1lib-package-explorer.png[]
image::img/eclipse-cn1lib-package-explorer.png[]

In this screenshot, I have expanded the _common/src/main/css_ and _common/src/main/java_ directories as this is where most of your module source will go.

===== CLI
++++
<env cli></env>
++++
===== Command Line

If we do a file listing on the project directory, it shows the following:

Expand Down Expand Up @@ -375,10 +351,7 @@ Other non-java resources that you want to have included in the classpath.
[#building-library]
==== Building the Library

===== CLI
++++
<env cli></env>
++++
===== Command Line

To build the library, simply run the "install" goal on the root module as follows:

Expand All @@ -387,34 +360,25 @@ To build the library, simply run the "install" goal on the root module as follow
mvn install
----

===== IntelliJ
++++
<env intellij></env>
++++
===== IntelliJ IDEA IDEA

Press the "build" image:images/intellij-build-icon.png[] button on the toolbar.
Press the "build" image:img/intellij-build-icon.png[] button on the toolbar.

===== NetBeans
++++
<env netbeans></env>
++++

Right click on the "root" module in the project explorer and select "Build".

image::images/netbeans-right-click-build.png[]
image::img/netbeans-right-click-build.png[]

IMPORTANT: You must build the root module and not one of the submodules.

Alternatively you could have just selected the "root" module in the project explorer and pressed the "build" image:images/netbeans-build-button.png[] button on the toolbar.
Alternatively you could have just selected the "root" module in the project explorer and pressed the "build" image:img/netbeans-build-button.png[] button on the toolbar.

===== Eclipse
++++
<env eclipse></env>
++++
===== Eclipse IDE IDE

Right click on the "root" module in the project explorer and select _Run as_ > _Maven Install_

image::images/eclipse-build-cn1lib.png[]
image::img/eclipse-build-cn1lib.png[]

TIP: If the build fails for any reason, check to make sure that your project is using the latest version of the Codename One plugin. You can do this by opening the _pom.xml_ file, and changing the `cn1.version` and `cn1.plugin.version` properties to reference the latest version. Check for the latest version https://search.maven.org/artifact/com.codenameone/codenameone[here].

Expand Down
Loading