diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 48a4d43..4dcc3bb 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -23,4 +23,9 @@ jobs: mkdir -p ~/.codenameone wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar - name: Build with Maven - run: mvn install + run: mvn install -DskipTests + + - name: Build BTDemo + run: | + cd BTDemo + mvn install -DskipTests -Pjavase diff --git a/BTDemo/.mvn/jvm.config b/BTDemo/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java b/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/BTDemo/.mvn/wrapper/maven-wrapper.jar b/BTDemo/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/BTDemo/.mvn/wrapper/maven-wrapper.jar differ diff --git a/BTDemo/.mvn/wrapper/maven-wrapper.properties b/BTDemo/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/BTDemo/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/BTDemo/BTDemo - Build Android Studio Project.launch b/BTDemo/BTDemo - Build Android Studio Project.launch new file mode 100644 index 0000000..fc33f7d --- /dev/null +++ b/BTDemo/BTDemo - Build Android Studio Project.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Build JavaSE Desktop App.launch b/BTDemo/BTDemo - Build JavaSE Desktop App.launch new file mode 100644 index 0000000..88d5e82 --- /dev/null +++ b/BTDemo/BTDemo - Build JavaSE Desktop App.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Build iOS Xcode Project.launch b/BTDemo/BTDemo - Build iOS Xcode Project.launch new file mode 100644 index 0000000..4be0223 --- /dev/null +++ b/BTDemo/BTDemo - Build iOS Xcode Project.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Debug Simulator.launch b/BTDemo/BTDemo - Debug Simulator.launch new file mode 100644 index 0000000..5b85e3f --- /dev/null +++ b/BTDemo/BTDemo - Debug Simulator.launch @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Debug in Simulator.launch b/BTDemo/BTDemo - Debug in Simulator.launch new file mode 100644 index 0000000..55686ad --- /dev/null +++ b/BTDemo/BTDemo - Debug in Simulator.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Remote Debug Simulator.launch b/BTDemo/BTDemo - Remote Debug Simulator.launch new file mode 100644 index 0000000..1f32e29 --- /dev/null +++ b/BTDemo/BTDemo - Remote Debug Simulator.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Run Desktop.launch b/BTDemo/BTDemo - Run Desktop.launch new file mode 100644 index 0000000..f1ae68e --- /dev/null +++ b/BTDemo/BTDemo - Run Desktop.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Run Simulator.launch b/BTDemo/BTDemo - Run Simulator.launch new file mode 100644 index 0000000..88127e5 --- /dev/null +++ b/BTDemo/BTDemo - Run Simulator.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send Android Build.launch b/BTDemo/BTDemo - Send Android Build.launch new file mode 100644 index 0000000..6ff30be --- /dev/null +++ b/BTDemo/BTDemo - Send Android Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send Javascript Build.launch b/BTDemo/BTDemo - Send Javascript Build.launch new file mode 100644 index 0000000..d62890e --- /dev/null +++ b/BTDemo/BTDemo - Send Javascript Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send Mac Desktop Build.launch b/BTDemo/BTDemo - Send Mac Desktop Build.launch new file mode 100644 index 0000000..c5778ea --- /dev/null +++ b/BTDemo/BTDemo - Send Mac Desktop Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send Windows Desktop Build.launch b/BTDemo/BTDemo - Send Windows Desktop Build.launch new file mode 100644 index 0000000..68c5e97 --- /dev/null +++ b/BTDemo/BTDemo - Send Windows Desktop Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send Windows UWP Build.launch b/BTDemo/BTDemo - Send Windows UWP Build.launch new file mode 100644 index 0000000..4a1676e --- /dev/null +++ b/BTDemo/BTDemo - Send Windows UWP Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send iOS Debug Build.launch b/BTDemo/BTDemo - Send iOS Debug Build.launch new file mode 100644 index 0000000..e444159 --- /dev/null +++ b/BTDemo/BTDemo - Send iOS Debug Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Send iOS Release Build.launch b/BTDemo/BTDemo - Send iOS Release Build.launch new file mode 100644 index 0000000..5232eef --- /dev/null +++ b/BTDemo/BTDemo - Send iOS Release Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo - Update Codename One.launch b/BTDemo/BTDemo - Update Codename One.launch new file mode 100644 index 0000000..28aadd7 --- /dev/null +++ b/BTDemo/BTDemo - Update Codename One.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/BTDemo Settings.launch b/BTDemo/BTDemo Settings.launch new file mode 100644 index 0000000..9c26943 --- /dev/null +++ b/BTDemo/BTDemo Settings.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/CodeNameOneBuildClient.jar b/BTDemo/CodeNameOneBuildClient.jar deleted file mode 100644 index 54b8e97..0000000 Binary files a/BTDemo/CodeNameOneBuildClient.jar and /dev/null differ diff --git a/BTDemo/JavaSE.jar b/BTDemo/JavaSE.jar deleted file mode 100644 index 257e003..0000000 Binary files a/BTDemo/JavaSE.jar and /dev/null differ diff --git a/BTDemo/README.adoc b/BTDemo/README.adoc new file mode 100644 index 0000000..0e7f4cd --- /dev/null +++ b/BTDemo/README.adoc @@ -0,0 +1,110 @@ += Codename One Project + +This project is a multi-module Maven project that was generated from a Maven archetype. + +== Run Instructions + +This project can be run from the command line using maven directly, or using the `run.[sh|bat]` wrapper script. + +=== Using the `run.[sh|bat]` wrapper script + +Run in simulator:: ++ +[source,bash] +---- +./run.sh +---- + +Run Desktop App:: ++ +[source,bash] +---- +./run.sh desktop +---- + +== Build Instructions + +This project can be built from the command line using maven directly, or using the `build.[sh|bat]` wrapper script. + +=== Using the `build.[sh|bat]` wrapper script + +==== Local Build Targets + +The following build targets will be run on your local machine. + +jar:: +Builds a portable executable Jar that runs on any platform supporting JavaSE (e.g. Mac, Windows, Linux, etc..). **Default target** ++ +==== +*Example* + +.Building an executable jar +[source,bash] +---- +./build.sh jar +---- + +Since "jar" is the default target, the above is equivalent to running: + +[source,bash] +---- +./build.sh +---- +==== + +ios_source:: +Generates an Xcode project for an iOS app that can be opened and built in Xcode. *Requires that you have a Mac with Xcode installed*. Project will be created in the `ios/generated-sources` directory. ++ +==== +**Example** + +.Generating an Xcode project +[source,bash] +---- +./build.sh ios_source +---- +==== + +android_source:: +Generates an adroid gradle project for an Android app that can be opened and built in Android Studio. *Requires that you have Android developer tools and gradle installed. `ANDROID_HOME` environment variable should point to android sdk. Either `GRADLE_HOME` environment variable should point to gradle home, or gradle should be in your PATH. Project will be created in the `android/generated-sources` directory. ++ +==== +**Example** + +.Generating a gradle android project +[source,bash] +---- +ANDROID_HOME=/path/to/android-sdk ./build.sh android_source +---- +==== + +==== Build Server Targets + +The following targets will intiate a build on the Codename One build server. + +ios:: +Build for iOS using the Codename One build server. + +ios-release:: +Build an iOS app for submission to Apple app store. + +android:: +Build apk/aab for Android using the Codename One build server. + +mac_desktop:: +Build a Mac desktop app. ++ +*Mac desktop builds Require a Pro account* + +windows_desktop:: +Build a Windows desktop app. ++ +*Windows desktop builds require a Pro account* + +windows_device:: +Build a Windows (UWP) app. + +javascript:: +Build a web app (compiled to javascript using TeaVM). ++ +*Javascript builds require an Enterprise Account* diff --git a/BTDemo/Versions.properties b/BTDemo/Versions.properties deleted file mode 100644 index f4f76b2..0000000 --- a/BTDemo/Versions.properties +++ /dev/null @@ -1,7 +0,0 @@ -# -#Mon Jan 11 15:28:17 PST 2021 -CodeNameOneBuildClientJar=163 -CodenameOne_SRCzip=165 -CodenameOneJar=165 -JavaSEJar=165 -CLDC11Jar=163 diff --git a/BTDemo/android/pom.xml b/BTDemo/android/pom.xml new file mode 100644 index 0000000..9262a48 --- /dev/null +++ b/BTDemo/android/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-android + 1.0-SNAPSHOT + + BTDemo-android + + + UTF-8 + 1.8 + 1.8 + android + android + android-device + + + src/main/empty + + + + src/main/java + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-android + package + + build + + + + + + + + + + + com.codenameone + codenameone-core + provided + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + run-android + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/../common/codenameone_settings.properties + + + + + + + + maven-antrun-plugin + 3.0.0 + + + adb-install + verify + + run + + + + Running adb install + + + + + + + Trying to start app on device using adb + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/build.bat b/BTDemo/build.bat new file mode 100644 index 0000000..3427300 --- /dev/null +++ b/BTDemo/build.bat @@ -0,0 +1,108 @@ +@echo off +setlocal EnableDelayedExpansion +setlocal EnableExtensions + + + +set MVNW=mvnw.cmd + +SET CMD=%1 +if "%CMD%"=="" ( + set CMD=jar +) +goto %CMD% + +goto :EOF +:mac_desktop +!MVNW! package -DskipTests -Dcodename1.platform^=javase -Dcodename1.buildTarget^=mac-os-x-desktop -U -e + +goto :EOF +:windows_desktop +!MVNW! package -DskipTests -Dcodename1.platform^=javase -Dcodename1.buildTarget^=windows-desktop -U -e + +goto :EOF +:windows_device +!MVNW! package -DskipTests -Dcodename1.platform^=win -Dcodename1.buildTarget^=windows-device -U -e + +goto :EOF +:uwp +set /a _0_%~2=^(1 + %~2^) +call :windows_device _1_%~2 !_0_%~2! +echo | set /p ^=!_1_%~2! + +goto :EOF +:javascript +!MVNW! package -DskipTests -Dcodename1.platform^=javascript -Dcodename1.buildTarget^=javascript -U -e + +goto :EOF +:android +!MVNW! package -DskipTests -Dcodename1.platform^=android -Dcodename1.buildTarget^=android-device -U -e + +goto :EOF +:xcode +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-source -U -e + +goto :EOF +:ios_source +set /a _0_%~2=^(1 + %~2^) +call :xcode _1_%~2 !_0_%~2! +echo | set /p ^=!_1_%~2! + +goto :EOF +:android_source +!MVNW! package -DskipTests -Dcodename1.platform^=android -Dcodename1.buildTarget^=android-source -U -e + +goto :EOF +:ios +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-device -U -e + +goto :EOF +:ios_release +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-device-release -U -e + +goto :EOF +:jar +!MVNW! -Pexecutable-jar package -Dcodename1.platform^=javase -DskipTests -U -e + +goto :EOF +:help +echo build.sh [COMMAND] +echo Local Build Commands: +echo The following commands will build the app locally ^(i.e. does NOT use the Codename One build server^) +echo +echo jar +echo Builds app as desktop app executable jar file to javase/target directory +echo android_source +echo Generates an android gradle project that can be opened in Android studio +echo *Requires android development tools installed. +echo *Requires ANDROID_HOME environment variable +echo *Requires either GRADLE_HOME environment variable^, or for gradle to be in PATH +echo ios_source +echo Generates an Xcode Project that you can open and build using Apple^'s development tools +echo *Requires a Mac with Xcode installed +echo +echo Build Server Commands: +echo The following commands will build the app using the Codename One build server^, and require +echo a Codename One account. See https://www.codenameone.com +echo +echo ios +echo Builds iOS app. +echo ios_release +echo Builds iOS app for submission to Apple appstore. +echo android +echo Builds android app. +echo mac_desktop +echo Builds Mac OS desktop app. +echo *Mac OS Desktop builds are a Pro user feature. +echo windows_desktop +echo Builds Windows desktop app. +echo *Windows Desktop builds are a Pro user feature. +echo windows_device +echo Builds UWP Windows app. +echo javascript +echo Builds as a web app. +echo *Javascript builds are an Enterprise user feature + +goto :EOF +:settings +!MVNW! cn:settings -U -e diff --git a/BTDemo/build.sh b/BTDemo/build.sh new file mode 100644 index 0000000..0abadc0 --- /dev/null +++ b/BTDemo/build.sh @@ -0,0 +1,99 @@ +#!/bin/bash +set -e +MVNW="./mvnw" + +function mac_desktop { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javase" "-Dcodename1.buildTarget=mac-os-x-desktop" "-U" "-e" +} +function windows_desktop { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javase" "-Dcodename1.buildTarget=windows-desktop" "-U" "-e" +} +function windows_device { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=win" "-Dcodename1.buildTarget=windows-device" "-U" "-e" +} +function uwp { + + "windows_device" +} +function javascript { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javascript" "-Dcodename1.buildTarget=javascript" "-U" "-e" +} +function android { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=android" "-Dcodename1.buildTarget=android-device" "-U" "-e" +} +function xcode { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-source" "-U" "-e" +} +function ios_source { + "xcode" +} +function android_source { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=android" "-Dcodename1.buildTarget=android-source" "-U" "-e" +} +function ios { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-device" "-U" "-e" +} +function ios_release { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-device-release" "-U" "-e" +} +function jar { + + "$MVNW" "-Pexecutable-jar" "package" "-Dcodename1.platform=javase" "-DskipTests" "-U" "-e" +} +function help { + "echo" "-e" "build.sh [COMMAND]" + "echo" "-e" "Local Build Commands:" + "echo" "-e" " The following commands will build the app locally (i.e. does NOT use the Codename One build server)" + "echo" "-e" "" + "echo" "-e" " jar" + "echo" "-e" " Builds app as desktop app executable jar file to javase/target directory" + "echo" "-e" " android_source" + "echo" "-e" " Generates an android gradle project that can be opened in Android studio" + "echo" "-e" " *Requires android development tools installed." + "echo" "-e" " *Requires ANDROID_HOME environment variable" + "echo" "-e" " *Requires either GRADLE_HOME environment variable, or for gradle to be in PATH" + "echo" "-e" " ios_source" + "echo" "-e" " Generates an Xcode Project that you can open and build using Apple's development tools" + "echo" "-e" " *Requires a Mac with Xcode installed" + "echo" "-e" "" + "echo" "-e" "Build Server Commands:" + "echo" "-e" " The following commands will build the app using the Codename One build server, and require" + "echo" "-e" " a Codename One account. See https://www.codenameone.com" + "echo" "-e" "" + "echo" "-e" " ios" + "echo" "-e" " Builds iOS app." + "echo" "-e" " ios_release" + "echo" "-e" " Builds iOS app for submission to Apple appstore." + "echo" "-e" " android" + "echo" "-e" " Builds android app." + "echo" "-e" " mac_desktop" + "echo" "-e" " Builds Mac OS desktop app." + "echo" "-e" " *Mac OS Desktop builds are a Pro user feature." + "echo" "-e" " windows_desktop" + "echo" "-e" " Builds Windows desktop app." + "echo" "-e" " *Windows Desktop builds are a Pro user feature." + "echo" "-e" " windows_device" + "echo" "-e" " Builds UWP Windows app." + "echo" "-e" " javascript" + "echo" "-e" " Builds as a web app." + "echo" "-e" " *Javascript builds are an Enterprise user feature" +} +function settings { + + "$MVNW" "cn:settings" "-U" "-e" +} +CMD="$1" + +if [ "$CMD" == "" ]; then + CMD="jar" +fi +"$CMD" \ No newline at end of file diff --git a/BTDemo/build.xml b/BTDemo/build.xml deleted file mode 100644 index cdf2047..0000000 --- a/BTDemo/build.xml +++ /dev/null @@ -1,550 +0,0 @@ - - - - - - Builds, tests, and runs the project BTDemo. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller - code size and wider device support - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BTDemo/codenameone_settings.properties b/BTDemo/codenameone_settings.properties deleted file mode 100644 index 3492965..0000000 --- a/BTDemo/codenameone_settings.properties +++ /dev/null @@ -1,51 +0,0 @@ -# -#Wed Aug 05 08:50:57 PDT 2020 -codename1.ios.appid=Q5GHSKAL2F.com.codename1.btle -codename1.ios.release.provision= -codename1.arg.java.version=8 -codename1.arg.rim.obfuscation=false -codename1.arg.ios.newStorageLocation=true -codename1.j2me.nativeTheme=nbproject/nativej2me.res -codename1.arg.ios.project_type=ios -foobarfoo=This is a description of what we are going to do -codename1.arg.ios.interface_orientation=UIInterfaceOrientationPortrait\:UIInterfaceOrientationPortraitUpsideDown\:UIInterfaceOrientationLandscapeLeft\:UIInterfaceOrientationLandscapeRight -codename1.displayName=BTDemo -codename1.arg.ios.pods.platform=,11.0 -codename1.android.keystoreAlias= -codename1.ios.release.certificate= -codename1.arg.ios.background_modes=,bluetooth-central,bluetooth-peripheral -codename1.android.keystorePassword= -codename1.ios.provision= -codename1.arg.ios.add_libs=;CoreBluetooth.framework; -codename1.arg.ios.dsym=false -codename1.arg.android.release=true -codename1.arg.ios.statusbar_hidden=false -codename1.languageLevel=5 -codename1.android.keystore= -codename1.arg.ios.pods=,Cordova,Cordova ~> 6.1 -codename1.vendor=CodenameOne -codename1.arg.win.ver=8 -codename1.ios.certificatePassword= -codename1.ios.debug.certificatePassword= -codename1.mainName=BTDemo -codename1.ios.release.certificatePassword= -codename1.arg.ios.prerendered_icon=false -codename1.ios.debug.certificate= -libVersion=111 -codename1.arg.android.xpermissions= -codename1.arg.ios.application_exits=false -codename1.secondaryTitle=CodenameOne_Template -codename1.description= -codename1.ios.debug.provision= -codename1.arg.j2me.nativeThemeConst=0 -codename1.rim.certificatePassword= -codename1.version=1.0 -codename1.ios.certificate= -codename1.icon=icon.png -codename1.rim.signtoolCsk= -codename1.arg.ios.plistInject=NSBluetoothPeripheralUsageDescription${foobarfoo} -codename1.arg.android.debug=false -codename1.rim.signtoolDb= -codename1.arg.ios.testFlight=false -codename1.arg.ios.includePush=false -codename1.packageName=com.codename1.btle diff --git a/BTDemo/common/codenameone_settings.properties b/BTDemo/common/codenameone_settings.properties new file mode 100644 index 0000000..8270d4a --- /dev/null +++ b/BTDemo/common/codenameone_settings.properties @@ -0,0 +1,29 @@ +codename1.android.keystore= +codename1.android.keystoreAlias= +codename1.android.keystorePassword= +codename1.arg.ios.newStorageLocation=true +codename1.arg.java.version=8 +codename1.displayName=BTDemo +codename1.icon=icon.png +codename1.ios.appid=Q5GHSKAL2F.com.codename1.btle +codename1.ios.certificate= +codename1.ios.certificatePassword= +codename1.ios.debug.certificate= +codename1.ios.debug.certificatePassword= +codename1.ios.debug.provision= +codename1.ios.provision= +codename1.ios.release.certificate= +codename1.ios.release.certificatePassword= +codename1.ios.release.provision= +codename1.j2me.nativeTheme=nbproject/nativej2me.res +codename1.kotlin=false +codename1.languageLevel=5 +codename1.mainName=BTDemo +codename1.packageName=com.codename1.btle +codename1.rim.certificatePassword= +codename1.rim.signtoolCsk= +codename1.rim.signtoolDb= +codename1.secondaryTitle=Hello World +codename1.vendor=CodenameOne +codename1.version=1.0 +codename1.cssTheme=true diff --git a/BTDemo/common/icon.png b/BTDemo/common/icon.png new file mode 100644 index 0000000..1f4fa5d Binary files /dev/null and b/BTDemo/common/icon.png differ diff --git a/BTDemo/common/nbactions.xml b/BTDemo/common/nbactions.xml new file mode 100644 index 0000000..8386546 --- /dev/null +++ b/BTDemo/common/nbactions.xml @@ -0,0 +1,24 @@ + + + + run + + jar + + + cn1:run + + + + debug + + jar + + + cn1:debug + + + true + + + diff --git a/BTDemo/common/pom.xml b/BTDemo/common/pom.xml new file mode 100644 index 0000000..6aab80b --- /dev/null +++ b/BTDemo/common/pom.xml @@ -0,0 +1,367 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-common + 1.0-SNAPSHOT + jar + + + + + com.codenameone + codenameone-core + provided + + + + com.codename1 + cn1-bluetooth-lib + 1.0-SNAPSHOT + pom + + + + + + + + + + + + install-codenameone + ${user.home}/.codenameone/guibuilder.jar + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.0.0 + + + + validate + + run + + + + + + + + + + + + + + + + + + + + + + + + + kotlin + + + + ${basedir}/src/main/kotlin + + + + 1.3.72 + true + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + + org.jetbrains + annotations + 13.0 + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/codenameone_settings.properties + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + + + + + + + javase + + + codename1.platform + javase + + + + javase + + + + + org.codehaus.mojo + exec-maven-plugin + + java + true + + -XX:MaxPermSize=128M + -Xmx1024M + + -classpath + + ${exec.mainClass} + ${cn1.mainClass} + + + + + + + + + + simulator + + javase + + + + + + ios-debug + + + iphone + + + ios + + + + + ios-release + + + iphone + true + + + ios + true + + + + + javascript + + javascript + javascript + + + + + android + + android + android + + + + + uwp + + windows + win + + + + + windows + + desktop_windows + javase + + + + + mac + + desktop_macosx + javase + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/codenameone_settings.properties + + + + + + + + com.codenameone + codenameone-maven-plugin + + + + generate-gui-sources + process-sources + + generate-gui-sources + + + + cn1-process-classes + process-classes + + compliance-check + css + + + + + attach-test-artifact + test + + attach-test-artifact + + + + + + + + + + + + + + diff --git a/BTDemo/src/com/codename1/btle/BTDemo.java b/BTDemo/common/src/main/java/com/codename1/btle/BTDemo.java similarity index 81% rename from BTDemo/src/com/codename1/btle/BTDemo.java rename to BTDemo/common/src/main/java/com/codename1/btle/BTDemo.java index 5a452c4..ca35269 100644 --- a/BTDemo/src/com/codename1/btle/BTDemo.java +++ b/BTDemo/common/src/main/java/com/codename1/btle/BTDemo.java @@ -1,7 +1,5 @@ package com.codename1.btle; -import ca.weblite.codename1.json.JSONException; -import ca.weblite.codename1.json.JSONObject; import com.codename1.bluetoothle.Bluetooth; import com.codename1.components.MultiButton; import com.codename1.ui.Display; @@ -96,19 +94,16 @@ public void actionPerformed(ActionEvent evt) { @Override public void actionPerformed(ActionEvent evt) { - try { - JSONObject res = (JSONObject) evt.getSource(); - System.out.println("response " + res); - - if (res.getString("status").equals("scanResult")) { - //if this is a new device add it - if (!devices.containsKey(res.getString("address"))) { - devices.put(res.getString("address"), res); - updateUI(); - } + Map res = (Map) evt.getSource(); + System.out.println("response " + res); + + if ("scanResult".equals(res.get("status"))) { + //if this is a new device add it + String address = (String) res.get("address"); + if (address != null && !devices.containsKey(address)) { + devices.put(address, res); + updateUI(); } - } catch (JSONException ex) { - ex.printStackTrace(); } } }, null, true, Bluetooth.SCAN_MODE_LOW_POWER, Bluetooth.MATCH_MODE_STICKY, @@ -147,13 +142,13 @@ public void stop() { public void destroy() { } - private void updateUI() throws JSONException { + private void updateUI() { devicesCnt.removeAll(); Set keys = devices.keySet(); for (Iterator iterator = keys.iterator(); iterator.hasNext();) { String address = (String) iterator.next(); - JSONObject obj = (JSONObject) devices.get(address); - MultiButton mb = new MultiButton(obj.getString("name")); + Map obj = (Map) devices.get(address); + MultiButton mb = new MultiButton((String) obj.get("name")); mb.setTextLine2(address); devicesCnt.add(mb); } diff --git a/BTDemo/src/theme.res b/BTDemo/common/src/main/resources/theme.res similarity index 100% rename from BTDemo/src/theme.res rename to BTDemo/common/src/main/resources/theme.res diff --git a/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java b/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java new file mode 100644 index 0000000..b79db2b --- /dev/null +++ b/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java @@ -0,0 +1,23 @@ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.codename1.btle; + +import com.codename1.testing.AbstractTest; + +/** + * + * @author shannah + */ +public class MyFirstTest extends AbstractTest { + + @Override + public boolean runTest() throws Exception { + return true; + } + + +} diff --git a/BTDemo/dist/BTDemo.jar b/BTDemo/dist/BTDemo.jar deleted file mode 100644 index 11b38cb..0000000 Binary files a/BTDemo/dist/BTDemo.jar and /dev/null differ diff --git a/BTDemo/dist/README.TXT b/BTDemo/dist/README.TXT deleted file mode 100644 index a7a14d3..0000000 --- a/BTDemo/dist/README.TXT +++ /dev/null @@ -1,32 +0,0 @@ -======================== -BUILD OUTPUT DESCRIPTION -======================== - -When you build an Java application project that has a main class, the IDE -automatically copies all of the JAR -files on the projects classpath to your projects dist/lib folder. The IDE -also adds each of the JAR files to the Class-Path element in the application -JAR files manifest file (MANIFEST.MF). - -To run the project from the command line, go to the dist folder and -type the following: - -java -jar "BTDemo.jar" - -To distribute this project, zip up the dist folder (including the lib folder) -and distribute the ZIP file. - -Notes: - -* If two JAR files on the project classpath have the same name, only the first -JAR file is copied to the lib folder. -* Only JAR files are copied to the lib folder. -If the classpath contains other types of files or folders, these files (folders) -are not copied. -* If a library on the projects classpath also has a Class-Path element -specified in the manifest,the content of the Class-Path element has to be on -the projects runtime path. -* To set a main class in a standard Java project, right-click the project node -in the Projects window and choose Properties. Then click Run and enter the -class name in the Main Class field. Alternatively, you can manually type the -class name in the manifest Main-Class element. diff --git a/BTDemo/dist/lib/CLDC11.jar b/BTDemo/dist/lib/CLDC11.jar deleted file mode 100644 index e7cdab1..0000000 Binary files a/BTDemo/dist/lib/CLDC11.jar and /dev/null differ diff --git a/BTDemo/dist/lib/CodenameOne.jar b/BTDemo/dist/lib/CodenameOne.jar deleted file mode 100644 index 43a9f4a..0000000 Binary files a/BTDemo/dist/lib/CodenameOne.jar and /dev/null differ diff --git a/BTDemo/dist/lib/CodenameOne_SRC.zip b/BTDemo/dist/lib/CodenameOne_SRC.zip deleted file mode 100644 index 0e964f7..0000000 Binary files a/BTDemo/dist/lib/CodenameOne_SRC.zip and /dev/null differ diff --git a/BTDemo/dist/lib/JavaSE.jar b/BTDemo/dist/lib/JavaSE.jar deleted file mode 100644 index 261c47e..0000000 Binary files a/BTDemo/dist/lib/JavaSE.jar and /dev/null differ diff --git a/BTDemo/icon.png b/BTDemo/icon.png deleted file mode 100644 index d056eed..0000000 Binary files a/BTDemo/icon.png and /dev/null differ diff --git a/BTDemo/ios/pom.xml b/BTDemo/ios/pom.xml new file mode 100644 index 0000000..13ba7dc --- /dev/null +++ b/BTDemo/ios/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-ios + 1.0-SNAPSHOT + + BTDemo-ios + + + UTF-8 + 1.8 + 1.8 + ios + ios + ios-device + + + + + src/main/objectivec + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-ios + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/BTDemo/javascript/pom.xml b/BTDemo/javascript/pom.xml new file mode 100644 index 0000000..900b004 --- /dev/null +++ b/BTDemo/javascript/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-javascript + 1.0-SNAPSHOT + + BTDemo-javascript + + + UTF-8 + 1.8 + 1.8 + javascript + javascript + javascript + + + + + src/main/javascript + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-javascript + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/BTDemo/javase/pom.xml b/BTDemo/javase/pom.xml new file mode 100644 index 0000000..0b000da --- /dev/null +++ b/BTDemo/javase/pom.xml @@ -0,0 +1,782 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-javase + 1.0-SNAPSHOT + + BTDemo-javase + + + UTF-8 + 1.8 + 1.8 + javase + javase + + + ${project.basedir}/../common/src/test/java + + + codenameone-maven-plugin + com.codenameone + ${cn1.plugin.version} + + + add-se-sources + + generate-javase-sources + + generate-sources + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + com.codenameone + codenameone-core + test + + + com.codenameone + codenameone-javase + test + + + + + + + + executable-jar + + javase + com.codename1.btle.BTDemoStub + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + src/main/resources + src/desktop/resources + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/../common/codenameone_settings.properties + + + + + + + com.codenameone + codenameone-maven-plugin + + + generate-icons + generate-sources + + generate-desktop-app-wrapper + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ + + ${codename1.packageName}.${codename1.mainName}Stub + + + + + + + maven-antrun-plugin + 3.0.0 + + + generate-javase-zip + package + + + + + + + + + + + + + + + + + run + + + + + + + + + + + run-desktop + + javase + com.codename1.btle.BTDemoStub + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + src/main/resources + src/desktop/resources + + + + com.codenameone + codenameone-maven-plugin + + + generate-icons + generate-sources + + generate-desktop-app-wrapper + + + + + + org.codehaus.mojo + exec-maven-plugin + + + run-desktop + verify + + java + + + + + + + + + + desktop_build + + + codename1.buildTarget + + + + + com.codenameone + codenameone-core + provided + + + com.codenameone + codenameone-javase + provided + + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-desktop-macosx + package + + build + + + + + + + + + + + test + + + !skipTests + + + + javase + com.codename1.impl.javase.Simulator + + + + com.codenameone + codenameone-core + compile + + + + com.codenameone + codenameone-javase + compile + + + + + + com.codenameone + codenameone-maven-plugin + + + + + cn1-tests + test + + test + + + + + + + + + + + + debug-simulator + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + -XX:MaxPermSize=128M + + -Xdebug + -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} + -Xmx1024M + -Xmx1024M + + + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + + debug-eclipse + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + -XX:MaxPermSize=128M + + -Xdebug + -Xrunjdwp:transport=dt_socket,server=y,address=${jpda.address},suspend=y + -Xmx1024M + -Xmx1024M + + + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + simulator + + javase + com.codename1.impl.javase.Simulator + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + -XX:MaxPermSize=128M + -Xmx1024M + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + idea-simulator + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + + ${basedir}/../common + + true + + ${codename1.mainClass} + + + + + + cef.dir + ${cef.dir} + + + + codename1.designer.jar + ${codename1.designer.jar} + + + + codename1.css.compiler.args.input + ${codename1.css.compiler.args.input} + + + + codename1.css.compiler.args.output + ${codename1.css.compiler.args.output} + + + + codename1.css.compiler.args.merge + ${codename1.css.compiler.args.merge} + + + + + cn1.class.path + ${cn1.class.path} + + + + + + + + run-in-simulator-idea + verify + + java + + + + + + + + + + + + diff --git a/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java b/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java new file mode 100644 index 0000000..132562b --- /dev/null +++ b/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Codename One designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Codename One through http://www.codenameone.com/ if you + * need additional information or have any questions. + */ + +package com.codename1.btle; + +import com.codename1.impl.javase.JavaSEPort; +import com.codename1.ui.Display; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.File; +import java.util.Arrays; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/** + * A wrapper class around a Codename One app, allows building desktop Java + * applications. + * + * @author Shai Almog + */ +public class BTDemoStub implements Runnable, WindowListener { + private static final String APP_TITLE = "Hi World"; + private static final String APP_NAME = "BTDemo"; + private static final String APP_VERSION = "1.0"; + private static final int APP_WIDTH = 800; + private static final int APP_HEIGHT = 600; + private static final boolean APP_ADAPT_TO_RETINA = true; + private static final boolean APP_RESIZEABLE = true; + private static final boolean APP_FULLSCREEN = false; + public static final String BUILD_KEY = ""; + public static final String PACKAGE_NAME = ""; + public static final String BUILT_BY_USER = ""; + private static final boolean isWindows; + static { + isWindows = File.separatorChar == '\\'; + } + + private static final String[] fontFaces = null; + + private static JFrame frm; + private BTDemo mainApp; + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + try { + Class.forName("org.cef.CefApp"); + System.setProperty("cn1.javase.implementation", "cef"); + //System.setProperty("cn1.cef.bundled", "true"); + } catch (Throwable ex){} + + JavaSEPort.setNativeTheme("/NativeTheme.res"); + JavaSEPort.blockMonitors(); + JavaSEPort.setAppHomeDir("." + APP_NAME); + JavaSEPort.setExposeFilesystem(true); + JavaSEPort.setTablet(true); + JavaSEPort.setUseNativeInput(true); + JavaSEPort.setShowEDTViolationStacks(false); + JavaSEPort.setShowEDTWarnings(false); + JavaSEPort.setFullScreen(APP_FULLSCREEN); + + if(fontFaces != null) { + JavaSEPort.setFontFaces(fontFaces[0], fontFaces[1], fontFaces[2]); + } else { + // workaround for a bug in Windows where Arials unicode version isn't used + if(isWindows) { + JavaSEPort.setFontFaces("ArialUnicodeMS", "SansSerif", "Monospaced"); + } else { + JavaSEPort.setFontFaces("Arial", "SansSerif", "Monospaced"); + } + } + + + frm = new JFrame(APP_TITLE); + Toolkit tk = Toolkit.getDefaultToolkit(); + JavaSEPort.setDefaultPixelMilliRatio(tk.getScreenResolution() / 25.4 * JavaSEPort.getRetinaScale()); + Display.init(frm.getContentPane()); + Display.getInstance().setProperty("build_key", BUILD_KEY); + Display.getInstance().setProperty("package_name", PACKAGE_NAME); + Display.getInstance().setProperty("built_by_user", BUILT_BY_USER); + //placeholder + Display.getInstance().setProperty("AppName", APP_NAME); + Display.getInstance().setProperty("AppVersion", APP_VERSION); + Display.getInstance().setProperty("Platform", System.getProperty("os.name")); + Display.getInstance().setProperty("OSVer", System.getProperty("os.version")); + + SwingUtilities.invokeLater(new BTDemoStub()); + } + + public void run() { + frm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + frm.addWindowListener(this); + ImageIcon ic16 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic20 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic32 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic40 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic64 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + frm.setIconImages(Arrays.asList(ic16.getImage(), ic20.getImage(), ic32.getImage(), ic40.getImage(), ic64.getImage())); + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + if(APP_FULLSCREEN && gd.isFullScreenSupported()) { + frm.setResizable(false); + frm.setUndecorated(true); + gd.setFullScreenWindow(frm); + + } else { + frm.setLocationByPlatform(true); + frm.setResizable(APP_RESIZEABLE); + int w = APP_WIDTH; + int h = APP_HEIGHT; + + frm.getContentPane().setPreferredSize(new java.awt.Dimension(w, h)); + frm.getContentPane().setMinimumSize(new java.awt.Dimension(w, h)); + frm.getContentPane().setMaximumSize(new java.awt.Dimension(w, h)); + + // replaceable with the build hint desktop.framePrepare + framePrepare(frm); + } + Display.getInstance().callSerially(new Runnable() { + @Override + public void run() { + if(Display.getInstance().isEdt()) { + mainApp = new BTDemo(); + mainApp.init(this); + mainApp.start(); + SwingUtilities.invokeLater(this); + } else { + + // replaceable with the build hint desktop.frameShow + frameShow(frm); + } + } + }); + } + + private void framePrepare(JFrame frm) { + frm.pack(); + } + + private void frameShow(JFrame frm) { + frm.setVisible(true); + } + + @Override + public void windowOpened(WindowEvent e) { + } + + @Override + public void windowClosing(WindowEvent e) { + Display.getInstance().callSerially(new Runnable() { + @Override + public void run() { + mainApp.stop(); + mainApp.destroy(); + Display.getInstance().exitApplication(); + } + }); + } + + @Override + public void windowClosed(WindowEvent e) { + } + + @Override + public void windowIconified(WindowEvent e) { + } + + @Override + public void windowDeiconified(WindowEvent e) { + } + + @Override + public void windowActivated(WindowEvent e) { + } + + @Override + public void windowDeactivated(WindowEvent e) { + // fix for https://stackoverflow.com/questions/6178132/fullscreen-java-app-minimizes-when-screensaver-turns-on + if(APP_FULLSCREEN) { + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + frm.setExtendedState(JFrame.MAXIMIZED_BOTH); + if(gd.isFullScreenSupported()) { + frm.setResizable(false); + frm.setUndecorated(true); + gd.setFullScreenWindow(frm); + } + } + } +} diff --git a/BTDemo/javase/src/desktop/resources/NativeTheme.res b/BTDemo/javase/src/desktop/resources/NativeTheme.res new file mode 100644 index 0000000..83e067b Binary files /dev/null and b/BTDemo/javase/src/desktop/resources/NativeTheme.res differ diff --git a/BTDemo/lib/CLDC11.jar b/BTDemo/lib/CLDC11.jar deleted file mode 100644 index 0a251c9..0000000 Binary files a/BTDemo/lib/CLDC11.jar and /dev/null differ diff --git a/BTDemo/lib/CN1Bluethooth.cn1lib b/BTDemo/lib/CN1Bluethooth.cn1lib deleted file mode 100644 index d7314b3..0000000 Binary files a/BTDemo/lib/CN1Bluethooth.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CN1Bluetooth.cn1lib b/BTDemo/lib/CN1Bluetooth.cn1lib deleted file mode 100644 index f4c7378..0000000 Binary files a/BTDemo/lib/CN1Bluetooth.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CN1JSON.cn1lib b/BTDemo/lib/CN1JSON.cn1lib deleted file mode 100644 index f161413..0000000 Binary files a/BTDemo/lib/CN1JSON.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CodenameOne.jar b/BTDemo/lib/CodenameOne.jar deleted file mode 100644 index 978dfb0..0000000 Binary files a/BTDemo/lib/CodenameOne.jar and /dev/null differ diff --git a/BTDemo/lib/CodenameOne_SRC.zip b/BTDemo/lib/CodenameOne_SRC.zip deleted file mode 100644 index feb2ba8..0000000 Binary files a/BTDemo/lib/CodenameOne_SRC.zip and /dev/null differ diff --git a/BTDemo/manifest.mf b/BTDemo/manifest.mf deleted file mode 100644 index 328e8e5..0000000 --- a/BTDemo/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/BTDemo/maven.adoc b/BTDemo/maven.adoc new file mode 100644 index 0000000..7125e9f --- /dev/null +++ b/BTDemo/maven.adoc @@ -0,0 +1,224 @@ += Maven Usage Instructions + +== Project Structure + +This module is a multi-module Maven project with the following modules: + +common:: +A Codename One application. All of your cross-platform application code goes in this module. + +android:: +Module containing native Android code such as native interface implementations. + +ios:: +Module containing native iOS code, such as native interface implementations. + +javase:: +Module containing native JavaSE code, such as native interface implementations. + +javascript:: +Module containing native javascript code for the Javascript port. + +win:: +Module containing native Windows UWP code for the UWP windows port. + +cn1libs:: +Module where legacy cn1libs will be installed the `cn1:install-cn1lib` goal. + +== Running The Project + +.Running project in the Codename One simulator +[source,bash] +---- +mvn verify -Psimulator -Dcodename1.platform=javase -DskipTests +---- + +.Running project as JavaSE desktop app +[source,bash] +---- +mvn verify -Prun-desktop -Dcodename1.platform=javase -DskipTests +---- + +== Building the Project + +Excutable Jar:: +Build app as executable Jar file locally. *Does not use build server* ++ +[source,bash] +---- +mvn package -Dcodename1.platform=javase -Dcodename1.buildTarget=jar -DskipTests +---- ++ +*Output location:* `javase/target` + +Xcode Project:: +Generate an Xcode project that can be opened and built in Xcode. *Does not use build server. Requires Mac with Xcode installed* ++ +[source,bash] +---- +mvn package -Dcodename1.platform=ios -Dcodename1.buildTarget=ios-source -DskipTests +---- ++ +*Output location:* `ios/target/generated-sources` + +Android Gradle Project:: +Generate a native Android gradle project that can be opened in Android Studio. *Does not use build server. Requires `ANDROID_HOME` environment variable pointing at Android SDK. Also requires Gradle installed and in path, or `GRADLE_HOME` environment variable pointing at gradle installation directory.* ++ +[source,bash] +---- +mvn package -Dcodename1.platform=android -Dcodename1.buildTarget=android-source -DskipTests +---- ++ +*Output location:* `android/target/generated-sources` + +iOS Debug Build:: +Build an iOS app using the Codename One build server. **Requires Codename One account** ++ +[source,bash] +---- +mvn package -Dcodename1.platform=ios -Dcodename1.buildTarget=ios-device -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `ios/target`. You can download the result in the Codename One build app. + +iOS Release Buld:: +Build an iOS app release build to submit to the Apple app store, using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=ios -Dcodename1.buildTarget=ios-device-release -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `ios/target`. You can download the result in the Codename One build app. + +Android App:: +Build an android app using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=android -Dcodename1.buildTarget=android-device -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `android/target`. You can download the result in the Codename One build app. + +Javascript App:: +Build a web/javascript app using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=javascript -Dcodename1.buildTarget=javascript -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `javascript/target`. You can download the result in the Codename One build app. + +Mac Desktop App:: +Build a Mac desktop app using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=javase -Dcodename1.buildTarget=mac-os-x-desktop -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `javase/target`. You can download the result in the Codename One build app. + +Windows Desktop App:: +Build a Windows desktop app using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=javase -Dcodename1.buildTarget=windows-desktop -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `javase/target`. You can download the result in the Codename One build app. + +Windows (UWP) App:: +Build a Windows UWP app using the Codename One build server. ++ +[source,bash] +---- +mvn package -Dcodename1.platform=win -Dcodename1.buildTarget=windows-device -DskipTests +---- ++ +*Output location:* If you add the `-Dautomated` flag, then it will output the file to `win/target`. You can download the result in the Codename One build app. + +== Other Goals + +Install cn1lib:: +Installs a legacy cn1lib file as a dependency in your project. ++ +[source,bash] +---- +mvn cn1:install-cn1lib -Dfile=/path/to/mylib.cn1lib +---- ++ +This will create a module inside the cn1libs module. ++ +==== +**Optional Parameters** + +groupId:: +Optional group ID for the maven module that is created for this cn1lib. Default value will be `${project.groupId}.cn1libs`. + +artifactId:: +Optional artifact ID for the maven module that is created for this cn1lib. Default value is `${project.artifactId}-${libname}` + +version:: +Optional version for the maven module that is created for this cn1lib. Default value is `${project.version}`. + +updatePom:: +Optional boolean (true/false) indicating whether the cn1libs module pom file should be updated automatically. Default value is `true`. + +overwrite:: +Optional boolean (true/false) indicating whether it should overwrite an existing cn1lib with the same name. Default value is `false`. + +==== + +Create GUI Form:: +Create a GUI Builder Form. ++ +[source,bash] +---- +mvn cn1:create-gui-form -DclassName=com.example.MyForm +---- ++ +This will generate a class in `common/src/main/java` named `com.example.MyForm`, and an accompanying `.guibuilder` XML file in `common/src/main/guibuilder`. ++ +==== +**Parameters** + +className:: +(Required) The class name of the form that you wish to generate. E.g `com.example.MyForm`. + +guiType:: +The type of GUI component to generate. Supports "Form", "Dialog", and "Container". Default value is "Form" + +autoLayout:: +Whether to use autolayout. This is boolean (true/false), and the default value is `true`. + +==== ++ +[TIP] +==== +Open this form in the GUI Builder using the `cn1:guibuilder` goal. + +[source,bash] +---- +mvn cn1:guibuilder -DclassName=com.example.MyForm +---- +==== + +Open Codename One Settings:: +Open the Codename One settings app which allows to to configure your app, and monitor build progress on the build server. ++ +[source,bash] +---- +mvn cn1:settings +---- + +Generate Native Interfaces:: +Generate native stubs for all https://www.codenameone.com/how_di_i/how-do-i-access-native-device-functionality-invoke-native-interfaces.html[native interfaces] in the app. ++ +[source,bash] +---- +mvn cn1:generate-native-interfaces +---- diff --git a/BTDemo/mvnw b/BTDemo/mvnw new file mode 100644 index 0000000..41c0f0c --- /dev/null +++ b/BTDemo/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/BTDemo/mvnw.cmd b/BTDemo/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/BTDemo/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/BTDemo/nb-configuration.xml b/BTDemo/nb-configuration.xml new file mode 100644 index 0000000..cddcc7d --- /dev/null +++ b/BTDemo/nb-configuration.xml @@ -0,0 +1,55 @@ + + + + + + + android-device + android + + + android-source + android + + + javase + + + javascript + javascript + + + mac-os-x-desktop + javase + + + javase + + + windows-desktop + javase + + + windows-device + win + + + ios-device + ios + + + ios-device-release + ios + + + ios-source + ios + + + + diff --git a/BTDemo/nbactions-Desktop App.xml b/BTDemo/nbactions-Desktop App.xml new file mode 100644 index 0000000..53068a1 --- /dev/null +++ b/BTDemo/nbactions-Desktop App.xml @@ -0,0 +1,12 @@ + + + + run + + verify + + + true + + + diff --git a/BTDemo/nbactions-JavaSE Desktop App.xml b/BTDemo/nbactions-JavaSE Desktop App.xml new file mode 100644 index 0000000..f1c86c5 --- /dev/null +++ b/BTDemo/nbactions-JavaSE Desktop App.xml @@ -0,0 +1,112 @@ + + + + run + + verify + + + true + + + run-desktop + + + + build + + * + + + package + + + true + + + executable-jar + + + + rebuild + + * + + + clean + package + + + true + + + executable-jar + + + + test + + * + + + test + + + simulator + + + + + clean + + * + + + clean + + + executable-jar + + + + build-with-dependencies + also-make + + * + + + package + + + executable-jar + + + + CUSTOM-Generate iOS Xcode Project + Generate iOS Xcode Project + + package + + + ios + ios-source + true + + + !run-desktop + + + + debug + + verify + + + true + true + + + debug-simulator + + + diff --git a/BTDemo/nbactions-Simulator.xml b/BTDemo/nbactions-Simulator.xml new file mode 100644 index 0000000..b970763 --- /dev/null +++ b/BTDemo/nbactions-Simulator.xml @@ -0,0 +1,90 @@ + + + + run + + verify + + + true + + + simulator + + + + debug + + verify + + + + javase + true + true + + + debug-simulator + !simulator + + + + build + + * + + + package + + + true + + + executable-jar + !simulator + + + + rebuild + + * + + + clean + package + + + true + + + executable-jar + !simulator + + + + build-with-dependencies + also-make + + * + + + package + + + true + + + executable-jar + !simulator + + + + test + + * + + + test + + + diff --git a/BTDemo/nbactions.xml b/BTDemo/nbactions.xml new file mode 100644 index 0000000..eab8d61 --- /dev/null +++ b/BTDemo/nbactions.xml @@ -0,0 +1,149 @@ + + + + run + + verify + + + true + javase + + + simulator + + + + debug + + verify + + + true + javase + true + + + + + + + + + + + debug-simulator + + + + CUSTOM-Open Control Center + Open Control Center + + cn1:settings + + + + build + + * + + + package + + + true + + android-device + + + + clean + + * + + + clean + + + true + + + + + + rebuild + + * + + + clean + package + + + true + + android-device + + + + build-with-dependencies + also-make + + * + + + package + + + true + + android-device + + + + test + + * + + + test + + + + javase + + + + simulator + + + + CUSTOM-Open in GUI Builder + Open in GUI Builder + + cn1:guibuilder + + + ${packageClassName} + + + + + + + CUSTOM-Update Codename One + Update Codename One + + cn1:update + + + + + + + + + + + + diff --git a/BTDemo/nbproject/build-impl.xml b/BTDemo/nbproject/build-impl.xml deleted file mode 100644 index 6e45f03..0000000 --- a/BTDemo/nbproject/build-impl.xml +++ /dev/null @@ -1,1413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BTDemo/nbproject/genfiles.properties b/BTDemo/nbproject/genfiles.properties deleted file mode 100644 index c64d878..0000000 --- a/BTDemo/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=65812561 -build.xml.script.CRC32=c17a4175 -build.xml.stylesheet.CRC32=28e38971@1.44.1.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=65812561 -nbproject/build-impl.xml.script.CRC32=3705395b -nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.1.48 diff --git a/BTDemo/nbproject/nativej2me.res b/BTDemo/nbproject/nativej2me.res deleted file mode 100644 index 6b33caf..0000000 Binary files a/BTDemo/nbproject/nativej2me.res and /dev/null differ diff --git a/BTDemo/nbproject/project.properties b/BTDemo/nbproject/project.properties deleted file mode 100644 index 124dc8b..0000000 --- a/BTDemo/nbproject/project.properties +++ /dev/null @@ -1,102 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=BTDemo -application.vendor=Codename One -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.modulepath=\ - ${run.modulepath} -debug.test.classpath=\ - ${run.test.classpath} -debug.test.modulepath=\ - ${run.test.modulepath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/BTDemo.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.native-internal_tmp=native/internal_tmp -file.reference.CLDC11.jar=lib/CLDC11.jar -file.reference.CodenameOne.jar=lib/CodenameOne.jar -file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip -file.reference.BTDemo-override=override -file.reference.impl-cls=lib/impl/cls -file.reference.impl-stubs=lib/impl/stubs -file.reference.JavaSE.jar=JavaSE.jar -includes=** -jar.compress=true -javac.classpath=\ - ${file.reference.CLDC11.jar}:\ - ${file.reference.CodenameOne.jar}:\ - ${file.reference.CodenameOne_SRC.zip}:\ - ${file.reference.BTDemo-override}:\ - ${file.reference.impl-cls}:\ - ${file.reference.impl-stubs} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.modulepath= -javac.processormodulepath= -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.modulepath=\ - ${javac.modulepath} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=com.codename1.impl.javase.Simulator -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${file.reference.native-internal_tmp} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.modulepath=\ - ${javac.modulepath} -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -run.test.modulepath=\ - ${javac.test.modulepath} -source.encoding=windows-1252 -src.dir=src -test.src.dir=test diff --git a/BTDemo/nbproject/project.xml b/BTDemo/nbproject/project.xml deleted file mode 100644 index 4d2f86c..0000000 --- a/BTDemo/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - BTDemo - - - - - - - - - diff --git a/BTDemo/pom.xml b/BTDemo/pom.xml new file mode 100644 index 0000000..7b883ab --- /dev/null +++ b/BTDemo/pom.xml @@ -0,0 +1,163 @@ + + 4.0.0 + + cn1-bluetooth + com.codename1 + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + pom + BTDemo + BTDemo + https://www.codenameone.com + + + GPL v2 With Classpath Exception + https://openjdk.java.net/legal/gplv2+ce.html + repo + A business-friendly OSS license + + + + common + javase + + + 7.0.26 + 7.0.26 + UTF-8 + 1.8 + 11 + 1.7.11 + 3.8.0 + 1.8 + 1.8 + BTDemo + + + + + com.codenameone + codenameone-core + ${cn1.version} + + + com.codenameone + codenameone-javase + ${cn1.version} + + + com.codenameone + codenameone-buildclient + ${cn1.version} + system + ${user.home}/.codenameone/CodeNameOneBuildClient.jar + + + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + + + + + + javascript + + + codename1.platform + javascript + + + + javascript + + + + ios + + + codename1.platform + ios + + + + ios + + + + win + + + codename1.platform + win + + + + win + + + + android + + + codename1.platform + android + + + + android + + + + javase + + + codename1.platform + javase + + true + + + javase + + + + cn1libs + + + ${basedir}/cn1libs/pom.xml + + + + cn1libs + + + + diff --git a/BTDemo/run.bat b/BTDemo/run.bat new file mode 100644 index 0000000..a02f2cc --- /dev/null +++ b/BTDemo/run.bat @@ -0,0 +1,40 @@ +@echo off +setlocal EnableDelayedExpansion +setlocal EnableExtensions + + +set MVNW=mvnw.cmd + +SET CMD=%1 +if "%CMD%"=="" ( + set CMD=simulator +) +goto %CMD% + +:simulator +!MVNW! verify -Psimulator -DskipTests -Dcodename1.platform^=javase -e + +goto :EOF +:desktop +!MVNW! verify -Prun-desktop -DskipTests -Dcodename1.platform^=javase -e + +goto :EOF +:settings +!MVNW! cn:settings -e + +goto :EOF +:update +!MVNW! cn:update -U -e + +goto :EOF +:help +echo run.bat [COMMAND] +echo Commands: +echo simulator +echo Runs app using Codename One Simulator +echo desktop +echo Runs app as a desktop app. +echo settings +echo Opens Codename One settings +echo update +echo Update Codename One libraries diff --git a/BTDemo/run.sh b/BTDemo/run.sh new file mode 100644 index 0000000..e7627d7 --- /dev/null +++ b/BTDemo/run.sh @@ -0,0 +1,37 @@ +#!/bin/bash +MVNW="./mvnw" + +function simulator { + + "$MVNW" "verify" "-Psimulator" "-DskipTests" "-Dcodename1.platform=javase" "-e" +} +function desktop { + + "$MVNW" "verify" "-Prun-desktop" "-DskipTests" "-Dcodename1.platform=javase" "-e" +} +function settings { + + "$MVNW" "cn:settings" "-e" +} +function update { + + "$MVNW" "cn:update" "-U" "-e" +} +function help { + "echo" "-e" "run.sh [COMMAND]" + "echo" "-e" "Commands:" + "echo" "-e" " simulator" + "echo" "-e" " Runs app using Codename One Simulator" + "echo" "-e" " desktop" + "echo" "-e" " Runs app as a desktop app." + "echo" "-e" " settings" + "echo" "-e" " Opens Codename One settings" + "echo" "-e" " update" + "echo" "-e" " Update Codename One libraries" +} +CMD=$1 + +if [ "$CMD" == "" ]; then + CMD="simulator" +fi +"$CMD" \ No newline at end of file diff --git a/BTDemo/win/pom.xml b/BTDemo/win/pom.xml new file mode 100644 index 0000000..97047ee --- /dev/null +++ b/BTDemo/win/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.codename1.btle + BTDemo + 1.0-SNAPSHOT + + com.codename1.btle + BTDemo-win + 1.0-SNAPSHOT + + BTDemo-win + + + UTF-8 + 1.8 + 1.8 + win + win + windows-device + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-android + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/pom.xml b/pom.xml index c38fab9..40cb706 100644 --- a/pom.xml +++ b/pom.xml @@ -1,27 +1,22 @@ - - - 4.0.0 - - com.codename1 - cn1-bluetooth - 1.0-SNAPSHOT - pom - - cn1-bluetooth - Codename One cn1-bluetooth library - https://www.codenameone.com - - - - GPL v2 With Classpath Exception - https://openjdk.java.net/legal/gplv2+ce.html - repo - A business-friendly OSS license - - - - - + - - - - - - 7.0.26 - 7.0.26 - UTF-8 - - 1.8 - 11 - 3.8.0 - 1.8 - 1.8 - cn1-bluetooth - 1.3.72 - true - 1.8 - - - common - android - ios - javascript - javase - win - lib - - - - - com.codenameone - java-runtime - ${cn1.version} - - - com.codenameone - codenameone-core - ${cn1.version} - - - com.codenameone - codenameone-javase - ${cn1.version} - - - org.jetbrains.kotlin - kotlin-stdlib - ${kotlin.version} - - - - - - org.jetbrains - annotations - 13.0 - - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlin.version} - - - compile - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - test-compile - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - - com.codenameone - codenameone-maven-plugin - ${cn1.plugin.version} - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9 - - - build-javadoc - - jar - - post-integration-test - - true - - - - - - 1.8 - protected - false - + + + org.jetbrains + annotations + 13.0 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9 + + + build-javadoc + + jar + + post-integration-test + + true + + + + + 1.8 + protected + false + - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - - - - - - - - sign-artifacts - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.4 - - - sign-artifacts - verify - - sign - - - ${gpg.passphrase} - - - - - - - - - - - nexus-staging - Nexus Release Repository - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - central - Central Repository - https://repo.maven.apache.org/maven2 - default - - false - - - - sonatype-snapshots - Sonatype Snapshots - https://oss.sonatype.org/content/repositories/snapshots - - true - - - - sonatype-staging - Sonatype Staging - https://oss.sonatype.org/content/repositories/staging - - false - - - + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.4 + + + sign-artifacts + verify + + sign + + + ${gpg.passphrase} + + + + + + + + + + + nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + central + Central Repository + https://repo.maven.apache.org/maven2 + default + + false + + + + sonatype-snapshots + Sonatype Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + sonatype-staging + Sonatype Staging + https://oss.sonatype.org/content/repositories/staging + + false + + +