Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed May 6, 2019
2 parents 053ad5e + 5605f28 commit a9318b3
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 33 deletions.
5 changes: 4 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repositories {
dependencies {
//...
compile "com.github.uport-project:kmnid:0.3"
compile "com.github.uport-project:kmnid:0.3.1"
}
```
Expand Down Expand Up @@ -100,6 +100,9 @@ assertFalse( MNID.isMNID('QmXuNqXmrkxs4WhTDC2GCnXEep4LUD87bu97LQMn1rkxmQ') )

## Changelog

* 0.3.1 - maintenance release
* updated build scripts

* 0.3
* removed spongycastle dependency for hashing,
using [KHash](https://github.com/komputing/KHash) instead
Expand Down
24 changes: 20 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
buildscript {
ext {
//general
kotlin_version = '1.3.30'
kotlin_version = '1.3.31'

junit_version = "4.12"

//mnid module
kethereum_version = "0.75.0"
khash_version = "0.8"
khex_version = "0.6"

//demo app
gradle_tools_version = '3.3.2'
gradle_tools_version = '3.4.0'

build_tools_version = "28.0.0"
build_tools_version = "28.0.3"
compile_sdk_version = 28
target_sdk_version = compile_sdk_version
min_sdk_version = 19

support_lib_version = "28.0.0"
constraint_layout_version = "1.1.3"

//testing
test_runner_version = "1.0.2"
espresso_version = "3.0.2"

current_release_version = "0.3.1"
}

repositories {
Expand All @@ -43,4 +47,16 @@ allprojects {
maven { url 'https://jitpack.io' }
}

}
}

subprojects { subproject ->
afterEvaluate {
subproject.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
}

apply from: "publishing.gradle"
11 changes: 9 additions & 2 deletions demoapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ android {
}
}

compileOptions {
sourceCompatibility "1.8"
targetCompatibility "1.8"
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation "com.android.support:appcompat-v7:$support_lib_version"
implementation "com.android.support.constraint:constraint-layout:$constraint_layout_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

//this needs to be added to your project
implementation "com.github.uport-project:kmnid:0.2.1"
implementation "com.github.uport-project:kmnid:0.3.1"
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Apr 25 22:50:38 EEST 2019
#Mon May 06 11:59:53 EEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
32 changes: 8 additions & 24 deletions mnid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,15 @@ apply plugin: "jacoco"
apply plugin: "maven"
apply plugin: "java-library"

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.github.komputing.KEthereum:base58:$kethereum_version"
implementation "com.github.komputing:KHash:$khash_version"
compile("com.github.komputing.KEthereum:base58:$kethereum_version") {
exclude group: "com.github.walleth"
}
compile("com.github.komputing:KHash:$khash_version") {
exclude group: "com.github.walleth"
}
compile "com.github.komputing:KHex:$khex_version"

testCompile "junit:junit:$junit_version"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
}
171 changes: 171 additions & 0 deletions publishing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
// this relies on a vault connection or the presence of a publish.properties file with:
// bintray_api_key
// bintray_username


def gitUrl = "https://github.com/uport-project/kmnid.git"
def groupID = "com.github.uport-project.kmnid"
def siteUrl = "https://developer.uport.me"
def sdkDescription = "MNID encoder/decoder usable in kotlin"

subprojects { subproject ->

afterEvaluate {

if (subproject.plugins.hasPlugin('com.github.dcendents.android-maven') || subproject.plugins.hasPlugin('maven')) {

subproject.group = groupID
subproject.version = current_release_version
subproject.description = subproject.ext.has("description") ? subproject.ext.description : sdkDescription

//pom fields required by maven central
install {
repositories.mavenInstaller {
pom.project {
if (subproject.hasProperty("android")) {
packaging 'aar'
}
groupId subproject.group
artifactId subproject.name

name subproject.name
description subproject.description

url siteUrl

licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id "mirceanis"
name "Mircea Nistor"
email "[email protected]"
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}

task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (subproject.hasProperty("android")) {
from android.sourceSets.main.javaDirectories
} else {
from sourceSets.main.java.srcDirs
}
}

artifacts {
archives sourcesJar
}

//config for jcenter
if (gradle.startParameter.taskNames.find { it.contains("bintray") }) {
bintray {
user = getBintrayUser()
key = getBintrayApiKey()

configurations = ['archives']

pkg {
repo = "uport-project"
name = subproject.name
licenses = ["Apache-2.0"]
desc = subproject.description
websiteUrl = siteUrl
vcsUrl = gitUrl
dryRun = false
publish = true
override = true
publicDownloadNumbers = false
version {
name = uport_sdk_version
released = new Date()
}
}
}
}

}

}
}

//////////////////////////////////////////////////
// helpers for loading publishing configuration //
//////////////////////////////////////////////////

def getBintrayApiKey() {
return getInfoFromPropOrVault("bintray_api_key")
}

def getBintrayUser() {
return getInfoFromPropOrVault("bintray_username")
}

def getInfoFromPropOrVault(String key) {

checkLocalPublishingProperties()
checkVaultEnvironment()

String info
if (project.publishProps?.get(key) != null) {
info = project.publishProps?.get(key)
} else if (project.hasProperty("IGNORE_VAULT")) {
info = ""
} else {
try {
info = project?.vault?.get("secret/android_sdk/$key")['data']['value']
} catch (Exception e) {
throw new InvalidUserDataException("There was an error while reading $key from vault.\n" +
"Make sure to have secret/android_sdk/$key in the vault.\n" +
"Run this task with -PIGNORE_VAULT to default to local configuration if available", e)
}
}
return info
}

def checkVaultEnvironment() {

if (project.hasProperty("IGNORE_VAULT")) {
//use only local data if available
return
}

File tokenFile = new File("${System.env.HOME}/.vault-token")

if (tokenFile.canRead()) {
if (System.env.VAULT_TOKEN == null || System.env.VAULT_TOKEN == "") {
project?.vault?.token = tokenFile.text
}
}

if (System.env.VAULT_ADDR == null || (System.env.VAULT_TOKEN == null && !tokenFile.canRead())) {
throw new InvalidUserDataException("Vault coordinates are not configured.\n" +
"VAULT_ADDR and VAULT_TOKEN need to be set as environment variables.\n" +
"Run this task with -PIGNORE_VAULT to skip secrets and build using local configuration only")
}
}

def checkLocalPublishingProperties() {
def propFile = file("${rootDir}/publish.properties")
if (propFile.canRead()) {

Properties publishProps = new Properties()
propFile.withInputStream {
publishProps.load(it)
}
project.ext.publishProps = publishProps
} else {
project.ext.publishProps = null
}
}

0 comments on commit a9318b3

Please sign in to comment.