diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..01012e3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,143 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + android-compile: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + cache: maven + + - name: Set up Android SDK + uses: android-actions/setup-android@v3 + + - name: Set up Codename One Build Client + shell: bash + run: | + set -euo pipefail + mkdir -p "$HOME/.codenameone" + curl -fsSL https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar \ + -o "$HOME/.codenameone/CodeNameOneBuildClient.jar" + + - name: Compute snapshot version + id: versions + shell: bash + run: | + set -euo pipefail + current_version="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" + if [[ "$current_version" == *-SNAPSHOT ]]; then + snapshot_version="$current_version" + else + snapshot_version="${current_version}-SNAPSHOT" + fi + echo "snapshot_version=$snapshot_version" >> "$GITHUB_OUTPUT" + + - name: Build cn1lib snapshot into local Maven repository + shell: bash + run: | + set -euo pipefail + mvn -B -ntp versions:set -DnewVersion="${{ steps.versions.outputs.snapshot_version }}" -DgenerateBackupPoms=false + mvn -B -ntp -DskipTests install + + - name: Generate Android source project from sample app + working-directory: fingerprint-scanner-test + shell: bash + run: | + set -euo pipefail + export JAVA17_HOME="$JAVA_HOME" + chmod +x mvnw + xvfb-run -a ./mvnw -B -ntp package \ + -DskipTests \ + -Dopen=false \ + -Dcodename1.platform=android \ + -Dcodename1.buildTarget=android-source \ + -Dfingerprint.scanner.version="${{ steps.versions.outputs.snapshot_version }}" + + - name: Build generated Android Gradle project + working-directory: fingerprint-scanner-test/android/target/myappname-android-1.0-SNAPSHOT-android-source + shell: bash + run: | + set -euo pipefail + chmod +x gradlew + ./gradlew --no-daemon --stacktrace assembleDebug + + ios-compile: + runs-on: macos-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + cache: maven + + - name: Set up Codename One Build Client + shell: bash + run: | + set -euo pipefail + mkdir -p "$HOME/.codenameone" + curl -fsSL https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar \ + -o "$HOME/.codenameone/CodeNameOneBuildClient.jar" + + - name: Compute snapshot version + id: versions + shell: bash + run: | + set -euo pipefail + current_version="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" + if [[ "$current_version" == *-SNAPSHOT ]]; then + snapshot_version="$current_version" + else + snapshot_version="${current_version}-SNAPSHOT" + fi + echo "snapshot_version=$snapshot_version" >> "$GITHUB_OUTPUT" + + - name: Build cn1lib snapshot into local Maven repository + shell: bash + run: | + set -euo pipefail + mvn -B -ntp versions:set -DnewVersion="${{ steps.versions.outputs.snapshot_version }}" -DgenerateBackupPoms=false + mvn -B -ntp -DskipTests install + + - name: Generate iOS source project from sample app + working-directory: fingerprint-scanner-test + shell: bash + run: | + set -euo pipefail + chmod +x mvnw + ./mvnw -B -ntp package \ + -DskipTests \ + -Dopen=false \ + -Dcodename1.platform=ios \ + -Dcodename1.buildTarget=ios-source \ + -Dfingerprint.scanner.version="${{ steps.versions.outputs.snapshot_version }}" + + - name: Build generated Xcode workspace + working-directory: fingerprint-scanner-test/ios/target/myappname-ios-1.0-SNAPSHOT-ios-source + shell: bash + run: | + set -euo pipefail + xcodebuild \ + -workspace MyAppName.xcworkspace \ + -scheme MyAppName \ + -configuration Debug \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + CODE_SIGNING_ALLOWED=NO \ + build diff --git a/fingerprint-scanner-test/.gitignore b/fingerprint-scanner-test/.gitignore new file mode 100644 index 0000000..0e46cff --- /dev/null +++ b/fingerprint-scanner-test/.gitignore @@ -0,0 +1,5 @@ +**/target/ +.idea/ +*.iml +.DS_Store +Thumbs.db diff --git a/fingerprint-scanner-test/.mvn/jvm.config b/fingerprint-scanner-test/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/fingerprint-scanner-test/.mvn/wrapper/MavenWrapperDownloader.java b/fingerprint-scanner-test/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/fingerprint-scanner-test/.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/fingerprint-scanner-test/.mvn/wrapper/maven-wrapper.properties b/fingerprint-scanner-test/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/fingerprint-scanner-test/.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/fingerprint-scanner-test/README.md b/fingerprint-scanner-test/README.md new file mode 100644 index 0000000..1927aa8 --- /dev/null +++ b/fingerprint-scanner-test/README.md @@ -0,0 +1,19 @@ +# Codename One Project + +This is a multi-module Maven project for a Codename One app. +You can write the app in Java and/or Kotlin, and build for Android, iOS, desktop, and web. + +## Getting Started + +You selected a Java template. Start here: +https://shannah.github.io/cn1-maven-archetypes/cn1app-archetype-tutorial/getting-started.html + +## IntelliJ Users + +This project should work in IntelliJ out of the box. +You usually don't need to copy or tweak any project files. + +## Help and Support + +- Codename One website: https://www.codenameone.com +- Codename One GitHub: https://github.com/codenameone/CodenameOne diff --git a/fingerprint-scanner-test/android/pom.xml b/fingerprint-scanner-test/android/pom.xml new file mode 100644 index 0000000..43372f9 --- /dev/null +++ b/fingerprint-scanner-test/android/pom.xml @@ -0,0 +1,156 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-android + 1.0-SNAPSHOT + + myappname-android + + + UTF-8 + 1.8 + 1.8 + android + android + android-device + + + src/main/empty + + + + src/main/java + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.1 + + + default-jar + none + + + + + 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.apache.maven.plugins + maven-jar-plugin + 3.4.1 + + + default-jar + none + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/../common/codenameone_settings.properties + + + + + + + + maven-antrun-plugin + + + adb-install + verify + + run + + + + Running adb install + + + + + + + Trying to start app on device using adb + + + + + + + + + + + + + + + + + + diff --git a/fingerprint-scanner-test/build.bat b/fingerprint-scanner-test/build.bat new file mode 100644 index 0000000..b7ccc0e --- /dev/null +++ b/fingerprint-scanner-test/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/fingerprint-scanner-test/build.sh b/fingerprint-scanner-test/build.sh new file mode 100644 index 0000000..8a99f56 --- /dev/null +++ b/fingerprint-scanner-test/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/fingerprint-scanner-test/common/codenameone_settings.properties b/fingerprint-scanner-test/common/codenameone_settings.properties new file mode 100644 index 0000000..23a1370 --- /dev/null +++ b/fingerprint-scanner-test/common/codenameone_settings.properties @@ -0,0 +1,24 @@ +codename1.android.keystore= +codename1.android.keystoreAlias= +codename1.android.keystorePassword= +codename1.arg.ios.newStorageLocation=true +codename1.arg.java.version=8 +codename1.displayName=MyAppName +codename1.icon=icon.png +codename1.ios.appid=Q5GHSKAL2F.com.example.myapp +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.kotlin=false +codename1.mainName=MyAppName +codename1.packageName=com.example.myapp +codename1.secondaryTitle=Hello World +codename1.vendor=CodenameOne +codename1.version=1.0 +codename1.cssTheme=true diff --git a/fingerprint-scanner-test/common/icon.png b/fingerprint-scanner-test/common/icon.png new file mode 100644 index 0000000..1f4fa5d Binary files /dev/null and b/fingerprint-scanner-test/common/icon.png differ diff --git a/fingerprint-scanner-test/common/pom.xml b/fingerprint-scanner-test/common/pom.xml new file mode 100644 index 0000000..6c1c038 --- /dev/null +++ b/fingerprint-scanner-test/common/pom.xml @@ -0,0 +1,399 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-common + 1.0-SNAPSHOT + jar + + + + + com.codenameone + codenameone-core + + + com.codenameone + codenameone-javase + test + + + + com.codenameone + fingerprint-scanner-lib + ${fingerprint.scanner.version} + pom + + + + + + + + + + install-codenameone + ${user.home}/.codenameone/guibuilder.jar + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + validate + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + kotlin + + + + ${basedir}/src/main/kotlin + + + + 1.6.0 + true + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + + org.jetbrains + annotations + 13.0 + + + com.codenameone + java-runtime + provided + + + + + + 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 + + + -no-reflect + -no-jdk + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + -no-reflect + -no-jdk + + + + + + + + + + + + + javase + + + codename1.platform + javase + + + + javase + + + + + org.codehaus.mojo + exec-maven-plugin + + java + true + + -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 + + + xalan + serializer + 2.7.3 + + + + + + generate-gui-sources + process-sources + + generate-gui-sources + + + + cn1-process-classes + process-classes + + compliance-check + css + + + + + attach-test-artifact + test + + attach-test-artifact + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + + + diff --git a/fingerprint-scanner-test/common/src/main/css/theme.css b/fingerprint-scanner-test/common/src/main/css/theme.css new file mode 100644 index 0000000..1b64520 --- /dev/null +++ b/fingerprint-scanner-test/common/src/main/css/theme.css @@ -0,0 +1,54 @@ +/** Define Theme Constants here */ +#Constants { + includeNativeBool: true; + defaultSourceDPIInt: "0"; +} + +/** Style for Button class */ +Button { + font-family: "native:MainLight"; + font-size: 3mm; +} + +/** Style for App Title Bar Text */ +Title { + font-family: "native:MainLight"; + font-size: 6mm; +} + +/** Style for Dialog body */ +DialogBody { + font-family: "native:MainLight"; + font-size: 2.8mm; +} + +/** Style for Dialog title bar text */ +DialogTitle { + font-family: "native:MainLight"; + font-size: 4.5mm; +} + +/** Style for the side menu */ +SideNavigationPanel { + background: white; + padding: 2mm 1mm 1mm 1mm; +} + +@media platform-ios { + /** iOS Only styles for side menu. */ + SideNavigationPanel { + /** Extra top padding to deal with notch on iPhoneX */ + padding: 6mm 1mm 1mm 1mm; + } +} + +/** Style for commands in side menu. */ +SideCommand { + padding: 1mm; + border: none; + text-decoration: none; + color: black; + font-family: "native:MainLight"; + font-size: 4mm; + border-bottom: 2px solid #cccccc; +} diff --git a/fingerprint-scanner-test/common/src/main/java/com/example/myapp/MyAppName.java b/fingerprint-scanner-test/common/src/main/java/com/example/myapp/MyAppName.java new file mode 100644 index 0000000..5e60c4c --- /dev/null +++ b/fingerprint-scanner-test/common/src/main/java/com/example/myapp/MyAppName.java @@ -0,0 +1,78 @@ +package com.example.myapp; + +import static com.codename1.ui.CN.*; + +import com.codename1.components.SpanLabel; +import com.codename1.fingerprint.Fingerprint; +import com.codename1.system.Lifecycle; +import com.codename1.ui.*; +import com.codename1.ui.layouts.*; +import com.codename1.io.*; +import com.codename1.ui.plaf.*; +import com.codename1.ui.util.Resources; + +/** + * This file was generated by Codename One for the purpose + * of building native mobile applications using Java. + */ +public class MyAppName extends Lifecycle { + @Override + public void runApp() { + Form hi = new Form("Fingerprint", BoxLayout.y()); + if(!Fingerprint.isAvailable()) { + hi.add("Fingerprint not available..."); + } else { + Button scanFingerprint = new Button("Scan Fingerprint"); + hi.add(scanFingerprint); + scanFingerprint.addActionListener(e -> { + Fingerprint.scanFingerprint(value -> { + hi.add("Scan successfull!"); + hi.revalidate(); + }, (sender, err, errorCode, errorMessage) -> { + hi.add("Scan Failed!"); + hi.revalidate(); + }); + }); + } + + Button savePassword = new Button("Save Password"); + Button getPassword = new Button("Get Password"); + + savePassword.addActionListener(e -> storePassword()); + getPassword.addActionListener(e -> fetchPassword()); + hi.add(savePassword); + hi.add(getPassword); + + hi.show(); + } + + private void storePassword() { + String account = "steve@example.com"; + String password = "...."; + + Fingerprint.addPassword( + "Adding secure item to keystore", // Message to display in authentication dialog + account, + password + ).onResult((success, err)->{ + if (err != null) { + Log.e(err); + Dialog.show("Error", "Failed to add password to keystore: " + err, "OK", null); + } else { + // success always true if there was no error. + Dialog.show("Success", "Successfully added password to keystore", "OK", null); + } + }); + } + + private void fetchPassword() { + Fingerprint.getPassword("Because", "steve@example.com") + .onResult((String res, Throwable err) -> { + Display.getInstance().callSerially(() -> { + Dialog.show("Message", "Biometric login testing here 2", "OK", null); + }); + }); + + } + +} diff --git a/fingerprint-scanner-test/ios/pom.xml b/fingerprint-scanner-test/ios/pom.xml new file mode 100644 index 0000000..819d149 --- /dev/null +++ b/fingerprint-scanner-test/ios/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-ios + 1.0-SNAPSHOT + + myappname-ios + + + UTF-8 + 1.8 + 1.8 + ios + ios + ios-device + + + + + src/main/objectivec + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.1 + + + default-jar + none + + + + + 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/fingerprint-scanner-test/javascript/pom.xml b/fingerprint-scanner-test/javascript/pom.xml new file mode 100644 index 0000000..4fef89d --- /dev/null +++ b/fingerprint-scanner-test/javascript/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-javascript + 1.0-SNAPSHOT + + myappname-javascript + + + UTF-8 + 1.8 + 1.8 + javascript + javascript + javascript + + + + + src/main/javascript + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.1 + + + default-jar + none + + + + + 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/fingerprint-scanner-test/javase/pom.xml b/fingerprint-scanner-test/javase/pom.xml new file mode 100644 index 0000000..69dfddb --- /dev/null +++ b/fingerprint-scanner-test/javase/pom.xml @@ -0,0 +1,778 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-javase + 1.0-SNAPSHOT + + myappname-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.example.myapp.MyAppNameStub + + + + 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 + + + generate-javase-zip + package + + + + + + + + + + + + + + + + + run + + + + + + + + + + + run-desktop + + javase + com.example.myapp.MyAppNameStub + + + + 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 + + + true + + + + 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 + + + -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 + + + -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 + + -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/fingerprint-scanner-test/javase/src/desktop/resources/NativeTheme.res b/fingerprint-scanner-test/javase/src/desktop/resources/NativeTheme.res new file mode 100644 index 0000000..83e067b Binary files /dev/null and b/fingerprint-scanner-test/javase/src/desktop/resources/NativeTheme.res differ diff --git a/fingerprint-scanner-test/mvnw b/fingerprint-scanner-test/mvnw new file mode 100644 index 0000000..41c0f0c --- /dev/null +++ b/fingerprint-scanner-test/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/fingerprint-scanner-test/mvnw.cmd b/fingerprint-scanner-test/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/fingerprint-scanner-test/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/fingerprint-scanner-test/pom.xml b/fingerprint-scanner-test/pom.xml new file mode 100644 index 0000000..1f418ac --- /dev/null +++ b/fingerprint-scanner-test/pom.xml @@ -0,0 +1,186 @@ + + 4.0.0 + com.example.myapp + myappname + 1.0-SNAPSHOT + pom + myappname + myappname + https://www.codenameone.com + + + GPL v2 With Classpath Exception + https://openjdk.java.net/legal/gplv2+ce.html + repo + A business-friendly OSS license + + + +common + + + 7.0.228 + 7.0.228 + UTF-8 + 1.8 + 11 + 1.7.11 + 3.8.0 + 1.8 + 1.8 + 1.8 + myappname + 1.1.4 + + + + + com.codenameone + java-runtime + ${cn1.version} + + + 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-compiler-plugin + ${maven-compiler-plugin.version} + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + maven-antrun-plugin + org.apache.maven.plugins + 3.1.0 + + + + + + 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/fingerprint-scanner-test/run.bat b/fingerprint-scanner-test/run.bat new file mode 100644 index 0000000..f8b979c --- /dev/null +++ b/fingerprint-scanner-test/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! cn1:settings -e + +goto :EOF +:update +!MVNW! cn1: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/fingerprint-scanner-test/run.sh b/fingerprint-scanner-test/run.sh new file mode 100644 index 0000000..ef0a12c --- /dev/null +++ b/fingerprint-scanner-test/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" "cn1:settings" "-e" +} +function update { + + "$MVNW" "cn1: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/fingerprint-scanner-test/win/pom.xml b/fingerprint-scanner-test/win/pom.xml new file mode 100644 index 0000000..854a09b --- /dev/null +++ b/fingerprint-scanner-test/win/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.example.myapp + myappname + 1.0-SNAPSHOT + + com.example.myapp + myappname-win + 1.0-SNAPSHOT + + myappname-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 0adc812..6978a25 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,7 @@ 1.8 11 3.8.0 + 3.4.0 8 8 fingerprint-scanner @@ -203,6 +204,7 @@ org.apache.maven.plugins maven-source-plugin + ${maven-source-plugin.version} attach-sources