diff --git a/.gitattributes b/.gitattributes
index ff8c4ea..d03a971 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -18,3 +18,35 @@
*.css text eol=lf
*.js text eol=lf
*.sql text eol=lf
+*.kts text eol=lf
+*.gradle.kts text eol=lf
+
+###############################
+# Git Large File System (LFS) #
+###############################
+
+# Archives
+*.7z filter=lfs diff=lfs merge=lfs -text
+*.br filter=lfs diff=lfs merge=lfs -text
+*.gz filter=lfs diff=lfs merge=lfs -text
+*.tar filter=lfs diff=lfs merge=lfs -text
+*.zip filter=lfs diff=lfs merge=lfs -text
+
+# Documents
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.docx diff=astextplain merge=lfs -text
+
+# Images
+*.gif filter=lfs diff=lfs merge=lfs -text
+*.ico filter=lfs diff=lfs merge=lfs -text
+*.jpg filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.png filter=lfs diff=lfs merge=lfs -text
+*.psd filter=lfs diff=lfs merge=lfs -text
+*.webp filter=lfs diff=lfs merge=lfs -text
+
+# Fonts
+*.woff2 filter=lfs diff=lfs merge=lfs -text
+
+# Other
+*.exe filter=lfs diff=lfs merge=lfs -text
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000..ced6996
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,53 @@
+name: Build and Test
+
+on:
+ pull_request:
+ branches: [main]
+ push:
+ branches: [main]
+
+jobs:
+ build-and-test-example-card-calypso:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Card_Calypso
+
+ build-and-test-example-distributed-poolreaderserverside-webservice:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Distributed_PoolReaderServerSide_Webservice
+
+ build-and-test-example-distributed-readerclientside-webservice:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Distributed_ReaderClientSide_Webservice
+
+ build-and-test-example-distributed-readerclientside-websocket:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Distributed_ReaderClientSide_Websocket
+
+ build-and-test-example-plugin-android-nfc:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Plugin_Android_NFC
+
+ build-and-test-example-plugin-android-omapi:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Plugin_Android_OMAPI
+
+ build-and-test-example-plugin-pcsc:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Plugin_PCSC
+
+ build-and-test-example-service:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Service
+
+ build-and-test-example-service-resource:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
+ with:
+ working-directory: Example_Service_Resource
diff --git a/.gitignore b/.gitignore
index 006f681..a791738 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,6 @@ local.properties
# Gradle
.gradle/
build*/
-LICENSE_HEADER
# Eclipse
.classpath
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15b2812..09218fd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fixed bad preparation of the selection in PC/SC examples.
+### Changed
+- Migrated the CI pipeline from Jenkins to GitHub Actions.
+### Upgraded
+- `keyple-plugin-pcsc-java-lib:2.5.2`
## [2025-04-18]
### Changed
diff --git a/Example_Card_Calypso/LICENSE_HEADER b/Example_Card_Calypso/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Card_Calypso/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Card_Calypso/build.gradle.kts b/Example_Card_Calypso/build.gradle.kts
index fbe7ccf..b9d311f 100644
--- a/Example_Card_Calypso/build.gradle.kts
+++ b/Example_Card_Calypso/build.gradle.kts
@@ -1,153 +1,303 @@
-import java.time.OffsetDateTime
-import java.time.format.DateTimeFormatter
-
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
-}
-dependencies {
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keypop:keypop-calypso-crypto-legacysam-java-api:0.7.0")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
- implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
- implementation("org.eclipse.keyple:keyple-card-calypso-crypto-legacysam-java-lib:0.9.0")
- implementation("org.eclipse.keyple:keyple-card-calypso-crypto-pki-java-lib:0.2.1")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
- implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
-// End Keyple configuration
- implementation("org.slf4j:slf4j-simple:1.7.32")
- implementation("com.google.code.gson:gson:2.10.1")
-}
-
-val javaSourceLevel: String by project
-val javaTargetLevel: String by project
-java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+dependencies {
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keypop:keypop-calypso-crypto-legacysam-java-api:0.7.0")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
+ implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
+ implementation("org.eclipse.keyple:keyple-card-calypso-crypto-legacysam-java-lib:0.9.0")
+ implementation("org.eclipse.keyple:keyple-card-calypso-crypto-pki-java-lib:0.2.1")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
+ // End Keyple configuration
+ implementation("org.slf4j:slf4j-simple:1.7.32")
+ implementation("com.google.code.gson:gson:2.10.1")
}
val buildTimeAndDate = OffsetDateTime.now()
val buildDate = DateTimeFormatter.ISO_LOCAL_DATE.format(buildTimeAndDate)
val buildTime = DateTimeFormatter.ofPattern("HH:mm:ss.SSSZ").format(buildTimeAndDate)
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
- }
- }
- register("fatJarTN313", Jar::class.java) {
- archiveClassifier.set("TN313-fat")
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- manifest {
- attributes(
- "Main-Class" to "org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc",
- "Created-By" to "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
+ register("fatJarTN313", Jar::class.java) {
+ archiveClassifier.set("TN313-fat")
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ manifest {
+ attributes(
+ "Main-Class" to
+ "org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc",
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
System.getProperty(
"java.vm.version"
)
})",
- "Build-Date" to buildDate,
- "Build-Time" to buildTime,
- "Specification-Title" to project.name,
- "Implementation-Version" to project.version,
- "Bundle-Name" to project.name,
- "Bundle-Description" to project.description
- )
- }
- from(configurations.runtimeClasspath.get()
+ "Build-Date" to buildDate,
+ "Build-Time" to buildTime,
+ "Specification-Title" to project.name,
+ "Implementation-Version" to project.version,
+ "Bundle-Name" to project.name,
+ "Bundle-Description" to project.description)
+ }
+ from(
+ configurations.runtimeClasspath
+ .get()
.onEach { println("add from dependencies: ${it.name}") }
.map { if (it.isDirectory) it else zipTree(it) })
- val sourcesMain = sourceSets.main.get()
- sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
- from(sourcesMain.output)
- }
- register("fatJarPerfEmbeddedValidation", Jar::class.java) {
- archiveClassifier.set("PerfEmbeddedValidation-fat")
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- manifest {
- attributes(
- "Main-Class" to "org.eclipse.keyple.card.calypso.example.UseCase12_PerformanceMeasurement_EmbeddedValidation.Main_PerformanceMeasurement_EmbeddedValidation_Pcsc",
- "Created-By" to "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
+ val sourcesMain = sourceSets.main.get()
+ sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
+ from(sourcesMain.output)
+ }
+ register("fatJarPerfEmbeddedValidation", Jar::class.java) {
+ archiveClassifier.set("PerfEmbeddedValidation-fat")
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ manifest {
+ attributes(
+ "Main-Class" to
+ "org.eclipse.keyple.card.calypso.example.UseCase12_PerformanceMeasurement_EmbeddedValidation.Main_PerformanceMeasurement_EmbeddedValidation_Pcsc",
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
System.getProperty(
"java.vm.version"
)
})",
- "Build-Date" to buildDate,
- "Build-Time" to buildTime,
- "Specification-Title" to project.name,
- "Implementation-Version" to project.version,
- "Bundle-Name" to project.name,
- "Bundle-Description" to project.description
- )
- }
- from(configurations.runtimeClasspath.get()
+ "Build-Date" to buildDate,
+ "Build-Time" to buildTime,
+ "Specification-Title" to project.name,
+ "Implementation-Version" to project.version,
+ "Bundle-Name" to project.name,
+ "Bundle-Description" to project.description)
+ }
+ from(
+ configurations.runtimeClasspath
+ .get()
.onEach { println("add from dependencies: ${it.name}") }
.map { if (it.isDirectory) it else zipTree(it) })
- val sourcesMain = sourceSets.main.get()
- sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
- from(sourcesMain.output)
- }
- register("fatJarPerfDistributedReloading", Jar::class.java) {
- archiveClassifier.set("PerfDistributedReloading-fat")
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- manifest {
- attributes(
- "Main-Class" to "org.eclipse.keyple.card.calypso.example.UseCase13_PerformanceMeasurement_DistributedReloading.Main_PerformanceMeasurement_DistributedReloading_Pcsc",
- "Created-By" to "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
+ val sourcesMain = sourceSets.main.get()
+ sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
+ from(sourcesMain.output)
+ }
+ register("fatJarPerfDistributedReloading", Jar::class.java) {
+ archiveClassifier.set("PerfDistributedReloading-fat")
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ manifest {
+ attributes(
+ "Main-Class" to
+ "org.eclipse.keyple.card.calypso.example.UseCase13_PerformanceMeasurement_DistributedReloading.Main_PerformanceMeasurement_DistributedReloading_Pcsc",
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${
System.getProperty(
"java.vm.version"
)
})",
- "Build-Date" to buildDate,
- "Build-Time" to buildTime,
- "Specification-Title" to project.name,
- "Implementation-Version" to project.version,
- "Bundle-Name" to project.name,
- "Bundle-Description" to project.description
- )
- }
- from(configurations.runtimeClasspath.get()
+ "Build-Date" to buildDate,
+ "Build-Time" to buildTime,
+ "Specification-Title" to project.name,
+ "Implementation-Version" to project.version,
+ "Bundle-Name" to project.name,
+ "Bundle-Description" to project.description)
+ }
+ from(
+ configurations.runtimeClasspath
+ .get()
.onEach { println("add from dependencies: ${it.name}") }
.map { if (it.isDirectory) it else zipTree(it) })
- val sourcesMain = sourceSets.main.get()
- sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
- from(sourcesMain.output)
+ val sourcesMain = sourceSets.main.get()
+ sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
+ from(sourcesMain.output)
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
+}
+
+val javaSourceLevel: String by project
+val javaTargetLevel: String by project
+
+java {
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
+}
+
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
+}
+
+tasks {
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "
$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
}
-}
\ No newline at end of file
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
+ }
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
+}
diff --git a/Example_Card_Calypso/gradle.properties b/Example_Card_Calypso/gradle.properties
index 4cd096d..6ba075d 100644
--- a/Example_Card_Calypso/gradle.properties
+++ b/Example_Card_Calypso/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Card Calypso Java Examples
description = Card Calypso examples using the API of the Keyple solution.
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Card_Calypso/settings.gradle.kts b/Example_Card_Calypso/settings.gradle.kts
index 94ed839..88e0cb3 100644
--- a/Example_Card_Calypso/settings.gradle.kts
+++ b/Example_Card_Calypso/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Card_Calypso"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Distributed_PoolReaderServerSide_Webservice/LICENSE_HEADER b/Example_Distributed_PoolReaderServerSide_Webservice/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Distributed_PoolReaderServerSide_Webservice/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Distributed_PoolReaderServerSide_Webservice/build.gradle.kts b/Example_Distributed_PoolReaderServerSide_Webservice/build.gradle.kts
index 0c135f2..8fc4446 100644
--- a/Example_Distributed_PoolReaderServerSide_Webservice/build.gradle.kts
+++ b/Example_Distributed_PoolReaderServerSide_Webservice/build.gradle.kts
@@ -1,78 +1,218 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
- id("io.quarkus") version "1.8.1.Final"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
+ id("io.quarkus") version "1.8.1.Final"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
+
+dependencies {
+ /* Keyple dependencies */
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
+ // End Keyple configuration
+ /* Quarkus */
+ implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
+ implementation("io.quarkus:quarkus-resteasy-jsonb")
+ implementation("io.quarkus:quarkus-resteasy")
+ implementation("io.quarkus:quarkus-rest-client")
+ testImplementation("io.quarkus:quarkus-junit5")
+ testImplementation("io.rest-assured:rest-assured")
+}
+
+val runExample by
+ tasks.creating(Jar::class) {
+ group = "keyple"
+ dependsOn.add("quarkusDev")
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
}
-dependencies {
- /* Keyple dependencies */
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
- implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
- implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
-// End Keyple configuration
- /* Quarkus */
- implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
- implementation("io.quarkus:quarkus-resteasy-jsonb")
- implementation("io.quarkus:quarkus-resteasy")
- implementation("io.quarkus:quarkus-rest-client")
- testImplementation("io.quarkus:quarkus-junit5")
- testImplementation("io.rest-assured:rest-assured")
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("**/src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
}
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
+ }
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
}
+ }
}
-val runExample by tasks.creating(Jar::class) {
- group = "keyple"
- dependsOn.add("quarkusDev")
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Distributed_PoolReaderServerSide_Webservice/gradle.properties b/Example_Distributed_PoolReaderServerSide_Webservice/gradle.properties
index 5fb91b9..47db070 100644
--- a/Example_Distributed_PoolReaderServerSide_Webservice/gradle.properties
+++ b/Example_Distributed_PoolReaderServerSide_Webservice/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Example Distributed PoolReaderServerSide Webservice
description = Examples of use of Keyple Distributed Java components
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Distributed_PoolReaderServerSide_Webservice/settings.gradle.kts b/Example_Distributed_PoolReaderServerSide_Webservice/settings.gradle.kts
index 5bd834e..acf141b 100644
--- a/Example_Distributed_PoolReaderServerSide_Webservice/settings.gradle.kts
+++ b/Example_Distributed_PoolReaderServerSide_Webservice/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Distributed_PoolReaderServerSide_Webservice"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Distributed_ReaderClientSide_Webservice/LICENSE_HEADER b/Example_Distributed_ReaderClientSide_Webservice/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Distributed_ReaderClientSide_Webservice/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Distributed_ReaderClientSide_Webservice/build.gradle.kts b/Example_Distributed_ReaderClientSide_Webservice/build.gradle.kts
index 0c135f2..8fc4446 100644
--- a/Example_Distributed_ReaderClientSide_Webservice/build.gradle.kts
+++ b/Example_Distributed_ReaderClientSide_Webservice/build.gradle.kts
@@ -1,78 +1,218 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
- id("io.quarkus") version "1.8.1.Final"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
+ id("io.quarkus") version "1.8.1.Final"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
+
+dependencies {
+ /* Keyple dependencies */
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
+ // End Keyple configuration
+ /* Quarkus */
+ implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
+ implementation("io.quarkus:quarkus-resteasy-jsonb")
+ implementation("io.quarkus:quarkus-resteasy")
+ implementation("io.quarkus:quarkus-rest-client")
+ testImplementation("io.quarkus:quarkus-junit5")
+ testImplementation("io.rest-assured:rest-assured")
+}
+
+val runExample by
+ tasks.creating(Jar::class) {
+ group = "keyple"
+ dependsOn.add("quarkusDev")
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
}
-dependencies {
- /* Keyple dependencies */
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
- implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
- implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
-// End Keyple configuration
- /* Quarkus */
- implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
- implementation("io.quarkus:quarkus-resteasy-jsonb")
- implementation("io.quarkus:quarkus-resteasy")
- implementation("io.quarkus:quarkus-rest-client")
- testImplementation("io.quarkus:quarkus-junit5")
- testImplementation("io.rest-assured:rest-assured")
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("**/src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
}
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
+ }
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
}
+ }
}
-val runExample by tasks.creating(Jar::class) {
- group = "keyple"
- dependsOn.add("quarkusDev")
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Distributed_ReaderClientSide_Webservice/gradle.properties b/Example_Distributed_ReaderClientSide_Webservice/gradle.properties
index 02d547b..9f063df 100644
--- a/Example_Distributed_ReaderClientSide_Webservice/gradle.properties
+++ b/Example_Distributed_ReaderClientSide_Webservice/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Example Distributed ReaderClientSide Webservice
description = Examples of use of Keyple Distributed Java components
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Distributed_ReaderClientSide_Webservice/settings.gradle.kts b/Example_Distributed_ReaderClientSide_Webservice/settings.gradle.kts
index b8f19fd..4ba99fa 100644
--- a/Example_Distributed_ReaderClientSide_Webservice/settings.gradle.kts
+++ b/Example_Distributed_ReaderClientSide_Webservice/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Distributed_ReaderClientSide_Webservice"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Distributed_ReaderClientSide_Websocket/LICENSE_HEADER b/Example_Distributed_ReaderClientSide_Websocket/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Distributed_ReaderClientSide_Websocket/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Distributed_ReaderClientSide_Websocket/build.gradle.kts b/Example_Distributed_ReaderClientSide_Websocket/build.gradle.kts
index 77a2111..9201539 100644
--- a/Example_Distributed_ReaderClientSide_Websocket/build.gradle.kts
+++ b/Example_Distributed_ReaderClientSide_Websocket/build.gradle.kts
@@ -1,79 +1,219 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
- id("io.quarkus") version "1.8.1.Final"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
+ id("io.quarkus") version "1.8.1.Final"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
+
+dependencies {
+ /* Keyple dependencies */
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
+ implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
+ // End Keyple configuration
+ /* Quarkus */
+ implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
+ implementation("io.quarkus:quarkus-resteasy")
+ implementation("io.quarkus:quarkus-undertow-websockets")
+ testImplementation("io.quarkus:quarkus-junit5")
+ testImplementation("io.rest-assured:rest-assured")
+ /* Others */
+ implementation("com.google.code.gson:gson:2.10.1")
+}
+
+val runExample by
+ tasks.creating(Jar::class) {
+ group = "keyple"
+ dependsOn.add("quarkusDev")
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
}
-dependencies {
- /* Keyple dependencies */
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-distributed-network-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-distributed-local-java-lib:2.5.2")
- implementation("org.eclipse.keyple:keyple-distributed-remote-java-lib:2.5.1")
- implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
- implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
-// End Keyple configuration
- /* Quarkus */
- implementation(enforcedPlatform("io.quarkus:quarkus-universe-bom:1.8.1.Final"))
- implementation("io.quarkus:quarkus-resteasy")
- implementation("io.quarkus:quarkus-undertow-websockets")
- testImplementation("io.quarkus:quarkus-junit5")
- testImplementation("io.rest-assured:rest-assured")
- /* Others */
- implementation("com.google.code.gson:gson:2.10.1")
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("**/src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
}
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
+ }
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
}
+ }
}
-val runExample by tasks.creating(Jar::class) {
- group = "keyple"
- dependsOn.add("quarkusDev")
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Distributed_ReaderClientSide_Websocket/gradle.properties b/Example_Distributed_ReaderClientSide_Websocket/gradle.properties
index 22f1a37..2671fee 100644
--- a/Example_Distributed_ReaderClientSide_Websocket/gradle.properties
+++ b/Example_Distributed_ReaderClientSide_Websocket/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Example Distributed ReaderClientSide Websocket
description = Examples of use of Keyple Distributed Java components
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Distributed_ReaderClientSide_Websocket/settings.gradle.kts b/Example_Distributed_ReaderClientSide_Websocket/settings.gradle.kts
index b89c9cc..d0efeec 100644
--- a/Example_Distributed_ReaderClientSide_Websocket/settings.gradle.kts
+++ b/Example_Distributed_ReaderClientSide_Websocket/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Distributed_ReaderClientSide_Websocket"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Plugin_Android_NFC/LICENSE_HEADER b/Example_Plugin_Android_NFC/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Plugin_Android_NFC/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Plugin_Android_NFC/app/build.gradle.kts b/Example_Plugin_Android_NFC/app/build.gradle.kts
index 7bfe12e..fc250b0 100644
--- a/Example_Plugin_Android_NFC/app/build.gradle.kts
+++ b/Example_Plugin_Android_NFC/app/build.gradle.kts
@@ -1,164 +1,275 @@
-/**
- * The first section in the build configuration applies the Android Gradle plugin
- * to this build and makes the android block available to specify
- * Android-specific build options.
- */
+///////////////////////////////////////////////////////////////////////////////
+// GRADLE CONFIGURATION
+///////////////////////////////////////////////////////////////////////////////
plugins {
- id("com.android.application")
- id("kotlin-android")
- id("kotlin-parcelize")
- id("com.diffplug.spotless")
+ id("com.android.application")
+ id("kotlin-android")
+ id("kotlin-parcelize")
+ id("com.diffplug.spotless")
+ id("org.jetbrains.dokka")
+ signing
+ `maven-publish`
}
-apply(plugin = "org.eclipse.keyple")
-/**
- * The android block is where you configure all your Android-specific
- * build options.
- */
+///////////////////////////////////////////////////////////////////////////////
+// APP CONFIGURATION
+///////////////////////////////////////////////////////////////////////////////
-android {
-
- /**
- * The app's namespace. Used primarily to access app resources.
- */
-
- namespace = "org.eclipse.keyple"
-
- /**
- * compileSdk specifies the Android API level Gradle should use to
- * compile your app. This means your app can use the API features included in
- * this API level and lower.
- */
-
- compileSdk = 34
-
- /**
- * The defaultConfig block encapsulates default settings and entries for all
- * build variants and can override some attributes in main/AndroidManifest.xml
- * dynamically from the build system. You can configure product flavors to override
- * these values for different versions of your app.
- */
-
- defaultConfig {
- // Uniquely identifies the package for publishing.
- applicationId = "org.eclipse.keyple.demo"
+dependencies {
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
+ implementation("org.eclipse.keyple:keyple-plugin-android-nfc-java-lib:3.0.0")
+ // End Keyple configuration
+ // Android components
+ implementation("androidx.appcompat:appcompat:1.6.1")
+ implementation("com.google.android.material:material:1.10.0")
+ implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.activity:activity-ktx:1.8.1")
+ implementation("androidx.fragment:fragment-ktx:1.6.2")
+ implementation("androidx.multidex:multidex:2.0.1")
+ // Kotlin
+ implementation("androidx.core:core-ktx:1.12.0")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20")
+ // Coroutines
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
+ // Logging
+ implementation("com.jakewharton.timber:timber:5.0.1")
+ implementation("org.slf4j:slf4j-api:1.7.32")
+ implementation("uk.uuid.slf4j:slf4j-android:1.7.32-0")
+}
- // Defines the minimum API level required to run the app.
- minSdk = 24
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR ANDROID APPLICATION KOTLIN-BASED PROJECTS
+///////////////////////////////////////////////////////////////////////////////
- // Specifies the API level used to test the app.
- targetSdk = 31
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
+}
- // Defines the version number of your app.
- versionCode = 1
+val title: String by project
+val javaSourceLevel: String by project
+val javaTargetLevel: String by project
+val generatedOverviewFile = layout.buildDirectory.file("tmp/overview-dokka.md")
- // Defines a user-friendly version name for your app.
- versionName = "1.0"
+android {
+ namespace = project.findProperty("androidAppNamespace") as String
+ compileSdk = (project.findProperty("androidCompileSdk") as String).toInt()
+ defaultConfig {
+ applicationId = project.findProperty("androidAppId") as String
+ minSdk = (project.findProperty("androidMinSdk") as String).toInt()
+ versionCode = (project.findProperty("androidAppVersionCode") as String).toInt()
+ versionName = project.findProperty("androidAppVersionName") as String
+ }
+ buildFeatures { viewBinding = true }
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility")
+ }
+ kotlinOptions { jvmTarget = javaTargetLevel }
+ sourceSets {
+ getByName("main").java.srcDirs("src/main/kotlin")
+ getByName("debug").java.srcDirs("src/debug/kotlin")
+ }
+ packagingOptions {
+ // Exclude 'META-INF/NOTICE.md' to resolve the conflict that occurs when multiple dependencies
+ // include this file
+ resources.excludes.add("META-INF/NOTICE.md")
+ }
+ applicationVariants.all {
+ outputs.all {
+ val outputImpl = this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
+ val variantName = name
+ val versionName = project.version.toString()
+ val newName = "${rootProject.name}-$versionName-$variantName.apk"
+ outputImpl.outputFileName = newName
+ }
+ }
+ publishing {
+ singleVariant("release") {
+ // No withSourcesJar() and withJavadocJar(), as we'll configure them manually during release
+ }
+ }
+ lint { abortOnError = false }
+}
- /**
- * The buildTypes block is where you can configure multiple build types.
- * By default, the build system defines two build types: debug and release. The
- * debug build type is not explicitly shown in the default build configuration,
- * but it includes debugging tools and is signed with the debug key. The release
- * build type applies ProGuard settings and is not signed by default.
- */
-
- buildTypes {
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
+}
- /**
- * By default, Android Studio configures the release build type to enable code
- * shrinking, using minifyEnabled, and specifies the default ProGuard rules file.
- */
+tasks.withType().configureEach { archiveBaseName.set(rootProject.name) }
- getByName("release") {
- isMinifyEnabled = true // Enables code shrinking for the release build type.
- proguardFiles(
- getDefaultProguardFile("proguard-android.txt"),
- "proguard-rules.pro"
- )
- }
+tasks {
+ spotless {
+ kotlin {
+ target("src/**/*.kt")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ ktfmt()
}
-
- /**
- * Packaging Options Configuration
- */
- packagingOptions {
- // Exclude 'META-INF/NOTICE.md' to resolve the conflict that occurs when multiple dependencies include this file
- resources.excludes.add("META-INF/NOTICE.md")
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
}
-
- /**
- * Build Features Configuration
- */
- buildFeatures {
- // Enable View Binding to allow more efficient and type-safe view interaction in the code
- viewBinding = true
+ }
+ register("generateDokkaOverview") {
+ outputs.file(generatedOverviewFile)
+ doLast {
+ val file = generatedOverviewFile.get().asFile
+ file.parentFile.mkdirs()
+ file.writeText(
+ buildString {
+ appendLine("# Module $title")
+ appendLine()
+ appendLine(
+ file("src/main/kdoc/overview.md")
+ .takeIf { it.exists() }
+ ?.readText()
+ .orEmpty()
+ .trim())
+ appendLine()
+ appendLine("
")
+ appendLine()
+ appendLine("> ${project.findProperty("javadoc.copyright") as String}")
+ })
}
-
- sourceSets {
- getByName("main").java.srcDirs("src/main/kotlin")
- getByName("test").java.srcDirs("src/test/kotlin")
+ }
+ dokkaHtml.configure {
+ dependsOn("generateDokkaOverview")
+ dokkaSourceSets {
+ named("main") {
+ noAndroidSdkLink.set(false)
+ includeNonPublic.set(false)
+ includes.from(files(generatedOverviewFile))
+ moduleName.set(title)
+ }
}
+ doFirst { println("Generating Dokka HTML for ${project.name} version ${project.version}") }
+ }
+ withType().configureEach {
+ if (archiveClassifier.get() == "sources") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ }
+ register("sourcesJar") {
+ archiveClassifier.set("sources")
+ from(android.sourceSets.getByName("main").java.srcDirs)
+ from(layout.buildDirectory.dir("resources/main"))
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+ register("javadocJar") {
+ dependsOn(dokkaHtml)
+ archiveClassifier.set("javadoc")
+ from(dokkaHtml.flatMap { it.outputDirectory })
+ from(layout.buildDirectory.dir("resources/main"))
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+ register("copyLicenseFiles") { doLast { copyLicenseFiles() } }
}
-/**
- * The dependencies block in the module-level build configuration file
- * specifies dependencies required to build only the module itself.
- * To learn more, go to Add build dependencies.
- */
-
-dependencies {
-
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-card-calypso-java-lib:3.1.8")
- implementation("org.eclipse.keyple:keyple-plugin-android-nfc-java-lib:3.0.0")
-// End Keyple configuration
-
- /*
- Android components
- */
- implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("com.google.android.material:material:1.10.0")
- implementation("androidx.constraintlayout:constraintlayout:2.1.4")
- implementation("androidx.activity:activity-ktx:1.8.1")
- implementation("androidx.fragment:fragment-ktx:1.6.2")
-
- /*
- Log
- */
- implementation("org.slf4j:slf4j-api:1.7.32")
- implementation("com.jakewharton.timber:timber:5.0.1")
-
- /*
- Kotlin
- */
- implementation("androidx.core:core-ktx:1.12.0")
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10")
- implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
-
- /*
- Coroutines
- */
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
-
- implementation("androidx.multidex:multidex:2.0.1")
-}
-
-
-tasks {
- spotless {
- kotlin {
- target("**/*.kt")
- ktfmt()
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+afterEvaluate {
+ tasks.named("assembleRelease") { dependsOn("copyLicenseFiles") }
+ publishing {
+ publications {
+ create("mavenJava") {
+ from(components["release"])
+ artifactId = rootProject.name
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["javadocJar"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
}
+ }
}
-}
\ No newline at end of file
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
+}
diff --git a/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MainActivity.kt b/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MainActivity.kt
index 6af499c..a77ba31 100644
--- a/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MainActivity.kt
+++ b/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MainActivity.kt
@@ -23,11 +23,11 @@ import kotlinx.coroutines.launch
import org.eclipse.keyple.card.calypso.CalypsoExtensionService
import org.eclipse.keyple.core.service.SmartCardServiceProvider
import org.eclipse.keyple.core.util.HexUtil
-import org.eclipse.keyple.databinding.ActivityMainBinding
import org.eclipse.keyple.plugin.android.nfc.AndroidNfcConfig
import org.eclipse.keyple.plugin.android.nfc.AndroidNfcConstants
import org.eclipse.keyple.plugin.android.nfc.AndroidNfcPluginFactoryProvider
import org.eclipse.keyple.plugin.android.nfc.AndroidNfcSupportedProtocols
+import org.eclipse.keyple.plugin.android.nfc.example.databinding.ActivityMainBinding
import org.eclipse.keypop.calypso.card.CalypsoCardApiFactory
import org.eclipse.keypop.calypso.card.card.CalypsoCard
import org.eclipse.keypop.calypso.card.transaction.CardIOException
diff --git a/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MessageDisplayAdapter.kt b/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MessageDisplayAdapter.kt
index 2e3babd..28677a3 100644
--- a/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MessageDisplayAdapter.kt
+++ b/Example_Plugin_Android_NFC/app/src/main/kotlin/org/eclipse/keyple/plugin/android/nfc/example/MessageDisplayAdapter.kt
@@ -15,9 +15,9 @@ package org.eclipse.keyple.plugin.android.nfc.example
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import org.eclipse.keyple.databinding.ActionCardLayoutBinding
-import org.eclipse.keyple.databinding.HeaderCardLayoutBinding
-import org.eclipse.keyple.databinding.ResultCardLayoutBinding
+import org.eclipse.keyple.plugin.android.nfc.example.databinding.ActionCardLayoutBinding
+import org.eclipse.keyple.plugin.android.nfc.example.databinding.HeaderCardLayoutBinding
+import org.eclipse.keyple.plugin.android.nfc.example.databinding.ResultCardLayoutBinding
/**
* Adapter class for displaying messages in a RecyclerView.
diff --git a/Example_Plugin_Android_NFC/app/src/main/resources/uk/uuid/slf4j/android/config.properties b/Example_Plugin_Android_NFC/app/src/main/resources/uk/uuid/slf4j/android/config.properties
new file mode 100644
index 0000000..329ab69
--- /dev/null
+++ b/Example_Plugin_Android_NFC/app/src/main/resources/uk/uuid/slf4j/android/config.properties
@@ -0,0 +1 @@
+level.org.eclipse.keyple=DEBUG
\ No newline at end of file
diff --git a/Example_Plugin_Android_NFC/build.gradle.kts b/Example_Plugin_Android_NFC/build.gradle.kts
index 7b66841..184c65b 100644
--- a/Example_Plugin_Android_NFC/build.gradle.kts
+++ b/Example_Plugin_Android_NFC/build.gradle.kts
@@ -1,24 +1,15 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- id("com.diffplug.spotless") version "6.25.0"
- id("org.sonarqube") version "3.1"
- id("org.jetbrains.dokka") version "1.7.10"
+ id("com.diffplug.spotless") version "7.0.4"
+ id("org.jetbrains.dokka") version "1.9.20"
}
-
buildscript {
- val kotlinVersion: String by project
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- }
dependencies {
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
classpath("com.android.tools.build:gradle:7.4.2")
- classpath ("javax.xml.bind:jaxb-api:2.3.1")
- classpath ("com.sun.xml.bind:jaxb-impl:2.3.9")
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
}
-}
\ No newline at end of file
+}
+
diff --git a/Example_Plugin_Android_NFC/gradle.properties b/Example_Plugin_Android_NFC/gradle.properties
index 4b77578..0fc1004 100644
--- a/Example_Plugin_Android_NFC/gradle.properties
+++ b/Example_Plugin_Android_NFC/gradle.properties
@@ -1,19 +1,59 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Plugin Android NFC Java Examples
description = Keyple Plugin Android NFC Java Examples
-version = 2.0.0
-licenseType = EDL_1_0
-archivesBaseName = keyple-plugin-android-nfc-java-lib
+version = 2.0.0-SNAPSHOT
-javaSourceLevel = 8
-javaTargetLevel = 8
-kotlinVersion = 1.7.10
+# Java Configuration
+javaSourceLevel = 1.8
+javaTargetLevel = 1.8
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Android Configuration (custom properties)
+androidAppNamespace = org.eclipse.keyple.plugin.android.nfc.example
+androidAppId = org.eclipse.keyple.plugin.android.nfc.example
+androidAppVersionCode = 1
+androidAppVersionName = 1.0
+androidCompileSdk = 34
+androidMinSdk = 24
+
+# Android Project Configuration (global properties)
+# Kotlin code style for this project ("official" or "obsolete"): use the official Kotlin coding conventions
+kotlin.code.style=official
+# Use AndroidX libraries instead of legacy Android Support libraries (required for modern Android)
android.useAndroidX=true
-# Automatically convert third-party libraries to use AndroidX
+# Automatically convert third-party libraries using old support libraries to AndroidX (may slow builds)
android.enableJetifier=true
+# Disable automatic creation of Android components by plugins (e.g., Hilt) for manual control
+android.disableAutomaticComponentCreation=true
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse Keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
-android.suppressUnsupportedCompileSdk=34
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
-org.gradle.jvmargs=-Xmx4608m
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Plugin_Android_NFC/settings.gradle.kts b/Example_Plugin_Android_NFC/settings.gradle.kts
index 1dcf100..c410178 100644
--- a/Example_Plugin_Android_NFC/settings.gradle.kts
+++ b/Example_Plugin_Android_NFC/settings.gradle.kts
@@ -1,47 +1,21 @@
-pluginManagement {
-
- /**
- * The pluginManagement {repositories {...}} block configures the
- * repositories Gradle uses to search or download the Gradle plugins and
- * their transitive dependencies. Gradle pre-configures support for remote
- * repositories such as JCenter, Maven Central, and Ivy. You can also use
- * local repositories or define your own remote repositories. The code below
- * defines the Gradle Plugin Portal, Google's Maven repository,
- * and the Maven Central Repository as the repositories Gradle should use to look for its
- * dependencies.
- */
+rootProject.name = "Example_Plugin_Android_NFC"
+include(":app")
+pluginManagement {
repositories {
gradlePluginPortal()
- google()
mavenCentral()
- maven {
- url = uri("${System.getProperty("user.home")}/.m2/repository/")
- }
+ google()
}
}
-dependencyResolutionManagement {
-
- /**
- * The dependencyResolutionManagement {repositories {...}}
- * block is where you configure the repositories and dependencies used by
- * all modules in your project, such as libraries that you are using to
- * create your application. However, you should configure module-specific
- * dependencies in each module-level build.gradle file. For new projects,
- * Android Studio includes Google's Maven repository and the Maven Central
- * Repository by default, but it does not configure any dependencies (unless
- * you select a template that requires some).
- */
+dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
- google()
+ mavenLocal()
mavenCentral()
- maven {
- url = uri("${System.getProperty("user.home")}/.m2/repository/")
- }
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
+ google()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
}
}
-include(":app")
-rootProject.name = "Example_Plugin_Android_NFC"
\ No newline at end of file
+
diff --git a/Example_Plugin_Android_OMAPI/LICENSE_HEADER b/Example_Plugin_Android_OMAPI/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Plugin_Android_OMAPI/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Plugin_Android_OMAPI/app/build.gradle.kts b/Example_Plugin_Android_OMAPI/app/build.gradle.kts
index e845789..b2c4ef6 100644
--- a/Example_Plugin_Android_OMAPI/app/build.gradle.kts
+++ b/Example_Plugin_Android_OMAPI/app/build.gradle.kts
@@ -1,173 +1,281 @@
-/**
- * The first section in the build configuration applies the Android Gradle plugin
- * to this build and makes the android block available to specify
- * Android-specific build options.
- */
+///////////////////////////////////////////////////////////////////////////////
+// GRADLE CONFIGURATION
+///////////////////////////////////////////////////////////////////////////////
plugins {
- id("com.android.application")
- id("kotlin-android")
- id("kotlin-parcelize")
- id("com.diffplug.spotless")
+ id("com.android.application")
+ id("kotlin-android")
+ id("kotlin-parcelize")
+ id("com.diffplug.spotless")
+ id("org.jetbrains.dokka")
+ signing
+ `maven-publish`
}
-apply(plugin = "org.eclipse.keyple")
-/**
- * The android block is where you configure all your Android-specific
- * build options.
- */
+///////////////////////////////////////////////////////////////////////////////
+// APP CONFIGURATION
+///////////////////////////////////////////////////////////////////////////////
-android {
-
- /**
- * The app's namespace. Used primarily to access app resources.
- */
-
- namespace = "org.eclipse.keyple"
-
- /**
- * compileSdk specifies the Android API level Gradle should use to
- * compile your app. This means your app can use the API features included in
- * this API level and lower.
- */
-
- compileSdk = 34
-
- /**
- * The defaultConfig block encapsulates default settings and entries for all
- * build variants and can override some attributes in main/AndroidManifest.xml
- * dynamically from the build system. You can configure product flavors to override
- * these values for different versions of your app.
- */
-
- defaultConfig {
- // Uniquely identifies the package for publishing.
- applicationId = "org.eclipse.keyple.demo"
+dependencies {
+ implementation(
+ fileTree(
+ mapOf(
+ "dir" to "libs",
+ "include" to listOf("*.jar"),
+ "exclude" to listOf("org.simalliance.openmobileapi.jar"))))
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
+ implementation("org.eclipse.keyple:keyple-plugin-android-omapi-java-lib:2.1.0")
+ // End Keyple configuration
+ // Android components
+ implementation("androidx.appcompat:appcompat:1.6.1")
+ implementation("com.google.android.material:material:1.10.0")
+ implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.activity:activity-ktx:1.8.1")
+ implementation("androidx.fragment:fragment-ktx:1.6.2")
+ implementation("androidx.multidex:multidex:2.0.1")
+ // Kotlin
+ implementation("androidx.core:core-ktx:1.12.0")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20")
+ // Coroutines
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
+ // Logging
+ implementation("com.jakewharton.timber:timber:5.0.1")
+ implementation("org.slf4j:slf4j-api:1.7.32")
+ implementation("uk.uuid.slf4j:slf4j-android:1.7.32-0")
+}
- // Defines the minimum API level required to run the app.
- minSdk = 24
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR ANDROID APPLICATION KOTLIN-BASED PROJECTS
+///////////////////////////////////////////////////////////////////////////////
- // Specifies the API level used to test the app.
- targetSdk = 31
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
+}
- // Defines the version number of your app.
- versionCode = 1
+val title: String by project
+val javaSourceLevel: String by project
+val javaTargetLevel: String by project
+val generatedOverviewFile = layout.buildDirectory.file("tmp/overview-dokka.md")
- // Defines a user-friendly version name for your app.
- versionName = "1.0"
+android {
+ namespace = project.findProperty("androidAppNamespace") as String
+ compileSdk = (project.findProperty("androidCompileSdk") as String).toInt()
+ defaultConfig {
+ applicationId = project.findProperty("androidAppId") as String
+ minSdk = (project.findProperty("androidMinSdk") as String).toInt()
+ versionCode = (project.findProperty("androidAppVersionCode") as String).toInt()
+ versionName = project.findProperty("androidAppVersionName") as String
+ }
+ buildFeatures { viewBinding = true }
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility")
+ }
+ kotlinOptions { jvmTarget = javaTargetLevel }
+ sourceSets {
+ getByName("main").java.srcDirs("src/main/kotlin")
+ getByName("debug").java.srcDirs("src/debug/kotlin")
+ }
+ packagingOptions {
+ // Exclude 'META-INF/NOTICE.md' to resolve the conflict that occurs when multiple dependencies
+ // include this file
+ resources.excludes.add("META-INF/NOTICE.md")
+ }
+ applicationVariants.all {
+ outputs.all {
+ val outputImpl = this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
+ val variantName = name
+ val versionName = project.version.toString()
+ val newName = "${rootProject.name}-$versionName-$variantName.apk"
+ outputImpl.outputFileName = newName
+ }
+ }
+ publishing {
+ singleVariant("release") {
+ // No withSourcesJar() and withJavadocJar(), as we'll configure them manually during release
+ }
+ }
+ lint { abortOnError = false }
+}
- /**
- * The buildTypes block is where you can configure multiple build types.
- * By default, the build system defines two build types: debug and release. The
- * debug build type is not explicitly shown in the default build configuration,
- * but it includes debugging tools and is signed with the debug key. The release
- * build type applies ProGuard settings and is not signed by default.
- */
-
- buildTypes {
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
+}
- /**
- * By default, Android Studio configures the release build type to enable code
- * shrinking, using minifyEnabled, and specifies the default ProGuard rules file.
- */
+tasks.withType().configureEach { archiveBaseName.set(rootProject.name) }
- getByName("release") {
- isMinifyEnabled = true // Enables code shrinking for the release build type.
- proguardFiles(
- getDefaultProguardFile("proguard-android.txt"),
- "proguard-rules.pro"
- )
- }
+tasks {
+ spotless {
+ kotlin {
+ target("src/**/*.kt")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ ktfmt()
}
-
- /**
- * Packaging Options Configuration
- */
- packagingOptions {
- // Exclude 'META-INF/NOTICE.md' to resolve the conflict that occurs when multiple dependencies include this file
- resources.excludes.add("META-INF/NOTICE.md")
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
}
-
- /**
- * Build Features Configuration
- */
- buildFeatures {
- // Enable View Binding to allow more efficient and type-safe view interaction in the code
- viewBinding = true
+ }
+ register("generateDokkaOverview") {
+ outputs.file(generatedOverviewFile)
+ doLast {
+ val file = generatedOverviewFile.get().asFile
+ file.parentFile.mkdirs()
+ file.writeText(
+ buildString {
+ appendLine("# Module $title")
+ appendLine()
+ appendLine(
+ file("src/main/kdoc/overview.md")
+ .takeIf { it.exists() }
+ ?.readText()
+ .orEmpty()
+ .trim())
+ appendLine()
+ appendLine("
")
+ appendLine()
+ appendLine("> ${project.findProperty("javadoc.copyright") as String}")
+ })
}
-
- sourceSets {
- getByName("main").java.srcDirs("src/main/kotlin")
- getByName("test").java.srcDirs("src/test/kotlin")
+ }
+ dokkaHtml.configure {
+ dependsOn("generateDokkaOverview")
+ dokkaSourceSets {
+ named("main") {
+ noAndroidSdkLink.set(false)
+ includeNonPublic.set(false)
+ includes.from(files(generatedOverviewFile))
+ moduleName.set(title)
+ }
}
-}
-
-/**
- * The dependencies block in the module-level build configuration file
- * specifies dependencies required to build only the module itself.
- * To learn more, go to Add build dependencies.
- */
-
-dependencies {
-
- implementation(
- fileTree(
+ doFirst { println("Generating Dokka HTML for ${project.name} version ${project.version}") }
+ }
+ withType().configureEach {
+ if (archiveClassifier.get() == "sources") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
mapOf(
- "dir" to "libs",
- "include" to listOf("*.jar"),
- "exclude" to listOf("org.simalliance.openmobileapi.jar")
- )
- )
- )
-
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keypop:keypop-calypso-card-java-api:2.1.2")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
- implementation("org.eclipse.keyple:keyple-plugin-android-omapi-java-lib:2.1.0")
-// End Keyple configuration
- /*
- Android components
- */
- implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("com.google.android.material:material:1.10.0")
- implementation("androidx.constraintlayout:constraintlayout:2.1.4")
- implementation("androidx.activity:activity-ktx:1.8.1")
- implementation("androidx.fragment:fragment-ktx:1.6.2")
-
- /*
- Log
- */
- implementation("org.slf4j:slf4j-api:1.7.32")
- implementation("com.jakewharton.timber:timber:5.0.1")
-
- /*
- Kotlin
- */
- implementation("androidx.core:core-ktx:1.12.0")
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10")
- implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
-
- /*
- Coroutines
- */
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
-
- implementation("androidx.multidex:multidex:2.0.1")
+ "Implementation-Title" to "$title Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ }
+ register("sourcesJar") {
+ archiveClassifier.set("sources")
+ from(android.sourceSets.getByName("main").java.srcDirs)
+ from(layout.buildDirectory.dir("resources/main"))
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+ register("javadocJar") {
+ dependsOn(dokkaHtml)
+ archiveClassifier.set("javadoc")
+ from(dokkaHtml.flatMap { it.outputDirectory })
+ from(layout.buildDirectory.dir("resources/main"))
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+ register("copyLicenseFiles") { doLast { copyLicenseFiles() } }
}
-
-tasks {
- spotless {
- kotlin {
- target("**/*.kt")
- ktfmt()
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+afterEvaluate {
+ tasks.named("assembleRelease") { dependsOn("copyLicenseFiles") }
+ publishing {
+ publications {
+ create("mavenJava") {
+ from(components["release"])
+ artifactId = rootProject.name
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["javadocJar"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
+ }
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
}
+ }
}
-}
\ No newline at end of file
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
+}
diff --git a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/AbstractExampleActivity.kt b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/AbstractExampleActivity.kt
index 1534d52..ce1c391 100644
--- a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/AbstractExampleActivity.kt
+++ b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/AbstractExampleActivity.kt
@@ -23,9 +23,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.navigation.NavigationView
import java.io.IOException
-import org.eclipse.keyple.R
-import org.eclipse.keyple.databinding.ActivityCoreExamplesBinding
+import org.eclipse.keyple.plugin.android.omapi.example.R
import org.eclipse.keyple.plugin.android.omapi.example.adapter.EventAdapter
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.ActivityCoreExamplesBinding
import org.eclipse.keyple.plugin.android.omapi.example.model.ChoiceEventModel
import org.eclipse.keyple.plugin.android.omapi.example.model.EventModel
import org.eclipse.keypop.reader.CardReaderEvent
diff --git a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/CoreExamplesActivity.kt b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/CoreExamplesActivity.kt
index 4c9b1ae..3f7825c 100644
--- a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/CoreExamplesActivity.kt
+++ b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/activity/CoreExamplesActivity.kt
@@ -16,14 +16,14 @@ import android.os.Bundle
import android.view.MenuItem
import android.widget.Toast
import androidx.core.view.GravityCompat
-import org.eclipse.keyple.R
import org.eclipse.keyple.card.generic.GenericExtensionService
import org.eclipse.keyple.core.service.SmartCardServiceProvider
import org.eclipse.keyple.core.util.HexUtil
-import org.eclipse.keyple.databinding.ActivityCoreExamplesBinding
import org.eclipse.keyple.plugin.android.omapi.AndroidOmapiPlugin
import org.eclipse.keyple.plugin.android.omapi.AndroidOmapiPluginFactoryProvider
import org.eclipse.keyple.plugin.android.omapi.AndroidOmapiReader
+import org.eclipse.keyple.plugin.android.omapi.example.R
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.ActivityCoreExamplesBinding
import org.eclipse.keyple.plugin.android.omapi.example.util.CalypsoClassicInfo
import org.eclipse.keypop.reader.CardCommunicationException
import org.eclipse.keypop.reader.CardReader
diff --git a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/adapter/EventAdapter.kt b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/adapter/EventAdapter.kt
index 0579d36..8d2d06e 100644
--- a/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/adapter/EventAdapter.kt
+++ b/Example_Plugin_Android_OMAPI/app/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/example/adapter/EventAdapter.kt
@@ -17,11 +17,11 @@ import android.view.View
import android.view.ViewGroup
import android.widget.RadioButton
import androidx.recyclerview.widget.RecyclerView
-import org.eclipse.keyple.R
-import org.eclipse.keyple.databinding.CardActionEventBinding
-import org.eclipse.keyple.databinding.CardChoiceEventBinding
-import org.eclipse.keyple.databinding.CardHeaderEventBinding
-import org.eclipse.keyple.databinding.CardResultEventBinding
+import org.eclipse.keyple.plugin.android.omapi.example.R
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.CardActionEventBinding
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.CardChoiceEventBinding
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.CardHeaderEventBinding
+import org.eclipse.keyple.plugin.android.omapi.example.databinding.CardResultEventBinding
import org.eclipse.keyple.plugin.android.omapi.example.model.ChoiceEventModel
import org.eclipse.keyple.plugin.android.omapi.example.model.EventModel
import org.eclipse.keyple.plugin.android.omapi.example.util.getColorResource
diff --git a/Example_Plugin_Android_OMAPI/app/src/main/resources/uk/uuid/slf4j/android/config.properties b/Example_Plugin_Android_OMAPI/app/src/main/resources/uk/uuid/slf4j/android/config.properties
new file mode 100644
index 0000000..329ab69
--- /dev/null
+++ b/Example_Plugin_Android_OMAPI/app/src/main/resources/uk/uuid/slf4j/android/config.properties
@@ -0,0 +1 @@
+level.org.eclipse.keyple=DEBUG
\ No newline at end of file
diff --git a/Example_Plugin_Android_OMAPI/build.gradle.kts b/Example_Plugin_Android_OMAPI/build.gradle.kts
index 7b66841..184c65b 100644
--- a/Example_Plugin_Android_OMAPI/build.gradle.kts
+++ b/Example_Plugin_Android_OMAPI/build.gradle.kts
@@ -1,24 +1,15 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- id("com.diffplug.spotless") version "6.25.0"
- id("org.sonarqube") version "3.1"
- id("org.jetbrains.dokka") version "1.7.10"
+ id("com.diffplug.spotless") version "7.0.4"
+ id("org.jetbrains.dokka") version "1.9.20"
}
-
buildscript {
- val kotlinVersion: String by project
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- }
dependencies {
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
classpath("com.android.tools.build:gradle:7.4.2")
- classpath ("javax.xml.bind:jaxb-api:2.3.1")
- classpath ("com.sun.xml.bind:jaxb-impl:2.3.9")
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
}
-}
\ No newline at end of file
+}
+
diff --git a/Example_Plugin_Android_OMAPI/gradle.properties b/Example_Plugin_Android_OMAPI/gradle.properties
index 1ca20c5..b6f3fea 100644
--- a/Example_Plugin_Android_OMAPI/gradle.properties
+++ b/Example_Plugin_Android_OMAPI/gradle.properties
@@ -1,19 +1,59 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Plugin Android OMAPI Java Examples
description = Keyple Plugin Android OMAPI Java Examples
-version = 2.0.0
-licenseType = EDL_1_0
-archivesBaseName = keyple-plugin-android-omapi-java-lib
+version = 2.0.0-SNAPSHOT
-javaSourceLevel = 8
-javaTargetLevel = 8
-kotlinVersion = 1.7.10
+# Java Configuration
+javaSourceLevel = 1.8
+javaTargetLevel = 1.8
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Android Configuration (custom properties)
+androidAppNamespace = org.eclipse.keyple.plugin.android.omapi.example
+androidAppId = org.eclipse.keyple.plugin.android.omapi.example
+androidAppVersionCode = 1
+androidAppVersionName = 1.0
+androidCompileSdk = 34
+androidMinSdk = 24
+
+# Android Project Configuration (global properties)
+# Kotlin code style for this project ("official" or "obsolete"): use the official Kotlin coding conventions
+kotlin.code.style=official
+# Use AndroidX libraries instead of legacy Android Support libraries (required for modern Android)
android.useAndroidX=true
-# Automatically convert third-party libraries to use AndroidX
+# Automatically convert third-party libraries using old support libraries to AndroidX (may slow builds)
android.enableJetifier=true
+# Disable automatic creation of Android components by plugins (e.g., Hilt) for manual control
+android.disableAutomaticComponentCreation=true
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse Keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
-android.suppressUnsupportedCompileSdk=34
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
-org.gradle.jvmargs=-Xmx4608m
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Plugin_Android_OMAPI/settings.gradle.kts b/Example_Plugin_Android_OMAPI/settings.gradle.kts
index a37fe1b..b86803f 100644
--- a/Example_Plugin_Android_OMAPI/settings.gradle.kts
+++ b/Example_Plugin_Android_OMAPI/settings.gradle.kts
@@ -1,47 +1,21 @@
-pluginManagement {
-
- /**
- * The pluginManagement {repositories {...}} block configures the
- * repositories Gradle uses to search or download the Gradle plugins and
- * their transitive dependencies. Gradle pre-configures support for remote
- * repositories such as JCenter, Maven Central, and Ivy. You can also use
- * local repositories or define your own remote repositories. The code below
- * defines the Gradle Plugin Portal, Google's Maven repository,
- * and the Maven Central Repository as the repositories Gradle should use to look for its
- * dependencies.
- */
+rootProject.name = "Example_Plugin_Android_OMAPI"
+include(":app")
+pluginManagement {
repositories {
gradlePluginPortal()
- google()
mavenCentral()
- maven {
- url = uri("${System.getProperty("user.home")}/.m2/repository/")
- }
+ google()
}
}
-dependencyResolutionManagement {
-
- /**
- * The dependencyResolutionManagement {repositories {...}}
- * block is where you configure the repositories and dependencies used by
- * all modules in your project, such as libraries that you are using to
- * create your application. However, you should configure module-specific
- * dependencies in each module-level build.gradle file. For new projects,
- * Android Studio includes Google's Maven repository and the Maven Central
- * Repository by default, but it does not configure any dependencies (unless
- * you select a template that requires some).
- */
+dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
- google()
+ mavenLocal()
mavenCentral()
- maven {
- url = uri("${System.getProperty("user.home")}/.m2/repository/")
- }
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
+ google()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
}
}
-include(":app")
-rootProject.name = "Example_Plugin_Android_OMAPI"
+
diff --git a/Example_Plugin_PCSC/LICENSE_HEADER b/Example_Plugin_PCSC/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Plugin_PCSC/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Plugin_PCSC/build.gradle.kts b/Example_Plugin_PCSC/build.gradle.kts
index bcf4915..18bd6ba 100644
--- a/Example_Plugin_PCSC/build.gradle.kts
+++ b/Example_Plugin_PCSC/build.gradle.kts
@@ -1,61 +1,200 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
-}
+
dependencies {
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
- implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
-// End Keyple configuration
- implementation("org.slf4j:slf4j-simple:1.7.32")
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
+ implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ // End Keyple configuration
+ implementation("org.slf4j:slf4j-simple:1.7.32")
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
+}
+
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
}
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
}
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Plugin_PCSC/gradle.properties b/Example_Plugin_PCSC/gradle.properties
index 5377e76..bc5bde4 100644
--- a/Example_Plugin_PCSC/gradle.properties
+++ b/Example_Plugin_PCSC/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Plugin PC/SC Java Examples
description = Examples that demonstrate the features of the Keyple Java PC/SC plugin.
-version = 2.1.0
-licenseType = EDL_1_0
+version = 2.1.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Plugin_PCSC/settings.gradle.kts b/Example_Plugin_PCSC/settings.gradle.kts
index bcf3677..7953953 100644
--- a/Example_Plugin_PCSC/settings.gradle.kts
+++ b/Example_Plugin_PCSC/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Plugin_PCSC"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Service/LICENSE_HEADER b/Example_Service/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Service/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Service/build.gradle.kts b/Example_Service/build.gradle.kts
index 4e649f5..907e11a 100644
--- a/Example_Service/build.gradle.kts
+++ b/Example_Service/build.gradle.kts
@@ -1,60 +1,199 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
-}
+
dependencies {
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
- implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.4.2")
-// End Keyple configuration
- implementation("org.slf4j:slf4j-simple:1.7.32")
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
+ implementation("org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.5.2")
+ // End Keyple configuration
+ implementation("org.slf4j:slf4j-simple:1.7.32")
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
+}
+
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
}
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
}
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Service/gradle.properties b/Example_Service/gradle.properties
index 3f97082..4f839bb 100644
--- a/Example_Service/gradle.properties
+++ b/Example_Service/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Service Java Examples
description = Examples demonstrating the Keyple Service functionalities using the Keyple solution API.
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Service/settings.gradle.kts b/Example_Service/settings.gradle.kts
index f26605b..92c1758 100644
--- a/Example_Service/settings.gradle.kts
+++ b/Example_Service/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Service"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Example_Service_Resource/LICENSE_HEADER b/Example_Service_Resource/LICENSE_HEADER
new file mode 100644
index 0000000..e0c7065
--- /dev/null
+++ b/Example_Service_Resource/LICENSE_HEADER
@@ -0,0 +1,12 @@
+/* **************************************************************************************
+ * Copyright (c) $YEAR Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Distribution License 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/Example_Service_Resource/build.gradle.kts b/Example_Service_Resource/build.gradle.kts
index f11a2e9..1472573 100644
--- a/Example_Service_Resource/build.gradle.kts
+++ b/Example_Service_Resource/build.gradle.kts
@@ -1,61 +1,200 @@
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- java
- id("com.diffplug.spotless") version "6.25.0"
-}
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- }
- dependencies {
- classpath("org.eclipse.keyple:keyple-gradle:0.2.+") { isChanging = true }
- }
+ java
+ `maven-publish`
+ signing
+ id("com.diffplug.spotless") version "7.0.4"
}
-apply(plugin = "org.eclipse.keyple")
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
-}
+
dependencies {
-// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
- implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
- implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
- implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
- implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
- implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
- implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
- implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
-// End Keyple configuration
- implementation("org.slf4j:slf4j-simple:1.7.32")
+ // Begin Keyple configuration (generated by
+ // 'https://keyple.org/components/overview/configuration-wizard/')
+ implementation("org.eclipse.keypop:keypop-reader-java-api:2.0.1")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.eclipse.keyple:keyple-service-java-lib:3.3.5")
+ implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.0")
+ implementation("org.eclipse.keyple:keyple-card-generic-java-lib:3.1.2")
+ implementation("org.eclipse.keyple:keyple-plugin-stub-java-lib:2.2.1")
+ // End Keyple configuration
+ implementation("org.slf4j:slf4j-simple:1.7.32")
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR JAVA PROJECTS
+///////////////////////////////////////////////////////////////////////////////
+
+if (project.hasProperty("releaseTag")) {
+ project.version = project.property("releaseTag") as String
+ println("Release mode: version set to ${project.version}")
+} else {
+ println("Development mode: version is ${project.version}")
}
val javaSourceLevel: String by project
val javaTargetLevel: String by project
+
java {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
+ targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
+ println("Compiling Java $sourceCompatibility to Java $targetCompatibility.")
+ withJavadocJar()
+ withSourcesJar()
+}
+
+fun copyLicenseFiles() {
+ val metaInfDir = File(layout.buildDirectory.get().asFile, "resources/main/META-INF")
+ val licenseFile = File(project.rootDir, "LICENSE")
+ val noticeFile = File(project.rootDir, "NOTICE.md")
+ metaInfDir.mkdirs()
+ licenseFile.copyTo(File(metaInfDir, "LICENSE"), overwrite = true)
+ noticeFile.copyTo(File(metaInfDir, "NOTICE.md"), overwrite = true)
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
tasks {
- spotless {
- java {
- target("src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
+ spotless {
+ java {
+ target("src/**/*.java")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ importOrder("java", "javax", "org", "com", "")
+ removeUnusedImports()
+ googleJavaFormat()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ test {
+ useJUnitPlatform()
+ testLogging { events("passed", "skipped", "failed") }
+ }
+ javadoc {
+ dependsOn(processResources)
+ val javadocLogo = project.findProperty("javadoc.logo") as String
+ val javadocCopyright = project.findProperty("javadoc.copyright") as String
+ val titleProperty = project.findProperty("title") as String
+ (options as StandardJavadocDocletOptions).apply {
+ overview = "src/main/javadoc/overview.html"
+ windowTitle = "$titleProperty - ${project.version}"
+ header(
+ "$javadocLogo $titleProperty - ${project.version}
")
+ docTitle("$titleProperty - ${project.version}")
+ use(true)
+ bottom(javadocCopyright)
+ encoding = "UTF-8"
+ charSet = "UTF-8"
+ if (JavaVersion.current().isJava11Compatible) {
+ addBooleanOption("html5", true)
+ addStringOption("Xdoclint:none", "-quiet")
+ }
+ }
+ doFirst { println("Generating Javadoc for ${project.name} version ${project.version}") }
+ }
+ jar {
+ dependsOn(processResources)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to (project.findProperty("title") as String),
+ "Implementation-Version" to project.version,
+ "Implementation-Vendor" to (project.findProperty("organization.name") as String),
+ "Implementation-URL" to (project.findProperty("project.url") as String),
+ "Specification-Title" to (project.findProperty("title") as String),
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to (project.findProperty("organization.name") as String),
+ "Created-By" to
+ "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})",
+ "Build-Jdk" to System.getProperty("java.version")))
+ }
+ }
+ named("sourcesJar") {
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Sources",
+ "Implementation-Version" to project.version))
+ }
+ }
+ named("javadocJar") {
+ dependsOn(javadoc)
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "${project.findProperty("title") as String} Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+}
+
+publishing {
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ pom {
+ name.set(project.findProperty("title") as String)
+ description.set(project.findProperty("description") as String)
+ url.set(project.findProperty("project.url") as String)
+ licenses {
+ license {
+ name.set(project.findProperty("license.name") as String)
+ url.set(project.findProperty("license.url") as String)
+ distribution.set(project.findProperty("license.distribution") as String)
+ }
}
+ developers {
+ developer {
+ name.set(project.findProperty("developer.name") as String)
+ email.set(project.findProperty("developer.email") as String)
+ }
+ }
+ organization {
+ name.set(project.findProperty("organization.name") as String)
+ url.set(project.findProperty("organization.url") as String)
+ }
+ scm {
+ connection.set(project.findProperty("scm.connection") as String)
+ developerConnection.set(project.findProperty("scm.developerConnection") as String)
+ url.set(project.findProperty("scm.url") as String)
+ }
+ ciManagement {
+ system.set(project.findProperty("ci.system") as String)
+ url.set(project.findProperty("ci.url") as String)
+ }
+ properties.set(
+ mapOf(
+ "project.build.sourceEncoding" to "UTF-8",
+ "maven.compiler.source" to javaSourceLevel,
+ "maven.compiler.target" to javaTargetLevel))
+ }
}
+ }
+ repositories {
+ maven {
+ if (project.hasProperty("sonatypeURL")) {
+ url = uri(project.property("sonatypeURL") as String)
+ credentials {
+ username = project.property("sonatypeUsername") as String
+ password = project.property("sonatypePassword") as String
+ }
+ }
+ }
+ }
+}
+
+signing {
+ if (project.hasProperty("releaseTag")) {
+ useGpgCmd()
+ sign(publishing.publications["mavenJava"])
+ }
}
diff --git a/Example_Service_Resource/gradle.properties b/Example_Service_Resource/gradle.properties
index 62ecd1c..686dfdd 100644
--- a/Example_Service_Resource/gradle.properties
+++ b/Example_Service_Resource/gradle.properties
@@ -1,8 +1,41 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Service Resource Java Examples
description = Generic examples using the API of the Keyple Java Resource Service.
-version = 2.0.0
-licenseType = EDL_1_0
+version = 2.0.0-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
+
+# UTF-8 required by javadoc for special characters (ex. copyright) with Java 11+
+org.gradle.jvmargs = "-Dfile.encoding=UTF-8"
+
+# Documentation Configuration
+javadoc.logo =
+javadoc.copyright = Copyright © Eclipse Foundation, Inc. All Rights Reserved.
+
+# Project URLs
+project.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Organization
+organization.name = Eclipse keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Distribution License - v 1.0
+license.url = https://www.eclipse.org/org/documents/edl-v10.php
+license.distribution = repo
+
+# Developers
+developer.name = Keyple Contributors
+developer.email = keyple-dev@eclipse.org
+
+# Source Control Management
+scm.connection = scm:git:git://github.com/eclipse-keyple/keyple-java-example.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-java-example.git
+scm.url = https://github.com/eclipse-keyple/keyple-java-example
+
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-java-example/actions
diff --git a/Example_Service_Resource/settings.gradle.kts b/Example_Service_Resource/settings.gradle.kts
index 583a309..ce4b405 100644
--- a/Example_Service_Resource/settings.gradle.kts
+++ b/Example_Service_Resource/settings.gradle.kts
@@ -1,5 +1,17 @@
rootProject.name = "Example_Service_Resource"
-// Fix resolution of dependencies with dynamic version in order to use SNAPSHOT first when available.
-// See explanation here : https://docs.gradle.org/6.8.3/userguide/single_versions.html
-enableFeaturePreview("VERSION_ORDERING_V2")
\ No newline at end of file
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 6a2dcfd..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,56 +0,0 @@
-#!groovy
-pipeline {
- environment {
- PROJECT_NAME = "keyple-java-example"
- PROJECT_BOT_NAME = "Eclipse Keyple Bot"
- }
- agent { kubernetes { yaml javaBuilder('2.0') } }
- stages {
- stage('Build Example Service') {
- steps { container('java-builder') {
- sh 'cd ./Example_Service && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Card Calypso') {
- steps { container('java-builder') {
- sh 'cd ./Example_Card_Calypso && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Service Resource') {
- steps { container('java-builder') {
- sh 'cd ./Example_Service_Resource && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Plugin PC/SC') {
- steps { container('java-builder') {
- sh 'cd ./Example_Plugin_PCSC && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Plugin Android NFC') {
- steps { container('java-builder') {
- sh 'cd ./Example_Plugin_Android_NFC && ./gradlew clean build --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
-// The example using the OMAPI plugin has been temporarily disabled.
-// stage('Build Example Plugin Android OMAPI') {
-// steps { container('java-builder') {
-// sh 'cd ./Example_Plugin_Android_OMAPI && ./gradlew clean build --no-build-cache --no-daemon --info --stacktrace'
-// } }
-// }
- stage('Build Example Distributed PoolReaderServerSide Webservice') {
- steps { container('java-builder') {
- sh 'cd ./Example_Distributed_PoolReaderServerSide_Webservice && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Distributed ReaderClientSide Webservice') {
- steps { container('java-builder') {
- sh 'cd ./Example_Distributed_ReaderClientSide_Webservice && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- stage('Build Example Distributed ReaderClientSide Websocket') {
- steps { container('java-builder') {
- sh 'cd ./Example_Distributed_ReaderClientSide_Websocket && ./gradlew clean spotlessCheck classes --no-build-cache --no-daemon --info --stacktrace'
- } }
- }
- }
-}
diff --git a/README.md b/README.md
index 727491f..aaaebc8 100644
--- a/README.md
+++ b/README.md
@@ -10,4 +10,9 @@ The full documentation, including the **user guide**, **download information** a
## About the source code
-The code is built with **Gradle** and is compliant with **Java 1.8** in order to address a wide range of applications.
\ No newline at end of file
+The code is built with **Gradle** and is compliant with **Java 1.8** in order to address a wide range of applications.
+
+## Continuous Integration
+
+This project uses **GitHub Actions** for continuous integration. Every push and pull request triggers automated builds
+and checks to ensure code quality and maintain compatibility with the defined specifications.
\ No newline at end of file