Skip to content

Commit

Permalink
Merge pull request #29 from ProtonProtocol/develop
Browse files Browse the repository at this point in the history
Github Packages Update
  • Loading branch information
Joey Harward authored Apr 29, 2021
2 parents 9b7a5cf + 4e0393a commit 742b8a9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 164 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Proton Kotlin Wallet SDK (Beta) 🚧

![Bintray](https://img.shields.io/bintray/v/protonprotocol/ProtonKotlin/com.metallicus.protonsdk)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/ProtonProtocol/ProtonKotlin?include_prereleases)
![GitHub](https://img.shields.io/github/license/ProtonProtocol/ProtonKotlin)

Expand All @@ -15,17 +14,26 @@ over time.*

# Installation

First make sure you include jcenter() in your root build.gradle
This library is hosted by Github Packages so you will need to provide your Github
credentials for access.

```gradle
allprojects {
repositories {
...
jcenter()
maven {
name = "ProtonKotlinSdk"
url = uri("https://maven.pkg.github.com/ProtonProtocol/ProtonKotlin")
credentials {
...
username = properties.getProperty('github.username')
password = properties.getProperty('github.token')
}
}
// this is needed for ESR library access
maven {
name = "eosio-signing-request-java"
name = "ESRSdk"
url = uri("https://maven.pkg.github.com/ProtonProtocol/eosio-signing-request-java")
credentials {
...
Expand All @@ -42,7 +50,7 @@ Then add the following dependency to your module's build.gradle
```gradle
dependencies {
...
implementation "com.metallicus:protonsdk:0.9.6"
implementation "com.metallicus:protonsdk:1.0.0"
}
```

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ plugins {
id(BuildPlugins.dokka) version BuildPlugins.Versions.dokka
id(BuildPlugins.orchid) version orchidVersion
`maven-publish`
id(BuildPlugins.bintray) version BuildPlugins.Versions.bintray
}

allprojects {
repositories {
mavenLocal()

google()
mavenCentral()
jcenter()

mavenLocal()
maven {
name = "eosio-signing-request-java"
url = uri("https://maven.pkg.github.com/ProtonProtocol/eosio-signing-request-java")
Expand Down
31 changes: 5 additions & 26 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ const val kotlinVersion = "1.4.32"
const val orchidVersion = "0.21.1"

object ProtonSdk {
const val versionCode = 39
const val versionName = "0.9.6"
const val versionCode = 40
const val versionName = "1.0.0"
}

object BuildPlugins {
object Versions {
const val gradle = "4.1.3"
const val dokka = "0.10.1" // TODO: 1.4.0
const val bintray = "1.8.5"
}

const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.gradle}"
Expand All @@ -41,7 +40,6 @@ object BuildPlugins {
const val mavenPublish = "maven-publish"
const val dokka = "org.jetbrains.dokka"
const val orchid = "com.eden.orchidPlugin"
const val bintray = "com.jfrog.bintray"
}

object Android {
Expand Down Expand Up @@ -113,26 +111,7 @@ object TestLibraries {
}

object Publishing {
object Publications {
const val debug = "ProtonSDKDebug"
const val release = "ProtonSDKRelease"
}
const val bintrayRepo = "ProtonKotlin"
const val bintrayName = "com.metallicus.protonsdk"
const val userOrganization = "protonprotocol"

const val libraryName = "protonsdk"
const val libraryVersion = ProtonSdk.versionName

const val publishedGroupId = "com.metallicus"

const val libraryDescription = "Kotlin library for handling Proton Chain operations"
const val siteUrl = "https://github.com/ProtonProtocol/ProtonKotlin"
const val gitUrl = "https://github.com/ProtonProtocol/ProtonKotlin.git"
const val developerId = "joey-harward"
const val developerName = "Metallicus Inc."
const val developerEmail = "[email protected]"
const val licenseName = "MIT License"
const val licenseUrl = "https://opensource.org/licenses/MIT"
const val allLicenses = "MIT"
const val groupId = "com.metallicus"
const val artifactId = "protonsdk"
const val version = ProtonSdk.versionName
}
166 changes: 35 additions & 131 deletions protonsdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.jetbrains.dokka.gradle.DokkaTask
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask

plugins {
id(BuildPlugins.androidLibrary)
kotlin(BuildPlugins.kotlinAndroid)
kotlin(BuildPlugins.kotlinKapt)
id(BuildPlugins.mavenPublish)
id(BuildPlugins.dokka)
id(BuildPlugins.bintray)
}

android {
Expand Down Expand Up @@ -127,156 +125,62 @@ tasks {
}
}

// publishing depends on build
withType<PublishToMavenLocal> {
dependsOn(build)
}

// uploading to Bintray depends on publications
withType<BintrayUploadTask> {
dependsOn(publishToMavenLocal)
}
// // publishing depends on build
// withType<PublishToMavenLocal> {
// dependsOn(build)
// }
//
// // uploading to Bintray depends on publications
// withType<BintrayUploadTask> {
// dependsOn(publishToMavenLocal)
// }
}

group = Publishing.publishedGroupId
version = Publishing.libraryVersion

val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>(Publishing.Publications.debug) {
groupId = "com.metallicus"
artifactId = "${Publishing.libraryName}-debug"
version = Publishing.libraryVersion

//artifact(buildOutputs["debug"].outputFile)
artifact("$buildDir/outputs/aar/protonsdk-debug.aar")
artifact(sourcesJar)

pom {
name.set(Publishing.libraryName)
description.set(Publishing.libraryDescription)
url.set(Publishing.siteUrl)

licenses {
license {
name.set(Publishing.licenseName)
url.set(Publishing.licenseUrl)
}
}

developers {
developer {
id.set(Publishing.developerId)
name.set(Publishing.developerName)
email.set(Publishing.developerEmail)
}
}

scm {
connection.set(Publishing.gitUrl)
developerConnection.set(Publishing.gitUrl)
url.set(Publishing.siteUrl)
}

pom.withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.implementation.get().allDependencies.forEach {
if (it.group != null && it.version != null &&
it.name != "unspecified" && it.version != "unspecified") {
dependenciesNode.appendNode("dependency").apply {
appendNode("groupId", it.group)
appendNode("artifactId", it.name)
appendNode("version", it.version)
}
}
}
}
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/ProtonProtocol/ProtonKotlin")
credentials {
username = gradleLocalProperties(rootDir).getProperty("github.username")
password = gradleLocalProperties(rootDir).getProperty("github.token")
}
}
maven {
name = "LocalTest"
url = uri("$buildDir/repo")
}
}

create<MavenPublication>(Publishing.Publications.release) {
groupId = "com.metallicus"
artifactId = Publishing.libraryName
version = Publishing.libraryVersion
publications {
create<MavenPublication>("protonsdk") {
groupId = Publishing.groupId
artifactId = Publishing.artifactId
version = Publishing.version

//artifact(buildOutputs["release"].outputFile)
artifact("$buildDir/outputs/aar/protonsdk-release.aar")
artifact(sourcesJar)

pom {
name.set(Publishing.libraryName)
description.set(Publishing.libraryDescription)
url.set(Publishing.siteUrl)

licenses {
license {
name.set(Publishing.licenseName)
url.set(Publishing.licenseUrl)
}
}

developers {
developer {
id.set(Publishing.developerId)
name.set(Publishing.developerName)
email.set(Publishing.developerEmail)
}
}

scm {
connection.set(Publishing.gitUrl)
developerConnection.set(Publishing.gitUrl)
url.set(Publishing.siteUrl)
}

pom.withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.implementation.get().allDependencies.forEach {
if (it.group != null && it.version != null &&
it.name != "unspecified" && it.version != "unspecified"
) {
dependenciesNode.appendNode("dependency").apply {
appendNode("groupId", it.group)
appendNode("artifactId", it.name)
appendNode("version", it.version)
}
pom.withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.implementation.get().allDependencies.forEach {
if (it.group != null && it.version != null &&
it.name != "unspecified" && it.version != "unspecified") {
dependenciesNode.appendNode("dependency").apply {
appendNode("groupId", it.group)
appendNode("artifactId", it.name)
appendNode("version", it.version)
}
}
}
}
}
}
}

bintray {
user = gradleLocalProperties(rootDir).getProperty("bintray.user")
key = gradleLocalProperties(rootDir).getProperty("bintray.apikey")

setPublications(Publishing.Publications.release)

pkg.apply {
repo = Publishing.bintrayRepo
name = Publishing.bintrayName
userOrg = Publishing.userOrganization
desc = Publishing.libraryDescription
websiteUrl = Publishing.siteUrl
vcsUrl = Publishing.gitUrl
setLicenses(Publishing.allLicenses)
publish = true
publicDownloadNumbers = true

version.apply {
name = Publishing.libraryVersion
desc = Publishing.libraryDescription
// gpg.sign = true
// gpg.passphrase = gradleLocalProperties(rootDir).getProperty("bintray.gpg.password")
}
}
}
}

0 comments on commit 742b8a9

Please sign in to comment.