Skip to content
Merged
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
56 changes: 56 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Documentation

on:
push:
branches:
- main
- docs
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build Documentation
run: make docs

- name: Upload Documentation Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build/docs

deploy:
name: Deploy to GitHub Pages
needs: build-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all clean setup library publish download-binaries tests coverage help test-app example-app \
run-test-app run-example-app signing-server-start signing-server-stop signing-server-status \
signing-server-build tests-with-server lint format
signing-server-build tests-with-server lint format docs docs-clean

# Default target
all: library
Expand Down Expand Up @@ -84,6 +84,22 @@ format:
exit 1; \
fi

# Generate API documentation using Dokka
docs:
@echo "Generating API documentation..."
@./gradlew generateDocs
@echo ""
@echo "Documentation generation complete!"
@echo "Output: build/docs/index.html"
@echo "To view: open build/docs/index.html"

# Clean generated documentation
docs-clean:
@echo "Cleaning generated documentation..."
@rm -rf build/docs
@rm -f library/build/libs/c2pa-release-javadoc.jar
@echo "Documentation cleaned"

# File to store the server PID
SIGNING_SERVER_PID_FILE := .signing-server.pid

Expand Down Expand Up @@ -198,6 +214,10 @@ help:
@echo " lint - Run Android lint checks"
@echo " format - Format all Kotlin files with ktlint"
@echo ""
@echo "Documentation:"
@echo " docs - Generate API documentation with Dokka"
@echo " docs-clean - Clean generated documentation"
@echo ""
@echo "Signing Server (for hardware signing tests):"
@echo " signing-server-build - Build the signing server"
@echo " signing-server-run - Run the signing server in foreground"
Expand Down
61 changes: 59 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,63 @@ plugins {
id("jacoco")
}

tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
tasks.register("clean", Delete::class) { delete(rootProject.layout.buildDirectory) }
val dokkaRuntime by configurations.creating
// Configuration for Dokka plugins (separate from CLI)
val dokkaPlugins by configurations.creating

dependencies {
dokkaRuntime("org.jetbrains.dokka:dokka-cli:2.0.0")
dokkaPlugins("org.jetbrains.dokka:dokka-base:2.0.0")
dokkaPlugins("org.jetbrains.dokka:analysis-kotlin-descriptors:2.0.0")
}

// Task to generate documentation using Dokka CLI
tasks.register<JavaExec>("generateDocs") {
group = "documentation"
description = "Generate API documentation using Dokka CLI"

classpath = dokkaRuntime
mainClass.set("org.jetbrains.dokka.MainKt")

val outputDir = file("$rootDir/build/docs")
val sourceDir = file("$rootDir/library/src/main/kotlin")
val moduleDoc = file("$rootDir/library/MODULE.md")

doFirst {
outputDir.deleteRecursively()
outputDir.mkdirs()

println("Generating documentation...")
println(" Source: $sourceDir")
println(" Module doc: $moduleDoc")
println(" Output: $outputDir")
}

// Build plugin classpath from dokkaPlugins configuration only
val pluginsClasspath = dokkaPlugins.files.joinToString(";") { it.absolutePath }

// Build sourceSet argument with all parameters together
val sourceSetParams = buildList {
add("-src")
add(sourceDir.absolutePath)
if (moduleDoc.exists()) {
add("-includes")
add(moduleDoc.absolutePath)
}
add("-analysisPlatform")
add("jvm")
add("-documentedVisibilities")
add("PUBLIC;PROTECTED;INTERNAL")
add("-sourceSetName")
add("main")
}.joinToString(" ")

args(
"-pluginsClasspath", pluginsClasspath,
"-outputDir", outputDir.absolutePath,
"-moduleName", "c2pa-android",
"-loggingLevel", "INFO",
"-sourceSet", sourceSetParams,
)
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ kotlin.code.style=official
android.nonTransitiveRClass=true
# Suppress SDK version compatibility warnings
android.suppressUnsupportedCompileSdk=35
# Dokka V1 mode (V2 has compatibility issues with Android Gradle Plugin 8.x)
# org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
36 changes: 36 additions & 0 deletions library/MODULE.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the content from this file get folded into the generated docs? I don't see it anywhere in https://contentauth.github.io/c2pa-android/c2pa-android/org.contentauth.c2pa/index.html and search doesn't return any hits either.

I would assume due to its location that it should be incorporated into the generated docs, but If it's actually meant for consumption in GitHub, then there are some minor formatting issues that should be fixed and it should be probably be moved to better location.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module name at the top of the file needed to be changed to exactly match the package. Now that that's done, the intro is showing on the site: https://contentauth.github.io/c2pa-android/

Happy to make any formatting changes.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Module c2pa-android

C2PA Android is a Kotlin wrapper around the C2PA C API, providing content authenticity and provenance functionality for Android applications.

## Overview

This library enables Android applications to create, read, and validate C2PA manifests, which provide cryptographic proof of content origin and history. The library uses JNI to bridge native C2PA libraries with Android's Kotlin/Java ecosystem.

## Core Components

### Content Authenticity

- [Reader] - Read and validate C2PA manifests from media files
- [Builder] - Create new C2PA manifests with claims, assertions, and ingredients

### Signing Methods

The library supports multiple signing approaches:

- **Direct signing** - Sign with in-memory private keys using [SignerInfo]
- **Callback signing** - Implement custom signing logic with [Signer]
- **Web service signing** - Delegate signing to remote servers with [WebServiceSigner]
- **Hardware security** - Use device hardware security modules with [StrongBoxSigner] or [KeyStoreSigner]

### Hardware Security Integration

- [StrongBoxSigner] - Hardware-backed signing using Android StrongBox
- [KeyStoreSigner] - Android Keystore signing with optional biometric authentication
- [CertificateManager] - Certificate generation and management for Android Keystore

## Platform Requirements

- **Minimum Android SDK**: 28 (Android 9.0 Pie)
- **Target Android SDK**: 35
- **Kotlin**: 1.9+
- **Hardware security** (optional): Devices with StrongBox or TEE support
Loading
Loading