Skip to content

Commit

Permalink
Setup for publishing to GitHub Packages (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: conanoc <conanoc@gmail.com>
  • Loading branch information
conanoc committed Feb 21, 2024
1 parent d62a1b1 commit 9f98b09
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 18 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,28 @@ Aries Framework Kotlin supports most of [AIP 1.0](https://github.com/hyperledger

## Requirements & Installation

Aries Framework Kotlin requires Android 7.0+. It is not available on Maven Central yet.
Aries Framework Kotlin requires Android 7.0+. It is distributed as a Maven package hosted by GitHub Packages.

Clone this repo and add a dependency to your app's build.gradle file:
You can add a dependency to your app's build.gradle file:
```groovy
dependencies {
implementation project('path_to_ariesframework')
implementation("org.hyperledger:aries-framework-kotlin:2.0.0")
}
```

You need additional dependencies if you include the framework as an AAR file:
You need to add the following to your project's build.gradle file to use GitHub Packages:
```groovy
dependencies {
implementation files('path_to_aar_file')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'ch.qos.logback:logback-classic:1.2.6'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.0'
implementation 'org.jetbrains.kotlinx:kotlinx-datetime:0.4.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
allprojects {
repositories {
maven {
setUrl("https://maven.pkg.github.com/hyperledger/aries-framework-kotlin")
credentials {
// You should put these in the local.properties file
username = "your github username"
password = "your github token for read:packages"
}
}
}
}
```

Expand Down Expand Up @@ -74,7 +76,7 @@ To create an agent, first create a key to encrypt the wallet and save it in the
val key = Agent.generateWalletKey()
```

A genesis file for the indy pool should be included as a resource in the app bundle and should be copyed to the file system before initializing the agent.
A genesis file for the indy pool should be included as a resource in the app bundle and should be copied to the file system before initializing the agent.
```kotlin
val genesisPath = "genesis.txn"
val inputStream = applicationContext.assets.open(genesisPath)
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ android {
}

dependencies {
implementation project(path: ':ariesframework')
// implementation project(path: ':ariesframework')
implementation("org.hyperledger:aries-framework-kotlin:2.0.0")
implementation("org.hyperledger:anoncreds_uniffi:0.1.1-wrapper.1")

implementation 'com.otaliastudios:cameraview:2.7.2'
Expand Down
29 changes: 28 additions & 1 deletion ariesframework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,41 @@ dependencies {
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.0"
}

ext["githubUsername"] = null
ext["githubToken"] = null

def secretPropsFile = project.rootProject.file("local.properties")
if (secretPropsFile.exists()) {
Properties properties = new Properties()
secretPropsFile.withInputStream { properties.load(it) }
properties.each { k, v -> ext[k] = v }
} else {
ext["githubUsername"] = System.getenv("GITHUB_ACTOR")
ext["githubToken"] = System.getenv("GITHUB_TOKEN")
}

def getExtraString(name) {
return ext[name] ?: ""
}

afterEvaluate {
publishing {
repositories {
maven {
name = "github"
setUrl("https://maven.pkg.github.com/hyperledger/aries-framework-kotlin")
credentials {
username = getExtraString("githubUsername")
password = getExtraString("githubToken")
}
}
}
publications {
release(MavenPublication) {
from components.release
groupId 'org.hyperledger'
artifactId 'aries-framework-kotlin'
version '1.0.0'
version '2.0.0'
}
}
}
Expand Down
24 changes: 22 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,40 @@ pluginManagement {
gradlePluginPortal()
}
}

ext["githubUsername"] = null
ext["githubToken"] = null

def secretPropsFile = file("local.properties")
if (secretPropsFile.exists()) {
Properties properties = new Properties()
secretPropsFile.withInputStream { properties.load(it) }
properties.each { k, v -> ext[k] = v }
} else {
ext["githubUsername"] = System.getenv("GITHUB_ACTOR")
ext["githubToken"] = System.getenv("GITHUB_TOKEN")
}

def getExtraString(name) {
return ext[name] ?: ""
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenLocal()
mavenCentral()
maven {
setUrl("https://maven.pkg.github.com/hyperledger/aries-uniffi-wrappers")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
username = getExtraString("githubUsername")
password = getExtraString("githubToken")
}
}
}
}

rootProject.name = "aries-framework-kotlin"
include ':app'
include ':ariesframework'

0 comments on commit 9f98b09

Please sign in to comment.