Merge remote-tracking branch 'origin/master'

This commit is contained in:
Roman Mandeleil 2015-01-06 20:53:57 +02:00
commit 0039995aad
9 changed files with 172 additions and 142 deletions

View File

@ -19,6 +19,11 @@ notifications:
on_failure: always
use_notice: true
skip_join: true
slack:
on_success: change
on_failure: always
rooms:
- secure: "Fhaoka5w5XzIZS7ObKfVrnHaVLz7x2Owo1ygb+hXWAHiXpc3Oi1Q6yDOfye/z+Y0Gw8an8v23PIxhLoVZ6JpdurwCXo66dK2TkiNzmEWd6RtYPSZDm6f+0NjPBSOnP5rHmej7RvHeyTY/PQrGPtrHZZQTYD3AuRP1S+tGvtqikA="
# Encrypted values are ORG_GRADLE_PROJECT_bintrayUser and ORG_GRADLE_PROJECT_bintrayKey props for use by Travis when
# authenticating against oss.jfrog.org and/or Bintray repositories. See http://docs.travis-ci.com/user/encryption-keys

View File

@ -59,4 +59,4 @@ Run `../gradlew install`.
#### Publish ethereumj-core builds
Simply push to master, and [the Travis CI build](https://travis-ci.org/ethereum/ethereumj) will take care of the rest. To publish manually instead, just run `../gradlew publish`. Where the artifacts are published depends on the value of the `version` property in the [root build.gradle file](../build.gradle). Snapshots (version values ending in `-SNAPSHOT`) will be published to oss.jfrog.org, while releases will be published to Bintray (and subsequently to JCenter). **You must be a member of the [ethereum Bintray organization](https://bintray.com/ethereum) and you must supply `bintrayUser` and `bintrayKey` properties to the Gradle build in order to authenticate against these repositories**. Configure these properties in your `$HOME/.gradle/gradle.properties` for greatest convenience and security.
Simply push to master, and [the Travis CI build](https://travis-ci.org/ethereum/ethereumj) will take care of the rest. To publish manually instead, just run `../gradlew publish`. Where the artifacts are published depends on the value of the `version` property in the [root build.gradle file](../build.gradle). Snapshots (version values ending in `-SNAPSHOT`) will be published to [oss.jfrog.org](https://oss.jfrog.org/libs-snapshot/org/ethereum/), while releases will be published to [Bintray](https://bintray.com/ethereum/maven/org.ethereum/) (and subsequently to [JCenter](http://jcenter.bintray.com/org/ethereum/)). **You must be a member of the [ethereum Bintray organization](https://bintray.com/ethereum) and you must supply `bintrayUser` and `bintrayKey` properties to the Gradle build in order to authenticate against these repositories**. Configure these properties in your `$HOME/.gradle/gradle.properties` for greatest convenience and security.

View File

@ -1,26 +1,25 @@
buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
jcenter()
maven { url 'http://repo.spring.io/plugins-release-local' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.6'
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1'
}
}
plugins {
id 'application'
id 'jacoco'
id 'maven'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '1.2.0'
id 'me.champeau.gradle.antlr4' version '0.1'
id 'com.github.kt3k.coveralls' version '2.0.1x'
id 'com.jfrog.artifactory' version '3.0.1'
id 'com.jfrog.bintray' version '1.0'
}
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'com.jfrog.artifactory-upload'
sourceCompatibility = 1.7
@ -116,16 +115,6 @@ jacocoTestReport {
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
def bintrayUsername = project.hasProperty('bintrayUser') ? project.bintrayUser : ''
def bintrayPassword = project.hasProperty('bintrayKey') ? project.bintrayKey : ''
def pullRequest = System.getenv('TRAVIS_PULL_REQUEST')
@ -138,9 +127,6 @@ artifactory {
username = bintrayUsername
password = bintrayPassword
}
defaults {
publications ('mavenJava')
}
}
resolve {
repository {
@ -158,7 +144,8 @@ bintray {
user = bintrayUsername
key = bintrayPassword
publications = ['mavenJava']
configurations = ['archives']
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
pkg {
@ -172,7 +159,62 @@ bintrayUpload.onlyIf {
(!pullRequest || pullRequest == 'false') && !project.version.endsWith('-SNAPSHOT')
}
publish {
description = "Releases snapshots to oss.jfrog.org and releases to Bintray/JCenter"
install {
repositories.mavenInstaller {
customizePom(pom, project)
}
}
task publish {
description = "Publishes snapshots to oss.jfrog.org and releases to Bintray/JCenter"
dependsOn artifactoryPublish, bintrayUpload
}
def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
// eliminate test-scoped dependencies (no need in maven central poms)
generatedPom.dependencies.removeAll { dep ->
dep.scope == "test"
}
// sort to make pom dependencies order consistent to ease comparison of older poms
generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
"$dep.scope:$dep.groupId:$dep.artifactId"
}
// add all items necessary for maven central publication
generatedPom.project {
name = "ethereumj"
description = "Java implementation of the Ethereum protocol"
url = "https://github.com/ethereum/ethereumj"
organization {
name = "Ethereum"
url = "https://ethereum.org"
}
licenses {
license {
name "The MIT License"
url "http://mit-license.org/"
distribution "repo"
}
}
scm {
url = "https://github.com/ethereum/ethereumj"
connection = "scm:git:git://github.com/ethereum/ethereumj"
developerConnection = "scm:git:git://github.com/ethereum/ethereumj"
}
developers {
developer {
id = "rmandeleil"
name = "Roman Mandeleil"
email = "roman.mandeleil@gmail.com"
}
}
issueManagement {
system = "GitHub Issues"
url = "https://github.com/ethereum/ethereumj/issues"
}
}
}
}

View File

@ -1,11 +1,5 @@
package test.ethereum.net;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import java.lang.System;
import org.ethereum.net.message.ReasonCode;
import org.ethereum.net.p2p.DisconnectMessage;
@ -13,7 +7,7 @@ import org.junit.Test;
import org.spongycastle.util.encoders.Hex;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
public class DisconnectMessageTest {

View File

@ -1,11 +1,13 @@
package test.ethereum.net;
import static org.junit.Assert.assertEquals;
import org.ethereum.net.p2p.GetPeersMessage;
import org.ethereum.net.p2p.P2pMessageCodes;
import org.junit.Test;
import org.spongycastle.util.encoders.Hex;
import org.ethereum.net.p2p.P2pMessageCodes;
import org.ethereum.net.p2p.GetPeersMessage;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class GetPeersMessageTest {
@ -17,8 +19,6 @@ public class GetPeersMessageTest {
//Init
GetPeersMessage getPeersMessage = new GetPeersMessage();
//System.out.println(getPeersMessage.getEncoded());
//toString
assertEquals("[GET_PEERS]", getPeersMessage.toString());
@ -30,7 +30,6 @@ public class GetPeersMessageTest {
//getCommand
assertEquals(P2pMessageCodes.GET_PEERS, getPeersMessage.getCommand());
}
}

View File

@ -1,17 +1,12 @@
package test.ethereum.net;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import org.ethereum.net.client.Capability;
import org.ethereum.net.eth.EthHandler;
import org.ethereum.net.p2p.HelloMessage;
import org.ethereum.net.p2p.P2pMessageCodes;
import org.ethereum.net.p2p.P2pHandler;
import org.ethereum.net.p2p.P2pMessageCodes;
import org.ethereum.net.shh.ShhHandler;
import org.junit.Test;
import org.slf4j.Logger;
@ -19,6 +14,9 @@ import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class HelloMessageTest {
@ -43,8 +41,6 @@ public class HelloMessageTest {
assertEquals(
"1fbf1e41f08078918c9f7b6734594ee56d7f538614f602c71194db0a1af5a77f9b86eb14669fe7a8a46a2dd1b7d070b94e463f4ecd5b337c8b4d31bbf8dd5646",
helloMessage.getPeerId());
}
//Instantiate from constructor
@ -88,7 +84,6 @@ public class HelloMessageTest {
String peerId = ""; //null id
HelloMessage helloMessage = new HelloMessage(version, clientStr, capabilities, listenPort, peerId);
//logger.info(helloMessage.toString());
assertEquals(P2pMessageCodes.HELLO, helloMessage.getCommand());
assertEquals(version, helloMessage.getP2PVersion());

View File

@ -1,16 +1,19 @@
package test.ethereum.net;
import static org.junit.Assert.assertEquals;
import org.ethereum.net.client.Capability;
import org.ethereum.net.p2p.Peer;
import org.spongycastle.util.encoders.Hex;
import java.net.InetAddress;
import java.util.List;
import java.util.ArrayList;
import org.junit.Test;
import org.spongycastle.util.encoders.Hex;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class PeerTest {
/* PEER */

View File

@ -1,17 +1,5 @@
package test.ethereum.net;
import static org.junit.Assert.assertEquals;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.ethereum.net.client.Capability;
import org.ethereum.net.p2p.GetPeersMessage;
import org.ethereum.net.p2p.P2pMessageCodes;
@ -25,7 +13,14 @@ import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import static org.junit.Assert.assertEquals;
@ -66,7 +61,6 @@ public class PeersMessageTest {
peer.getPeerId());
}
@Test /* PeersMessage 1 from constructor */
public void testPeers_2() {
//Init

View File

@ -2,8 +2,6 @@ package test.ethereum.net;
import org.ethereum.net.eth.StatusMessage;
import java.math.BigInteger;
import org.junit.Test;
import org.slf4j.Logger;
@ -11,6 +9,8 @@ import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import java.math.BigInteger;
import static org.junit.Assert.assertEquals;
public class StatusMessageTest {
@ -40,16 +40,17 @@ public class StatusMessageTest {
byte version = 39;
byte netId = 0;
byte[] difficulty = new BigInteger("25c60144", 16).toByteArray();
byte[] bestHash = new BigInteger("832056d3c93ff2739ace7199952e5365aa29f18805be05634c4db125c5340216",16).toByteArray();
byte[] genesisHash = new BigInteger("955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb",16).toByteArray();
byte[] bestHash =
new BigInteger("832056d3c93ff2739ace7199952e5365aa29f18805be05634c4db125c5340216", 16).toByteArray();
byte[] genesisHash =
new BigInteger("955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb", 16).toByteArray();
StatusMessage statusMessage = new StatusMessage(version, netId, difficulty, bestHash, genesisHash);
logger.info(statusMessage.toString());
assertEquals(39, statusMessage.getProtocolVersion());
assertEquals("25c60144",
Hex.toHexString(statusMessage.getTotalDifficulty()));
assertEquals("25c60144", Hex.toHexString(statusMessage.getTotalDifficulty()));
assertEquals("00832056d3c93ff2739ace7199952e5365aa29f18805be05634c4db125c5340216",
Hex.toHexString(statusMessage.getBestHash()));
assertEquals("00955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb",
@ -70,12 +71,9 @@ public class StatusMessageTest {
logger.info(statusMessage.toString());
assertEquals(-1, statusMessage.getProtocolVersion());
assertEquals("ff000000",
Hex.toHexString(statusMessage.getTotalDifficulty()));
assertEquals("ff00000000000000000000000000",
Hex.toHexString(statusMessage.getBestHash()));
assertEquals("ff000000000000000000000000000000",
Hex.toHexString(statusMessage.getGenesisHash()));
assertEquals("ff000000", Hex.toHexString(statusMessage.getTotalDifficulty()));
assertEquals("ff00000000000000000000000000", Hex.toHexString(statusMessage.getBestHash()));
assertEquals("ff000000000000000000000000000000", Hex.toHexString(statusMessage.getGenesisHash()));
}
}