Skip to content

feat: add support of storage card #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Added dependency to `keyple-plugin-storage-card-java-api:1.0.0` for support of storage cards
### Build
- Removed dependency to `keyple-gradle` plugin
### Upgraded
- Dokka to `2.0.0`

## [3.0.0] - 2025-02-20
:warning: Major version!
Expand Down
118 changes: 99 additions & 19 deletions bluebird-plugin-mock/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import java.time.Year
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-parcelize")
id("org.jetbrains.dokka")
id("com.diffplug.spotless")
id("maven-publish")
}

val archivesBaseName: String by project
val title: String by project
val copyright: String by project
val currentYear = Year.now().value.toString()

android {
namespace = "org.calypsonet.keyple.plugin.bluebird.mock"
Expand Down Expand Up @@ -45,16 +49,6 @@ android {
abortOnError = false
}

// generate output aar with a qualified name : with version number
libraryVariants.all {
outputs.forEach { output ->
if (output is com.android.build.gradle.internal.api.BaseVariantOutputImpl) {
output.outputFileName =
"$archivesBaseName-${project.version}-mock.${output.outputFile.extension}".replace("-SNAPSHOT", "")
}
}
}

sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("debug").java.srcDirs("src/debug/kotlin")
Expand All @@ -71,25 +65,111 @@ dependencies {
// Bluebird libs
compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

// Keyple
// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
implementation("org.eclipse.keyple:keyple-common-java-api:2.0.1")
implementation("org.eclipse.keyple:keyple-plugin-java-api:2.3.1")
implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
// End Keyple configuration

// Storage card support
api("org.eclipse.keyple:keyple-plugin-storage-card-java-api:1.0.0-SNAPSHOT") { isChanging = true}

// Logging
implementation("com.jakewharton.timber:timber:5.0.1")
}

tasks {
dokkaHtml.configure {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
includeNonPublic.set(false)
includes.from(files("src/main/kdoc/overview.md"))
dokka {
moduleName.set(rootProject.name)
dokkaSourceSets.main {
includes.from("src/main/kdoc/overview.md")
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/calypsonet/${rootProject.name}")
remoteLineSuffix.set("#L")
}
}
pluginsConfiguration.html {
footerMessage.set(copyright.replace("YEAR", currentYear))
}
}
}

apply(plugin = "org.eclipse.keyple")
val dokkaJar = tasks.register<Jar>("dokkaJar") {
dependsOn(tasks.dokkaGenerate)
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-docs")
}

publishing {
publications {
// This says: defer this block until all of the other stuff has run first.
// This is required since components["release"] is generated by the Android
// plugin in `afterEvaluate` itself, which forces us to do the same.
afterEvaluate {
// Create a new publication called "release". The maven-publish plugin
// creates tasks named publish${name}PublicationTo${target}, where
// ${name} is a capitalized form of the name and ${target} is an output
// repository. By default a MavenLocal target is automatically added,
// which outputs to ~/.m2/repository.
create<MavenPublication>("mavenJava") {
// Include all artifacts from the "release" component. This is the
// .aar file along with the sources and javadoc .jars.
from(components["release"])
// add Dokka to the publication
artifact(tasks.named("dokkaJar"))
// Here we configure some properties of the publication (these are
// automatically applied to the pom file). Your library will be
// referenced as ${groupId}:${artifactId}.
groupId = project.group.toString()
artifactId = rootProject.name
version = project.version.toString()
pom {
name.set(title)
description.set(project.description)
url.set("https://github.com/eclipse/${rootProject.name}")
organization {
name.set("Calypso Networks Association")
url.set("https://calypsonet.org/")
}
licenses {
license {
name.set("Eclipse Public License - v 2.0")
url.set("http://www.eclipse.org/legal/epl-2.0")
}
}
developers {
developer {
name.set("Calypso Networks Association Technical Team")
email.set("support-dev@calypsonet.org")
}
}
scm {
connection.set("scm:git:git://github.com/eclipse/${rootProject.name}.git")
developerConnection.set("scm:git:ssh://github.com/eclipse/${rootProject.name}.git")
url.set("https://github.com/eclipse/${rootProject.name}")
}
}
}
}
}
}

tasks {
dokka {
moduleName.set(rootProject.name)
dokkaSourceSets.main {
includes.from("src/main/kdoc/overview.md")
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/calypsonet/${rootProject.name}")
remoteLineSuffix.set("#L")
}
}
pluginsConfiguration.html {
footerMessage.set(copyright.replace("YEAR", currentYear))
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,21 @@ enum class BluebirdContactlessProtocols(private val techValue: Int) {
*
* @since 3.0.0
*/
INNOVATRON_B_PRIME(0x04);
INNOVATRON_B_PRIME(0x04),

/**
* STM ST25/SRT512.
*
* @since 3.1.0
*/
ST25_SRT512(0x08),

/**
* NXP Mifare Ultralight.
*
* @since 3.1.0
*/
MIFARE_ULTRALIGHT(0x20);

internal fun getValue(): Int = techValue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package org.calypsonet.keyple.plugin.bluebird

import android.app.Activity
import org.eclipse.keyple.core.plugin.storagecard.ApduInterpreterFactory

/**
* Provider of [BluebirdPluginFactory] instances.
Expand All @@ -24,9 +25,12 @@ object BluebirdPluginFactoryProvider {
* Provides an instance of [BluebirdPluginFactory].
*
* @param activity The activity.
* @since 3.0.0
* @param apduInterpreterFactory (Optional) The `ApduInterpreterFactory` dedicated to the
* management of storage cards. The interface of this factory is provided by the
* `keyple-plugin-storage-card-java-api` API, its implementation should be provided.
* @since 3.0.0 (single-param usage), 3.1.0 (with APDU interpreter)
*/
fun provideFactory(activity: Activity): BluebirdPluginFactory {
fun provideFactory(activity: Activity, apduInterpreterFactory: ApduInterpreterFactory? = null): BluebirdPluginFactory {
throw UnsupportedOperationException("Mocked plugin!")
}
}
118 changes: 99 additions & 19 deletions bluebird-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import java.time.Year
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-parcelize")
id("org.jetbrains.dokka")
id("com.diffplug.spotless")
id("maven-publish")
}

val archivesBaseName: String by project
val title: String by project
val copyright: String by project
val currentYear = Year.now().value.toString()

android {
namespace = "org.calypsonet.keyple.plugin.bluebird"
Expand Down Expand Up @@ -45,16 +49,6 @@ android {
abortOnError = false
}

// generate output aar with a qualified name : with version number
libraryVariants.all {
outputs.forEach { output ->
if (output is com.android.build.gradle.internal.api.BaseVariantOutputImpl) {
output.outputFileName =
"$archivesBaseName-${project.version}.${output.outputFile.extension}".replace("-SNAPSHOT", "")
}
}
}

sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("debug").java.srcDirs("src/debug/kotlin")
Expand All @@ -71,25 +65,111 @@ dependencies {
// Bluebird libs
compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

// Keyple
// Begin Keyple configuration (generated by 'https://keyple.org/components/overview/configuration-wizard/')
implementation("org.eclipse.keyple:keyple-common-java-api:2.0.1")
implementation("org.eclipse.keyple:keyple-plugin-java-api:2.3.1")
implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
// End Keyple configuration

// Storage card support
api("org.eclipse.keyple:keyple-plugin-storage-card-java-api:1.0.0-SNAPSHOT") { isChanging = true}

// Logging
implementation("com.jakewharton.timber:timber:5.0.1")
}

tasks {
dokkaHtml.configure {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
includeNonPublic.set(false)
includes.from(files("src/main/kdoc/overview.md"))
dokka {
moduleName.set(rootProject.name)
dokkaSourceSets.main {
includes.from("src/main/kdoc/overview.md")
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/calypsonet/${rootProject.name}")
remoteLineSuffix.set("#L")
}
}
pluginsConfiguration.html {
footerMessage.set(copyright.replace("YEAR", currentYear))
}
}
}

apply(plugin = "org.eclipse.keyple")
val dokkaJar = tasks.register<Jar>("dokkaJar") {
dependsOn(tasks.dokkaGenerate)
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-docs")
}

publishing {
publications {
// This says: defer this block until all of the other stuff has run first.
// This is required since components["release"] is generated by the Android
// plugin in `afterEvaluate` itself, which forces us to do the same.
afterEvaluate {
// Create a new publication called "release". The maven-publish plugin
// creates tasks named publish${name}PublicationTo${target}, where
// ${name} is a capitalized form of the name and ${target} is an output
// repository. By default a MavenLocal target is automatically added,
// which outputs to ~/.m2/repository.
create<MavenPublication>("mavenJava") {
// Include all artifacts from the "release" component. This is the
// .aar file along with the sources and javadoc .jars.
from(components["release"])
// add Dokka to the publication
artifact(tasks.named("dokkaJar"))
// Here we configure some properties of the publication (these are
// automatically applied to the pom file). Your library will be
// referenced as ${groupId}:${artifactId}.
groupId = project.group.toString()
artifactId = rootProject.name
version = project.version.toString()
pom {
name.set(title)
description.set(project.description)
url.set("https://github.com/eclipse/${rootProject.name}")
organization {
name.set("Calypso Networks Association")
url.set("https://calypsonet.org/")
}
licenses {
license {
name.set("Eclipse Public License - v 2.0")
url.set("http://www.eclipse.org/legal/epl-2.0")
}
}
developers {
developer {
name.set("Calypso Networks Association Technical Team")
email.set("support-dev@calypsonet.org")
}
}
scm {
connection.set("scm:git:git://github.com/eclipse/${rootProject.name}.git")
developerConnection.set("scm:git:ssh://github.com/eclipse/${rootProject.name}.git")
url.set("https://github.com/eclipse/${rootProject.name}")
}
}
}
}
}
}

tasks {
dokka {
moduleName.set(rootProject.name)
dokkaSourceSets.main {
includes.from("src/main/kdoc/overview.md")
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/calypsonet/${rootProject.name}")
remoteLineSuffix.set("#L")
}
}
pluginsConfiguration.html {
footerMessage.set(copyright.replace("YEAR", currentYear))
}
}
}


Loading