Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-module build #388

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ java -jar ethereumj-core/build/libs/ethereumj-core-*-all.jar
```
> git clone https://github.com/ethereum/ethereumj
> cd ethereumj
> ./gradlew run [-PmainClass=<sample class>]
> ./gradlew ethereumj-cli:run
```

##### Optional samples to try:
```
./gradlew run -PmainClass=org.ethereum.samples.BasicSample
./gradlew run -PmainClass=org.ethereum.samples.FollowAccount
./gradlew run -PmainClass=org.ethereum.samples.PendingStateSample
./gradlew run -PmainClass=org.ethereum.samples.PriceFeedSample
./gradlew run -PmainClass=org.ethereum.samples.PrivateMinerSample
./gradlew run -PmainClass=org.ethereum.samples.TestNetSample
./gradlew run -PmainClass=org.ethereum.samples.TransactionBomb
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.BasicSample
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.FollowAccount
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.PendingStateSample
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.PriceFeedSample
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.PrivateMinerSample
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.TestNetSample
./gradlew ethereumj-samples:run -PmainClass=org.ethereum.samples.TransactionBomb
```

##### Importing project to IntelliJ IDEA:
Expand Down
72 changes: 56 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
wrapper.gradleVersion = '2.2.1'

buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/plugins-release-local' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}

allprojects {
apply plugin: 'eclipse'
apply plugin: 'propdeps-maven'

if (JavaVersion.current().isJava8Compatible()) {
//Disable lint of javadoc until someone fixes all the html
tasks.withType(Javadoc) {
Expand All @@ -10,31 +21,60 @@ allprojects {
}
}

def gitCurBranch() {
def branchName = System.getenv('TRAVIS_BRANCH')

if (branchName) return branchName
def process = "git rev-parse --abbrev-ref HEAD".execute()
return process.text.trim()
}

subprojects {
apply plugin: 'java'

def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())

group = 'org.ethereum'

version = config.versionNumber + ("master" == gitCurBranch() ? "-RELEASE" : "-SNAPSHOT")
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7

println("Building version: " + version + " (from branch " + gitCurBranch() + ")")

compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs << '-XDignore.symbol.file'
options.encoding = 'UTF-8'
options.compilerArgs << '-XDignore.symbol.file'
}

compileTestJava.options.encoding = 'UTF-8'

repositories {
jcenter()
maven {
url "http://dl.bintray.com/ethereum/maven"
}
}
}

ext {
slf4jVersion = '1.7.7'
leveldbVersion = '0.7'
scastleVersion = '1.51.0.0'
log4jVersion = '1.2.17'
springVersion = '4.2.0.RELEASE'
hibernateVersion = '4.3.7.Final'
junitVersion = '4.11'
}

project(':ethereumj-core') {
}

project(':ethereumj-cli') {
dependencies {
compile project(':ethereumj-core')
}
}

project(':ethereumj-samples') {
dependencies {
compile project(':ethereumj-core')
}
}

project(':ethereumj-tck') {
dependencies {
compile project(':ethereumj-core')
}
}

task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
21 changes: 21 additions & 0 deletions ethereumj-cli/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

plugins {
id 'application'
}


dependencies {

compile "log4j:log4j:${log4jVersion}"
compile "org.slf4j:slf4j-log4j12:${slf4jVersion}"
compile "log4j:apache-log4j-extras:${log4jVersion}"

optional "commons-logging:commons-logging:1.0"
optional "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
}


mainClassName = 'org.ethereum.Start'
applicationDefaultJvmArgs = ["-server", "-Xss32m", "-XX:-OmitStackTraceInFastThrow"]

apply from: "${rootProject.projectDir}/gradle/networkRunTasks.gradle"
42 changes: 42 additions & 0 deletions ethereumj-cli/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Root logger option
log4j.rootLogger=DEBUG, stdout, file

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss.SSS} %p [%c{1}] %m%n
log4j.appender.stdout.Threshold=INFO

log4j.appender.file=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.file.file=./logs/ethereum.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern= %d{HH:mm:ss.SSS} %p [%c{1}] %m%n
log4j.appender.file.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
log4j.appender.file.RollingPolicy.FileNamePattern=./logs/ethereum_%d{yyyy-MM-dd}_h%d{HH}.log
log4j.appender.file.Threshold=TRACE

# filter noisy classes
log4j.logger.general = DEBUG
log4j.logger.net = DEBUG
log4j.logger.wire = ERROR
log4j.logger.discover = DEBUG
log4j.logger.db = DEBUG
log4j.logger.sync = TRACE
log4j.logger.blockqueue = DEBUG
log4j.logger.repository = INFO
log4j.logger.blockchain = INFO
log4j.logger.mine = DEBUG
log4j.logger.VM = ERROR
log4j.logger.trie = ERROR
log4j.logger.state = WARN
log4j.logger.execute = ERROR
log4j.logger.rlp = ERROR

log4j.logger.TCK-Test = ERROR

log4j.logger.java.nio = ERROR
log4j.logger.io.netty = ERROR
log4j.logger.org.springframework = ERROR
log4j.logger.org.hibernate = ERROR
log4j.logger.hsqldb.db = ERROR
75 changes: 4 additions & 71 deletions ethereumj-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,26 @@
import java.text.SimpleDateFormat

buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/plugins-release-local' }
}
dependencies {
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 'com.github.johnrengelman.shadow' version '1.2.0'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'com.github.kt3k.coveralls' version '2.0.1x'
id 'com.jfrog.bintray' version '1.0'
}

apply plugin: 'propdeps-maven'
apply plugin: 'com.jfrog.artifactory-upload'


repositories {
maven {
url "http://dl.bintray.com/ethereum/maven"
}
}

sourceCompatibility = 1.7

mainClassName = 'org.ethereum.Start'
applicationDefaultJvmArgs = ["-server", "-Xss32m", "-XX:-OmitStackTraceInFastThrow"]
if (project.hasProperty("mainClass")) {
mainClassName = mainClass
}
def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())

version = config.versionNumber + ("master" == gitCurBranch() ? "-RELEASE" : "-SNAPSHOT")

ext.generatedSrcDir = file('src/gen/java')

Expand All @@ -47,42 +31,6 @@ tasks.withType(JavaCompile){
options.warnings = false
}

task runMorden (type: JavaExec) {
main = mainClassName
classpath = sourceSets.main.runtimeClasspath
jvmArgs = applicationDefaultJvmArgs + '-Dethereumj.conf.res=morden.conf'
}

task runTest (type: JavaExec) {
main = mainClassName
classpath = sourceSets.main.runtimeClasspath
jvmArgs = applicationDefaultJvmArgs + '-Dethereumj.conf.res=test.conf'
}

/**
* This is TCK test command line option,
* to run the test:
* gradle tckRun -PfilePath=[ file path]
* e.g: gradle tckRun -PfilePath=E:\temp\test-case.json
*/
task tckRun(type:JavaExec){

if (project.hasProperty("filePath")) {
args = ["filerun", "$filePath"]
jvmArgs = ["-Xss32M"]
}

if (project.hasProperty("content")) {
args = ["content", "$content"]
jvmArgs = ["-Xss32M"]
}

main = "org.ethereum.tck.RunTck"
classpath = sourceSets.main.runtimeClasspath
}



test {

beforeTest { descriptor ->
Expand All @@ -99,16 +47,6 @@ test {
systemProperty "file.encoding", "UTF-8"
}

ext {
slf4jVersion = '1.7.7'
leveldbVersion = '0.7'
scastleVersion = '1.51.0.0'
log4jVersion = '1.2.17'
springVersion = '4.2.0.RELEASE'
hibernateVersion = '4.3.7.Final'
junitVersion = '4.11'
}

dependencies {
compile "io.netty:netty-all:4.0.30.Final"
compile "com.madgag.spongycastle:core:${scastleVersion}" // for SHA3 and SECP256K1
Expand All @@ -122,7 +60,6 @@ dependencies {
compile "com.cedarsoftware:java-util:1.8.0" // for deep equals
compile "org.javassist:javassist:3.15.0-GA"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
compile "log4j:log4j:${log4jVersion}"
compile "org.codehaus.jackson:jackson-mapper-asl:1.9.13"
compile "com.google.code.findbugs:jsr305:3.0.0"
compile "com.fasterxml.jackson.core:jackson-databind:2.5.1"
Expand All @@ -141,14 +78,10 @@ dependencies {

compile "org.mapdb:mapdb:2.0-beta12"

compile "org.slf4j:slf4j-log4j12:${slf4jVersion}"
compile "log4j:apache-log4j-extras:${log4jVersion}"

compile("com.googlecode.json-simple:json-simple:1.1.1") {
exclude group: 'junit', module: 'junit'
}
optional "commons-logging:commons-logging:1.0"
optional "org.slf4j:jcl-over-slf4j:${slf4jVersion}"

testCompile "junit:junit:${junitVersion}"
testCompile "org.springframework:spring-test:${springVersion}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.ethereum.manager.AdminInfo;
import org.ethereum.trie.Trie;
import org.ethereum.trie.TrieImpl;
import org.ethereum.util.AdvancedDeviceUtils;
import org.ethereum.util.ByteUtil;
import org.ethereum.util.RLP;
import org.ethereum.validator.DependentBlockHeaderRule;
Expand Down Expand Up @@ -485,10 +484,6 @@ public synchronized boolean add(Block block) {
if (!Arrays.equals(bestBlock.getHash(),
block.getParentHash())) return false;

if (block.getNumber() >= config.traceStartBlock() && config.traceStartBlock() != -1) {
AdvancedDeviceUtils.adjustDetailedTracing(block.getNumber());
}

List<TransactionReceipt> receipts = processBlock(block);

// Sanity checks
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.ethereum.net.shh;

import org.ethereum.Start;
import org.ethereum.crypto.ECKey;
import org.ethereum.util.RLP;
import org.junit.Test;
Expand Down

This file was deleted.