Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/release-on-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,38 @@ jobs:
sleep 20
done
echo "codenameone-certificatewizard ${GITHUB_REF_NAME} not visible on repo1 yet; it may still be propagating from Sonatype Central."

# --- Settings editor ----------------------------------------------------
# The cn1:settings goal resolves the standalone Java-17 Settings editor
# and its runtime dependencies from Maven Central.
- name: Deploy Settings editor to Maven Central
if: steps.deploy.outcome == 'success' || steps.confirm.outcome == 'success'
run: |
export GPG_TTY=$(tty)
cd scripts/settings
xvfb-run -a mvn -Pexecutable-jar -Psettings-central deploy \
-Dcodename1.platform=javase \
-Dgpg.passphrase=$MAVEN_GPG_PASSPHRASE \
-Dcn1.version=$GITHUB_REF_NAME -Dcn1.plugin.version=$GITHUB_REF_NAME \
-Dmaven.test.skip=true
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Confirm Settings editor on Maven Central
if: steps.deploy.outcome == 'success' || steps.confirm.outcome == 'success'
continue-on-error: true
run: |
set +e
url="https://repo1.maven.org/maven2/com/codenameone/codenameone-settings/${GITHUB_REF_NAME}/codenameone-settings-${GITHUB_REF_NAME}.jar"
for i in $(seq 1 15); do
code=$(curl -s -o /dev/null -w "%{http_code}" "$url")
if [ "$code" = "200" ]; then
echo "Confirmed codenameone-settings ${GITHUB_REF_NAME} on Maven Central"
exit 0
fi
echo "[$i/15] Waiting on Maven Central for codenameone-settings (code=$code)"
sleep 20
done
echo "codenameone-settings ${GITHUB_REF_NAME} not visible on repo1 yet; it may still be propagating from Sonatype Central."
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated from docs/developer-guide source blocks. Edit the guide snippets here, not inline.

// tag::maven-appendix-control-center-bash-001[]
./run.sh settings
mvn cn1:settings
// end::maven-appendix-control-center-bash-001[]
13 changes: 9 additions & 4 deletions docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ When you send a build to the server, you can provide more parameters. The server

These hints are often called "build hints" or "build arguments." They behave like compiler flags that tune the build server's behavior. That makes them useful for fast iteration on new functionality without rebuilding plugin UI for every change. They're also useful when you need to expose low-level behavior such as customizing the Android manifest XML or the iOS plist.

You can set these hints by right-clicking the project in the IDE and selecting #Codename One# -> #Codename One Settings# -> #Build Hints#. The hints use the `key=value` style.
Launch Codename One Settings from the Maven project root, then select *Hints* in the left navigation rail. The hints use the `key=value` style.

[source,shell]
----
include::../demos/common/src/main/snippets/developer-guide/maven-appendix-control-center.sh[tag=maven-appendix-control-center-bash-001,indent=0]
----

.The build hints UI in Codename One Settings
image::img/build-hints-codenameone-settings.png[The build hints UI in Codename One Settings,scaledwidth=50%]
image::img/codename-one-settings-build-hints.png[The build hints UI in Codename One Settings,scaledwidth=85%]

You can also set the build hints directly in the `codenameone_settings.properties` file. When you do that, each setting must start with the `codename1.arg.` prefix. For example, `android.debug=true` becomes `codename1.arg.android.debug=true`.

Expand Down Expand Up @@ -2900,11 +2905,11 @@ The https://github.com/codenameone/UpdateCodenameOne[Update Framework] solves ma

- Skins update automatically - this is hugely important. When you change a theme you need to update it in the skins and if you don't update the skin you might see a difference between the simulator and the device

- Update of settings/designer without IDE plugin update - The IDE plugin update process is slow and tedious. This way you can push out a bug fix for the GUI builder without going through the process of releasing a new plugin version
- Update of designer tools without an IDE plugin update - The IDE plugin update process is slow and tedious. This way a GUI builder fix can ship without a new IDE plugin release. The standalone Settings artifact is versioned with the Maven plugin instead.

This framework should be seamless. You should no longer see the "downloading" message whenever you push an update after your build client is updated. Your system would poll for a new version daily and update when new updates are available.

You can also use the usual method of #Codename One Settings# -> #Basic# -> #Update Client Libs# which will force an update check. Notice that the UI will look a bit different after this update.
To force an update check, run `mvn cn1:update` from the project root.

==== How does it work

Expand Down
16 changes: 8 additions & 8 deletions docs/developer-guide/Index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,17 @@ That's it. You should now have a general sense of the code. It's time to run on

==== Building and deploying on devices

.Codename One Control Center
image::img/control-center-main.png[Codename One Settings/Control Center,scaledwidth=50%]
.Codename One Settings
image::img/codename-one-settings-basic.png[Codename One Settings,scaledwidth=85%]

You can use the Control Center to configure almost anything. Specifically, the application title, application version, application icon etc. Are all found in the Codename One Settings maven target.
Use the standalone Codename One Settings editor to configure the application title, version, package, icon, build hints, and extensions. Launch it from the Maven project root:

There are many options within this UI that control almost every aspect of the application from signing to basic settings.

Your device builds using the Codename One Cloud can also be found right here as well as subscription information.
[source,shell]
----
include::../demos/common/src/main/snippets/developer-guide/maven-appendix-control-center.sh[tag=maven-appendix-control-center-bash-001,indent=0]
----

.Device Builds in Logged out State
image::img/control-center-builds-empty.png[Builds in Empty State,scaledwidth=50%]
Use the <<certificate-wizard,standalone Certificate Wizard>> for signing assets. Monitor Codename One Cloud builds and subscription information on the Codename One website.

===== Signing/Certificates

Expand Down
3 changes: 1 addition & 2 deletions docs/developer-guide/Maven-Appendix-API.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Codename One apps support the https://kotlinlang.org/api/latest/jvm/stdlib/[Kotl

Add-on libraries can be added to your library in the common/pom.xml file, but, if you use APIs that aren't supported by Codename One (for example, which use reflection), then your app will fail to build.

Codename One supports its own library format (cn1lib) which sort of "certifies" that it's compatible with Codename One. You can browse the growing catalog of available cn1libs inside <<settings,Codename One Settings>>.
Codename One supports its own library format (cn1lib) which sort of "certifies" that it's compatible with Codename One. Run `mvn cn1:settings` and open *Extensions* to browse the growing catalog of available cn1libs. See <<settings,Codename One Settings>>.

For more information about cn1libs, see https://www.codenameone.com/developer-guide.html#_libraries_cn1lib[the cn1libs section] of the developer guide.


38 changes: 15 additions & 23 deletions docs/developer-guide/Maven-Appendix-Control-Center.adoc
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@

[appendix]
[#settings]
== Codename One settings
== Codename One Settings

The Codename One Settings app (aka Codename One Preferences, aka Control Center) allows you to configure many aspects of your application. This is where you can generate certificates, browse/install add-ons, monitor the status of your cloud builds, configure build hints, and more.
Codename One Settings is a standalone editor for the current Maven project. Use it to edit the application's basic properties, manage build hints, and browse, install, update, or uninstall extensions. Signing assets are managed by the separate <<certificate-wizard,Certificate Wizard>>, and cloud builds are monitored on the Codename One website.

=== Opening Codename One settings
=== Opening Codename One Settings

==== Opening Codename One settings from command-line
Run the following command from the root directory of a Codename One Maven project:

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

[source,bash]
[source,shell]
----
include::../demos/common/src/main/snippets/developer-guide/maven-appendix-control-center.sh[tag=maven-appendix-control-center-bash-001,indent=0]
----

==== Opening Codename One settings from IntelliJ

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

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

Maven downloads the Settings artifact that matches the Codename One Maven plugin version and opens it as a desktop application bound to the current project. The same command works in a terminal or an IDE's Maven runner.

==== Opening Codename One settings from NetBeans
=== Basic settings

Right-click on the project in the project inspector, and select "Maven" > "Open Control Center" as shown below:
The *Basic* view edits the application title, description, version, vendor, package name, main class, icon, versioned-build selection, and include-source option. Changes are written to `common/codenameone_settings.properties` when you click *Save*.

image::img/netbeans-open-control-center.png[]
image::img/codename-one-settings-basic.png[Codename One Settings Basic view,scaledwidth=85%]

==== Opening Codename One settings from Eclipse
=== Build hints

Press the image:img/eclipse-run-as-button.png[] button, and select the "_Your project_ Settings" option (where _Your project_ is the name of your project). For example:
The *Build Hints* view searches the build-hint catalog from this guide. It provides a control appropriate to each known hint and also accepts arbitrary key/value hints. The editor adds and removes the `codename1.arg.` prefix when reading and writing `codenameone_settings.properties`.

image:img/eclipse-open-settings.png[]
image::img/codename-one-settings-build-hints.png[Codename One Settings Build Hints view,scaledwidth=85%]

[#dashboard]
=== The dashboard
=== Extensions

Once inside Codename One Settings, you'll see a dashboard like the following:
The *Extensions* view searches the Codename One library catalog. Depending on how an extension is distributed, installation either adds a Maven dependency to `common/pom.xml` or installs a legacy cn1lib. Click the action for an installed extension to uninstall it. Settings displays a compatibility warning before installing a catalog entry known to target an older Codename One release.

image::img/control-center-dashboard.png[]
image::img/codename-one-settings-extensions.png[Codename One Settings Extensions view,scaledwidth=85%]
38 changes: 16 additions & 22 deletions docs/developer-guide/Maven-Getting-Started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ The "common" module is where all your Codename One application resides. It house

When adding dependencies into your app, you'll therefore almost always place them inside the pom.xml file for the "common" module.

TIP: You can add dependencies without needing to change XML configuration files using the Control Center. See <<managing-addons-in-control-center>>.
TIP: You can add dependencies without editing XML by launching Codename One Settings with `mvn cn1:settings`. See <<managing-addons-in-control-center>>.

.When to use the "other" pom.xml Files
[sidebar]
Expand Down Expand Up @@ -290,7 +290,7 @@ This is a special marker that's used by some Codename One tooling to help it loc

You can paste any Maven dependency snippet you like into your project, but libraries that haven't been specifically developed for Codename One might not be compatible. See <<api>>. If you're unsure whether a library is compatible, you could add the dependency and try to use it in your app. If it isn't compatible, it will fail when you try to build the app, during the <<compliance-check,compliance check>>.

The easiest way to find compatible libraries is to use the <<managing-addons-in-control-center, extensions section of the Control Center>>. Libraries listed in this section have been build specifically for Codename One and are guaranteed to be compatible.
The easiest way to find Codename One libraries is to use the <<managing-addons-in-control-center,Extensions view in Codename One Settings>>. These libraries were built specifically for Codename One. Settings warns before installing catalog entries known to target older Codename One releases.


[#compliance-check]
Expand All @@ -301,48 +301,42 @@ All application code in the common module of your Codename One project must be c
If the compliance check fails (that is, the app uses unsupported APIs), the build will fail. The error log should provide some clues about where the offending code resides.

[#managing-addons-in-control-center]
==== Managing Add-Ons in control center
==== Managing add-ons in Codename One Settings

As mentioned throughout this guide, the best place to find and install add-ons for your project is in the Codename One Control Center (also known as Codename One Preferences or Codename One Settings). See <<settings>>.
Launch Codename One Settings from the project root, then select *Extensions* in the left navigation rail:

From the dashboard, select "Advanced Settings" > "Extensions" in the navigation menu on the left as shown below:

image::img/image-2021-03-08-06-57-26-835.png[Control center navigation menu]

This will bring up a list of available Codename One extensions as shown below:
[source,shell]
----
include::../demos/common/src/main/snippets/developer-guide/maven-appendix-control-center.sh[tag=maven-appendix-control-center-bash-001,indent=0]
----

image::img/control-center-extensions.png[Control center extensions page]
image::img/codename-one-settings-extensions.png[Codename One Settings Extensions view,scaledwidth=85%]

As an example, install the "Google Maps" library.

Type in "Maps" into the search box, and it should narrow the options down to three libraries as shown below:
Type `Maps` in the search field and locate `Codename One Google Native`, the Google Maps library.

image:img/control-center-extensions-search-maps.png[Control Center Extensions filtered on maps]
Click *Install* or *Download*, depending on how the catalog entry is distributed.

The one in the middle `Codename One Google Native`, is the Google Maps lib that you want.
Settings shows progress while it installs the extension. For an installed extension, click the same action area and confirm *Uninstall* to remove it.

Press the "Download" button.

You should see a progress indicator while performs the installation.

.How Control Center Handles Maven Dependencies
.How Codename One Settings handles Maven dependencies
[sidebar]
****
Many of the extensions listed in the control center are deployed as cn1lib bundles. Others are deployed on Maven central and *could* be installed by adding a snippet into the pom.xml file (as described in <<maven-dependency-example>>).
Many extensions listed in Settings are deployed as cn1lib bundles. Others are deployed on Maven Central and *could* be installed by adding a snippet to `pom.xml` (as described in <<maven-dependency-example>>).

The control center UI shields you from the details of how it installs the extensions into your app. For extensions that are deployed on Maven central, it will add the Maven dependency for the library directly into your project's common/pom.xml file. For extensions that are distributed as cn1lib bundles, it uses the `install-cn1lib` Maven goal to install it into your project.
Settings shields you from the details of how it installs extensions. For extensions deployed on Maven Central, it adds the dependency directly to your project's `common/pom.xml`. For extensions distributed as cn1lib bundles, it uses the `install-cn1lib` Maven goal.

You shouldn't need to worry about this, as it happens seamlessly. If you're curious, you can look at the `<dependencies>` section of your common/pom.xml file to see the added `<dependency>` tag after you install an extension.
****

==== Installing legacy cn1libs

The recommended approach for installing add-ons to your project is to use the <<managing-addons-in-control-center, control center>>, or by <<maven-dependency-example, adding the maven dependency to your common/pom.xml file>>. But, in some situations you may not be able to use those methods. For example, If you have a legacy cnlib file that you need to use in your app, and it isn't available on Maven central or the control center.
The recommended approach for installing add-ons is to use <<managing-addons-in-control-center,Codename One Settings>> or <<maven-dependency-example,add the Maven dependency to `common/pom.xml`>>. In some situations neither method is available. For example, you might have a legacy cn1lib file that isn't listed in the extension catalog or deployed to Maven Central.

In cases like this you can use the `install-cn1lib` Maven goal to install it as follows:

[source,bash]
----
include::../demos/common/src/main/snippets/developer-guide/maven-getting-started.sh[tag=maven-getting-started-bash-007,indent=0]
----

5 changes: 3 additions & 2 deletions docs/developer-guide/On-Device-Debugging.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ project directly:

* *Local build*: `mvn cn1:buildIosXcodeProject` writes the complete Xcode
project under `target/...-ios-source/`.
* *Cloud build*: check the *Include Source* flag in Codename One Settings before
sending the build, and download the sources result from the build server.
* *Cloud build*: run `mvn cn1:settings`, enable *Include Source* on the *Basic*
page, save, then send the build and download the sources result from the build
server.

Open the `.xcworkspace` file if one was generated, otherwise the `.xcodeproj`,
and run on a device or the native iOS simulator from Xcode as you would any iOS
Expand Down
Loading
Loading