diff --git a/.gitattributes b/.gitattributes
index 6225757..d03a971 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -18,6 +18,8 @@
*.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) #
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000..994b42b
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,9 @@
+name: Build and Test
+
+on:
+ pull_request:
+ branches: [main]
+
+jobs:
+ build-and-test:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-build-and-test.yml@build-and-test-v1
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 0000000..37809e4
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,10 @@
+name: Publish Release package
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ publish-release:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-publish-release.yml@publish-release-v1
+ secrets: inherit
diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml
new file mode 100644
index 0000000..cb1a7ce
--- /dev/null
+++ b/.github/workflows/publish-snapshot.yml
@@ -0,0 +1,10 @@
+name: Publish Snapshot package
+
+on:
+ push:
+ branches: [main]
+
+jobs:
+ publish-snapshot:
+ uses: eclipse-keyple/keyple-actions/.github/workflows/reusable-publish-snapshot.yml@publish-snapshot-v1
+ secrets: inherit
diff --git a/.github/workflows/publish-to-keyple-doc.yml b/.github/workflows/publish-to-keyple-doc.yml
deleted file mode 100644
index 2ffed0b..0000000
--- a/.github/workflows/publish-to-keyple-doc.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-name: Check Doc Updates and Trigger Documentation Update
-
-on:
- schedule:
- - cron: '0 * * * *' # Every hour
- workflow_dispatch:
-
-permissions:
- checks: write
-
-jobs:
- check-secret:
- runs-on: ubuntu-latest
- outputs:
- has-token: ${{ steps.check.outputs.has-token }}
- steps:
- - id: check
- run: |
- if [ "${{ secrets.ORG_GITHUB_BOT_TOKEN }}" != "" ]; then
- echo "has-token=true" >> "$GITHUB_OUTPUT"
- else
- echo "has-token=false" >> "$GITHUB_OUTPUT"
- fi
-
- check-and-notify:
- needs: check-secret
- if: needs.check-secret.outputs.has-token == 'true'
- runs-on: ubuntu-latest
- steps:
- - name: Check commits dates
- id: check-updates
- run: |
- # Get last commit date from current repo's doc branch
- DOC_RESPONSE=$(curl -s \
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
- -H "Accept: application/vnd.github.v3+json" \
- "https://api.github.com/repos/${{ github.repository }}/commits/doc")
-
- DOC_COMMIT_DATE=$(echo $DOC_RESPONSE | jq -r '.commit.author.date')
- DOC_COMMIT_TIME=$(date -d "$DOC_COMMIT_DATE" +%s)
-
- # Get last commit date from keypop-api-docs gh-pages branch
- DOCS_RESPONSE=$(curl -s \
- -H "Authorization: token ${{ secrets.ORG_GITHUB_BOT_TOKEN }}" \
- -H "Accept: application/vnd.github.v3+json" \
- "https://api.github.com/repos/eclipse-keyple/keyple-api-docs/commits/gh-pages")
-
- DOCS_COMMIT_DATE=$(echo $DOCS_RESPONSE | jq -r '.commit.author.date')
- DOCS_COMMIT_TIME=$(date -d "$DOCS_COMMIT_DATE" +%s)
-
- # Compare dates
- if [ $DOC_COMMIT_TIME -gt $DOCS_COMMIT_TIME ]; then
- echo "Doc branch has newer changes"
- echo "Doc commit time: $(date -d @$DOC_COMMIT_TIME)"
- echo "Docs commit time: $(date -d @$DOCS_COMMIT_TIME)"
- echo "should-update=true" >> "$GITHUB_OUTPUT"
- else
- echo "No new changes to publish"
- echo "Doc commit time: $(date -d @$DOC_COMMIT_TIME)"
- echo "Docs commit time: $(date -d @$DOCS_COMMIT_TIME)"
- echo "should-update=false" >> "$GITHUB_OUTPUT"
- fi
-
- - name: Repository Dispatch Event
- if: steps.check-updates.outputs.should-update == 'true'
- uses: peter-evans/repository-dispatch@v3
- with:
- token: ${{ secrets.ORG_GITHUB_BOT_TOKEN }}
- repository: eclipse-keyple/keyple-api-docs
- event-type: update-submodules
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 6a45280..a791738 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,6 @@ local.properties
# Gradle
.gradle/
build*/
-LICENSE_HEADER
# Eclipse
.classpath
@@ -42,4 +41,4 @@ Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
-*.stackdump
+*.stackdump
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7cec218..3e013e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ 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]
+### Changed
+- Migrated the CI pipeline from Jenkins to GitHub Actions.
## [3.0.0] - 2025-02-10
### Breaking changes
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index df2597e..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,94 +0,0 @@
-#!groovy
-pipeline {
- environment {
- PROJECT_NAME = "keyple-plugin-android-nfc-java-lib"
- PROJECT_BOT_NAME = "Eclipse Keyple Bot"
- }
- agent { kubernetes { yaml javaBuilder('2.0') } }
- stages {
- stage('Import keyring') {
- when { expression { env.GIT_URL.startsWith('https://github.com/eclipse-keyple/keyple-') && env.CHANGE_ID == null } }
- steps { container('java-builder') {
- withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) { sh 'import_gpg "${KEYRING}"' }
- } }
- }
- stage('Prepare settings') { steps { container('java-builder') {
- script {
- env.KEYPLE_VERSION = sh(script: 'grep version gradle.properties | cut -d= -f2 | tr -d "[:space:]"', returnStdout: true).trim()
- env.GIT_COMMIT_MESSAGE = sh(script: 'git log --format=%B -1 | head -1 | tr -d "\n"', returnStdout: true)
- env.SONAR_USER_HOME = '/home/jenkins'
- echo "Building version ${env.KEYPLE_VERSION} in branch ${env.GIT_BRANCH}"
- deployRelease = env.GIT_URL == "https://github.com/eclipse-keyple/${env.PROJECT_NAME}.git" && (env.GIT_BRANCH == "main" || env.GIT_BRANCH == "release-${env.KEYPLE_VERSION}") && env.CHANGE_ID == null && env.GIT_COMMIT_MESSAGE.startsWith("Release ${env.KEYPLE_VERSION}")
- deploySnapshot = !deployRelease && env.GIT_URL == "https://github.com/eclipse-keyple/${env.PROJECT_NAME}.git" && (env.GIT_BRANCH == "main" || env.GIT_BRANCH == "release-${env.KEYPLE_VERSION}") && env.CHANGE_ID == null
- sh 'git lfs fetch && git lfs checkout'
- }
- } } }
- stage('Check version') {
- steps { container('java-builder') {
- sh "./scripts/check_version.sh ${env.KEYPLE_VERSION}"
- } }
- }
- stage('Build and Test') {
- when { expression { !deploySnapshot && !deployRelease } }
- steps { container('java-builder') {
- sh './gradlew clean build test --no-build-cache --info --stacktrace'
- junit testResults: 'build/test-results/test/*.xml', allowEmptyResults: true
- } }
- }
- stage('Build and Publish Snapshot') {
- when { expression { deploySnapshot } }
- steps { container('java-builder') {
- configFileProvider([configFile(fileId: 'gradle.properties', targetLocation: '/home/jenkins/agent/gradle.properties')]) {
- sh './gradlew clean build test publish --info --stacktrace'
- }
- junit testResults: 'build/test-results/test/*.xml', allowEmptyResults: true
- } }
- }
- stage('Build and Publish Release') {
- when { expression { deployRelease } }
- steps { container('java-builder') {
- configFileProvider([configFile(fileId: 'gradle.properties', targetLocation: '/home/jenkins/agent/gradle.properties')]) {
- sh './gradlew clean build test release --info --stacktrace'
- }
- junit testResults: 'build/test-results/test/*.xml', allowEmptyResults: true
- } }
- }
- stage('Update GitHub Pages') {
- when { expression { deploySnapshot || deployRelease } }
- steps { container('java-builder') {
- sh "./scripts/prepare_javadoc.sh ${env.PROJECT_NAME} ${env.KEYPLE_VERSION} ${deploySnapshot}"
- dir("${env.PROJECT_NAME}") {
- withCredentials([usernamePassword(credentialsId: 'github-bot', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
- sh '''
- git add -A
- git config user.email "${PROJECT_NAME}-bot@eclipse.org"
- git config user.name "${PROJECT_BOT_NAME}"
- git commit --allow-empty -m "docs: update documentation ${JOB_NAME}-${BUILD_NUMBER}"
- git log --graph --abbrev-commit --date=relative -n 5
- git push "https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/eclipse-keyple/${PROJECT_NAME}.git" HEAD:doc
- '''
- }
- }
- } }
- }
- stage('Publish Code Quality') {
- when { expression { env.GIT_URL.startsWith('https://github.com/eclipse-keyple/keyple-') } }
- steps { container('java-builder') {
- catchError(buildResult: 'SUCCESS', message: 'Unable to log code quality to Sonar.', stageResult: 'FAILURE') {
- withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONAR_LOGIN')]) {
- sh './gradlew sonarqube --info --stacktrace'
- }
- }
- } }
- }
- stage('Publish packaging to Eclipse') {
- when { expression { deploySnapshot || deployRelease } }
- steps { container('java-builder') { sshagent(['projects-storage.eclipse.org-bot-ssh']) { sh 'publish_packaging' } } }
- }
- }
- post { always { container('java-builder') {
- archiveArtifacts artifacts: 'build*/libs/**', allowEmptyArchive: true
- archiveArtifacts artifacts: 'build*/reports/tests/**', allowEmptyArchive: true
- archiveArtifacts artifacts: 'build*/reports/jacoco/test/html/**', allowEmptyArchive: true
- } } }
-}
diff --git a/LICENSE_HEADER b/LICENSE_HEADER
new file mode 100644
index 0000000..71b5d7b
--- /dev/null
+++ b/LICENSE_HEADER
@@ -0,0 +1,11 @@
+/* **************************************************************************************
+ * 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 Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ************************************************************************************** */
\ No newline at end of file
diff --git a/PUBLISHERS.yml b/PUBLISHERS.yml
deleted file mode 100644
index 7eddd11..0000000
--- a/PUBLISHERS.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-url: https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib
-organization:
- name: Eclipse Keyple
- url: https://keyple.org/
-licenses:
- - name: Eclipse Public License - v 2.0
- url: https://www.eclipse.org/legal/epl-2.0/
- distribution: repo
-developers:
- - name: Keyple Contributors
- email: keyple-dev@eclipse.org
-scm:
- connection: scm:git:git://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib.git
- developerConnection: scm:git:https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib.git
- url: https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib
-ciManagement:
- system: Jenkins
- url: https://ci.eclipse.org/keyple/job/Keyple/job/keyple-plugin-android-nfc-java-lib/
diff --git a/README.md b/README.md
index ac39c4a..7a1eef8 100644
--- a/README.md
+++ b/README.md
@@ -25,4 +25,9 @@ Examples of implementation are available in the following repository: [github.co
## 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.
diff --git a/build.gradle.kts b/build.gradle.kts
index d263592..184c65b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,69 +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 }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// APP CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
-allprojects {
- group = "org.eclipse.keyple"
- repositories {
- mavenLocal()
- mavenCentral()
- maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
- google()
}
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
-tasks {
- spotless {
- kotlin {
- target("**/*.kt")
- ktfmt()
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- }
- java {
- target("plugin/src/**/*.java")
- licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
- importOrder("java", "javax", "org", "com", "")
- removeUnusedImports()
- googleJavaFormat()
- }
- }
- sonarqube {
- properties {
- property("sonar.projectKey", "eclipse_" + project.name)
- property("sonar.organization", "eclipse")
- property("sonar.host.url", "https://sonarcloud.io")
- property("sonar.login", System.getenv("SONAR_LOGIN"))
- System.getenv("BRANCH_NAME")?.let {
- if (it != "main") {
- property("sonar.branch.name", it)
- }
- }
- }
- }
-}
diff --git a/gradle.properties b/gradle.properties
index 43b6ae3..17be6b4 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,19 +1,56 @@
+# Project Configuration
group = org.eclipse.keyple
title = Keyple Plugin Android NFC Java Lib
description = Keyple add-on to manage Android NFC readers
-version = 3.0.0
-archivesBaseName = keyple-plugin-android-nfc-java-lib
+version = 3.0.1-SNAPSHOT
+# Java Configuration
javaSourceLevel = 1.8
javaTargetLevel = 1.8
-kotlinVersion = 1.7.20
-# 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)
+androidLibNamespace = org.eclipse.keyple.plugin.android.nfc
+androidCompileSdk = 33
+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
-# Kotlin code style for this project: "official" or "obsolete":
-kotlin.code.style=official
+# 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-plugin-android-nfc-java-lib
+
+# Organization
+organization.name = Eclipse Keyple
+organization.url = https://keyple.org/
+
+# License
+license.name = Eclipse Public License - v 2.0
+license.url = https://www.eclipse.org/legal/epl-2.0
+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-plugin-android-nfc-java-lib.git
+scm.developerConnection = scm:git:https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib.git
+scm.url = https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib
-org.gradle.jvmargs=-Xmx4608m
-android.disableAutomaticComponentCreation=true
\ No newline at end of file
+# Continuous Integration
+ci.system = GitHub Actions
+ci.url = https://github.com/eclipse-keyple/keyple-plugin-android-nfc-java-lib/actions
diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts
index 533c51c..97c03bd 100644
--- a/plugin/build.gradle.kts
+++ b/plugin/build.gradle.kts
@@ -1,96 +1,233 @@
-import com.android.build.api.artifact.SingleArtifact
-import com.android.build.api.variant.AndroidComponentsExtension
///////////////////////////////////////////////////////////////////////////////
// GRADLE CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
+
plugins {
- id("com.android.library")
- id("kotlin-android")
- id("kotlin-parcelize")
- id("org.jetbrains.dokka")
- id("com.diffplug.spotless")
+ id("com.android.library")
+ id("kotlin-android")
+ id("kotlin-parcelize")
+ id("com.diffplug.spotless")
+ id("org.jetbrains.dokka")
+ signing
+ `maven-publish`
}
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
-val kotlinVersion: String by project
-val archivesBaseName: String by project
-android {
- compileSdk = 33
- buildFeatures {
- viewBinding = true
- }
-
- defaultConfig {
- minSdk = 24
- testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
- consumerProguardFiles("consumer-rules.pro")
- }
+dependencies {
+ implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.20")
+ implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
+ implementation("org.eclipse.keyple:keyple-plugin-java-api:2.3.2")
+ implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.0")
+ implementation("org.slf4j:slf4j-api:1.7.32")
+}
- buildTypes {
- getByName("release") {
- isMinifyEnabled = false
- proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
- }
- }
+///////////////////////////////////////////////////////////////////////////////
+// STANDARD CONFIGURATION FOR ANDROID KOTLIN-BASED PROJECTS
+///////////////////////////////////////////////////////////////////////////////
- val javaSourceLevel: String by project
- val javaTargetLevel: String by project
- compileOptions {
- sourceCompatibility = JavaVersion.toVersion(javaSourceLevel)
- targetCompatibility = JavaVersion.toVersion(javaTargetLevel)
- }
+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}")
+}
- testOptions {
- unitTests.apply {
- isReturnDefaultValues = true // mock Log Android object
- isIncludeAndroidResources = true
- }
- }
+val title: String by project
+val javaSourceLevel: String by project
+val javaTargetLevel: String by project
+val generatedOverviewFile = layout.buildDirectory.file("tmp/overview-dokka.md")
- lint {
- lint.abortOnError = false
+android {
+ namespace = project.findProperty("androidLibNamespace") as String
+ compileSdk = (project.findProperty("androidCompileSdk") as String).toInt()
+ defaultConfig {
+ minSdk = (project.findProperty("androidMinSdk") as String).toInt()
+ consumerProguardFiles("consumer-rules.pro")
+ }
+ buildFeatures { viewBinding = true }
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
-
- kotlinOptions {
- jvmTarget = javaTargetLevel
+ }
+ 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")
+ }
+ libraryVariants.all {
+ outputs.all {
+ val outputImpl = this as com.android.build.gradle.internal.api.LibraryVariantOutputImpl
+ val variantName = name
+ val versionName = project.version.toString()
+ val newName = "${rootProject.name}-$versionName-$variantName.aar"
+ outputImpl.outputFileName = newName
}
-
- sourceSets {
- getByName("main").java.srcDirs("src/main/kotlin")
- getByName("debug").java.srcDirs("src/debug/kotlin")
- getByName("test").java.srcDirs("src/test/kotlin")
- getByName("androidTest").java.srcDirs("src/androidTest/kotlin")
+ }
+ publishing {
+ singleVariant("release") {
+ withSourcesJar()
+ // No withJavadocJar(), as we'll configure it manually with Dokka
}
+ }
+ lint { abortOnError = false }
}
-dependencies {
-
- implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
+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)
+}
- //keyple
- 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")
+tasks.withType().configureEach { archiveBaseName.set(rootProject.name) }
- //logging
- implementation("org.slf4j:slf4j-api:1.7.32")
+tasks {
+ spotless {
+ kotlin {
+ target("src/**/*.kt")
+ licenseHeaderFile("${project.rootDir}/LICENSE_HEADER")
+ ktfmt()
+ }
+ kotlinGradle {
+ target("**/*.kts")
+ ktfmt()
+ }
+ }
+ 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}")
+ })
+ }
+ }
+ 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("javadocJar") {
+ dependsOn(dokkaHtml)
+ archiveClassifier.set("javadoc")
+ from(dokkaHtml.flatMap { it.outputDirectory })
+ doFirst { copyLicenseFiles() }
+ manifest {
+ attributes(
+ mapOf(
+ "Implementation-Title" to "$title Documentation",
+ "Implementation-Version" to project.version))
+ }
+ }
+ register("copyLicenseFiles") { doLast { copyLicenseFiles() } }
}
-///////////////////////////////////////////////////////////////////////////////
-// TASKS CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
-tasks {
- dokkaHtml.configure {
- dokkaSourceSets {
- named("main") {
- noAndroidSdkLink.set(false)
- includeNonPublic.set(false)
- includes.from(files("src/main/kdoc/overview.md"))
+afterEvaluate {
+ tasks.named("assembleRelease") { dependsOn("copyLicenseFiles") }
+ publishing {
+ publications {
+ create("mavenJava") {
+ from(components["release"])
+ artifactId = rootProject.name
+ 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))
}
+ }
}
+ 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"])
+ }
}
-apply(plugin = "org.eclipse.keyple") // To do last
diff --git a/plugin/src/main/AndroidManifest.xml b/plugin/src/main/AndroidManifest.xml
index 57496c0..a8e27bf 100644
--- a/plugin/src/main/AndroidManifest.xml
+++ b/plugin/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+
diff --git a/plugin/src/main/kdoc/overview.md b/plugin/src/main/kdoc/overview.md
index 3479eea..f2ddff9 100644
--- a/plugin/src/main/kdoc/overview.md
+++ b/plugin/src/main/kdoc/overview.md
@@ -1,10 +1,6 @@
-# Package org.eclipse.keyple.plugin.android.nfc
-
This document specifies the API dedicated to the integration of the Android NFC plugin in an Android
Keyple application.
-## Observability
-
The Android NFC plugin **requires** the use of the Keyple observation pattern at the reader level to
handle card insertion and removal events.
**Unlike other reader implementations, Android NFC does not support continuous polling for card
@@ -16,4 +12,4 @@ package.
Since NFC events are managed asynchronously by the Android system, **working without observation is
not possible** in this context. Any integration of the Android NFC plugin must therefore be designed
-around this event-driven approach.
+around this event-driven approach.
\ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 7e6bba9..710559f 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,2 +1,21 @@
-include(":plugin")
rootProject.name = "keyple-plugin-android-nfc-java-lib"
+include(":plugin")
+
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ google()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ google()
+ maven(url = "https://central.sonatype.com/repository/maven-snapshots")
+ }
+}
+