Skip to content

Commit

Permalink
Closes #2 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner authored Sep 13, 2017
1 parent 9eff584 commit a240d17
Show file tree
Hide file tree
Showing 26 changed files with 74 additions and 35 deletions.
10 changes: 10 additions & 0 deletions .ci/prepare_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# fail if any commands fails
set -e

git branch

# strip the first char as that should always be "v" (as tags should be in the format "vX.X.X")
description="$(git describe --tags)"
export LIBRARY_VERSION=${description:1}
export RELEASE_NOTES=$TRAVIS_COMMIT_MESSAGE
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: android
android:
components:
- tools
- platform-tools
- tools

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

script:
- . .ci/prepare_env.sh
- ./gradlew check jar --stacktrace

deploy:
provider: releases
api_key: "${GITHUB_API_KEY}"
file_glob: true
file: ./*/build/libs/*.jar
skip_cleanup: true
on:
tags: true
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,21 @@

#### Include via jitpack

* Add jitpack repository (see https://www.jitpack.io/#gnosis/abi-kotlin)
* Add jitpack repository (see https://www.jitpack.io/#gnosis/bivrost-kotlin)

* Add classpath dependency:
```
classpath ('com.github.gnosis:abi-kotlin:<version>') {
exclude group: 'com.android.tools.build'
exclude group: 'com.squareup'
exclude group: 'com.squareup.moshi'
}
classpath ('com.github.gnosis:bivrost-kotlin:bivrost-gradle-plugin:<version>')
```

* Add runtime dependency:
```
implementation ('com.github.gnosis:abi-kotlin:<version>') {
exclude group: 'com.android.tools.build'
exclude group: 'com.squareup'
exclude group: 'com.squareup.moshi'
}
implementation ('com.github.gnosis:abi-kotlin:bivrost-solidity-types:<version>')
```

* Apply plugin:
```
apply plugin: pm.gnosis.abiparser.plugin.AbiParserPlugin
apply plugin: 'bivrost'
```

* Add abi json to project in `app/abi` folder (see sample app)
Expand All @@ -34,11 +26,11 @@ apply plugin: pm.gnosis.abiparser.plugin.AbiParserPlugin

#### Setup of Sample App
* Optional: Generate the Solidity types:
- `./gradlew :abi-data-types-generator:runSolidityTypeGenerator`
- `./gradlew :bivrost-solidity-types-generator:runSolidityTypeGenerator`
* Add library artifacts to local maven:
- `./gradlew :abi-data-types:uploadArchives`
- `./gradlew :abi-parser:uploadArchives`
- `./gradlew :abi-parser-gradle-plugin:uploadArchives`
- `./gradlew :bivrost-solidity-types:uploadArchives`
- `./gradlew :bivrost-abi-parser:uploadArchives`
- `./gradlew :bivrost-gradle-plugin:uploadArchives`

* Uncomment `include ':sample:app'` in the `settings.gradle` to include sample app module.

Expand Down
3 changes: 0 additions & 3 deletions abi-parser-gradle-plugin/gradle.properties

This file was deleted.

1 change: 0 additions & 1 deletion abi-parser-gradle-plugin/settings.gradle

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task runSolidityTypeGenerator(type: JavaExec) {

dependencies {

implementation project(":abi-data-types")
implementation project(':bivrost-solidity-types')

implementation deps.kotlin.stdLibJre8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
compileOnly gradleApi()

implementation project(":abi-parser")
implementation project(':bivrost-abi-parser')
implementation deps.android.gradlePlugin
}

Expand Down
3 changes: 3 additions & 0 deletions bivrost-gradle-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=Bivrost Gradle Plugin
POM_ARTIFACT_ID=bivrost-gradle-plugin
POM_PACKAGING=jar
1 change: 1 addition & 0 deletions bivrost-gradle-plugin/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'bivrost-gradle-plugin'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pm.gnosis.abiparser.plugin
package pm.gnosis.plugin

import com.android.build.gradle.*
import com.android.build.gradle.api.BaseVariant
Expand All @@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicBoolean
import kotlin.reflect.KClass


class AbiParserPlugin : Plugin<Project> {
class BivrostPlugin : Plugin<Project> {
override fun apply(project: Project) {
println("Plugin Project: " + project.toString())
project.plugins.all {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
implementation-class=pm.gnosis.plugin.BivrostPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ task runSolidityTypeGenerator(type: JavaExec) {
dependencies {
implementation deps.kotlin.stdLibJre8

implementation project(":abi-data-types")
implementation project(':bivrost-solidity-types')
implementation 'com.squareup:kotlinpoet:0.4.0'

testImplementation group: 'junit', name: 'junit', version: '4.12'
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ buildscript {

subprojects { project ->
group 'pm.gnosis'
version '1.0-SNAPSHOT'
version getKey('LIBRARY_VERSION', '0.0.42')


repositories {
Expand All @@ -48,4 +48,12 @@ subprojects { project ->
url "https://plugins.gradle.org/m2/"
}
}
}

static def getKey(String name, String defaultValue = null) {
def value = System.getenv(name)
if (value == null) {
return defaultValue
}
return value
}
6 changes: 3 additions & 3 deletions sample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ buildscript {
}

dependencies {
classpath "pm.gnosis:abi-parser-gradle-plugin:1.0-SNAPSHOT"
classpath "pm.gnosis:bivrost-gradle-plugin:1.0-SNAPSHOT"
}
}

apply plugin: "pm.gnosis.abiparser"
apply plugin: "bivrost"

android {
compileSdkVersion versions.compileSdk
Expand Down Expand Up @@ -58,5 +58,5 @@ repositories {

dependencies {
implementation deps.kotlin.stdLibJre8
implementation "pm.gnosis:abi-data-types:1.0-SNAPSHOT"
implementation "pm.gnosis:bivrost-solidity-types:1.0-SNAPSHOT"
}
10 changes: 5 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include ':abi-parser'
include ':abi-parser-gradle-plugin'
include ':abi-data-types'
include ':abi-data-types-generator'
include ':bivrost-abi-parser'
include ':bivrost-gradle-plugin'
include ':bivrost-solidity-types'
include ':bivrost-solidity-types-generator'
//include ':sample:app'

rootProject.name = 'abi-parser-kotlin'
rootProject.name = 'bivrost-kotlin'

0 comments on commit a240d17

Please sign in to comment.