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

Cleanup Gradle Setup #164

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions artemis/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'java-library'

jar {
baseName 'artemis'
manifest {
Expand All @@ -14,6 +12,8 @@ dependencies {
implementation project(':ethereum:rlp')
implementation project(':pow')

api 'com.google.guava:guava:27.0.1-jre'

implementation 'com.google.guava:guava'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'info.picocli:picocli'
Expand All @@ -23,14 +23,11 @@ dependencies {
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.slf4j:slf4j-nop:1.7.25'

runtime 'org.apache.logging.log4j:log4j-core'
runtimeOnly 'org.apache.logging.log4j:log4j-core'

testImplementation 'com.squareup.okhttp3:okhttp'
testImplementation 'junit:junit'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.mockito:mockito-core'
api 'com.google.guava:guava:27.0.1-jre'

test {
testLogging.showStandardStreams = true
Expand Down
52 changes: 6 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ plugins {
id 'com.github.ben-manes.versions' version '0.20.0'
id 'com.github.hierynomus.license' version '0.15.0'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
id 'me.champeau.gradle.jmh' version '0.4.7' apply false
id 'net.ltgt.errorprone' version '0.6'
id 'net.ltgt.errorprone' version '0.6' apply false
id 'net.researchgate.release' version '2.7.0'
}

defaultTasks 'build','checkLicense'
defaultTasks 'build','checkLicenses'

def buildAliases = ['dev': [
'spotlessApply',
'build',
'checkLicense',
'checkLicenses',
'javadoc'
]]

Expand All @@ -26,26 +25,6 @@ gradle.startParameter.taskNames.each {
}
gradle.startParameter.taskNames = expandedTaskList.flatten()

// Gets a integer command argument, passed with -Pname=x, or the defaut if not provided.
def _intCmdArg(name, defaultValue) {
return project.hasProperty(name) ? project.property(name) as int : defaultValue
}

def _intCmdArg(name) {
return _intCmdArg(name, null)
}

def _strListCmdArg(name, defaultValue) {
if (!project.hasProperty(name))
return defaultValue

return ((String)project.property(name)).tokenize(',')
}

def _strListCmdArg(name) {
return _strListCmdArg(name, null)
}

def baseVersion = '1.0.0';
project.version = baseVersion + '-SNAPSHOT'

Expand Down Expand Up @@ -231,6 +210,9 @@ subprojects {
dependencies {
testImplementation sourceSets.testSupport.output
integrationTestImplementation sourceSets.testSupport.output

testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
}

task integrationTest(type: Test, dependsOn:["compileTestJava"]){
Expand All @@ -241,28 +223,6 @@ subprojects {
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}

if (file('src/jmh').directory) {
apply plugin: 'me.champeau.gradle.jmh'

jmh {
// Allows to control JMH execution directly from the command line. I typical execution may look
// like:
// gradle jmh -Pf=2 -Pwi=3 -Pi=5 -Pinclude=MyBench
// which will run 2 forks with 3 warmup iterations and 5 normal ones for each, and will only
// run the benchmark matching 'MyBench' (a regexp).
warmupForks = _intCmdArg('wf')
warmupIterations = _intCmdArg('wi')
fork = _intCmdArg('f')
iterations = _intCmdArg('i')
benchmarkMode = _strListCmdArg('bm')
include = _strListCmdArg('include', [''])
humanOutputFile = project.file("${project.buildDir}/reports/jmh/results.txt")
resultFormat = 'JSON'
}

dependencies { jmh 'org.apache.logging.log4j:log4j-api' }
}
}

jar { enabled = false }
Expand Down
7 changes: 0 additions & 7 deletions crypto/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'java-library'

jar {
baseName 'artemis-crypto'
manifest {
Expand All @@ -11,10 +9,5 @@ jar {
dependencies {
api project(':util')

api 'org.bouncycastle:bcprov-jdk15on'

implementation 'com.google.guava:guava'

testImplementation 'org.assertj:assertj-core'
testImplementation 'junit:junit'
}
1 change: 1 addition & 0 deletions crypto/src/main/java/tech/pegasys/artemis/crypto/Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import tech.pegasys.artemis.util.bytes.Bytes32;
import tech.pegasys.artemis.util.bytes.BytesValue;
import tech.pegasys.artemis.util.message.BouncyCastleMessageDigestFactory;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down
15 changes: 5 additions & 10 deletions errorprone-checks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
// See https://github.com/tbroyer/gradle-errorprone-plugin
// See https://github.com/tbroyer/gradle-apt-plugin
plugins { id 'net.ltgt.apt' version '0.19' apply false }
// TODO Determine if net.ltgt.apt is even necessary.

plugins {
id 'net.ltgt.apt' version '0.19'
}

// we use this config to get the path of the JDK 9 javac jar, to
// stick it in the bootclasspath when running tests
configurations.maybeCreate("epJavac")


apply plugin: 'java'
apply plugin: 'net.ltgt.errorprone'
apply plugin: 'net.ltgt.apt'

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {

implementation 'com.google.errorprone:error_prone_annotation'
implementation 'com.google.errorprone:error_prone_core'
implementation 'com.google.auto.service:auto-service'

annotationProcessor 'com.google.auto.service:auto-service'

testImplementation 'com.google.errorprone:error_prone_test_helpers'
testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'

epJavac 'com.google.errorprone:error_prone_check_api'
}
Expand Down
4 changes: 0 additions & 4 deletions ethereum/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'java-library'

jar {
baseName 'artemis-core'
manifest {
Expand All @@ -19,9 +17,7 @@ dependencies {

runtime 'org.apache.logging.log4j:log4j-core'

testImplementation 'org.assertj:assertj-core'
testImplementation 'org.mockito:mockito-core'
testImplementation 'junit:junit'

integrationTestImplementation 'org.assertj:assertj-core'
integrationTestImplementation 'org.mockito:mockito-core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.artemis.ethereum.vm;
package tech.pegasys.artemis.ethereum.core;

import tech.pegasys.artemis.ethereum.core.Address;
import tech.pegasys.artemis.util.bytes.BytesValue;

import org.junit.Assert;
Expand Down
47 changes: 43 additions & 4 deletions ethereum/rlp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'java-library'
plugins {
id 'me.champeau.gradle.jmh' version '0.4.7'
}

jar {
baseName 'artemis-ethereum-rlp'
Expand All @@ -14,10 +16,47 @@ dependencies {
implementation 'com.google.guava:guava'
implementation 'io.vertx:vertx-core'

compileOnly 'org.openjdk.jmh:jmh-generator-annprocess'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'

//Dependencies for JMH testing RLPBench
jmh project(':util')
compile 'org.openjdk.jmh:jmh-core'
}

testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'junit:junit'
//JMH Configuration Below

jmh {
// Allows to control JMH execution directly from the command line. I typical execution may look
// like:
// gradle jmh -Pf=2 -Pwi=3 -Pi=5 -Pinclude=MyBench
// which will run 2 forks with 3 warmup iterations and 5 normal ones for each, and will only
// run the benchmark matching 'MyBench' (a regexp).
warmupForks = _intCmdArg('wf')
warmupIterations = _intCmdArg('wi')
fork = _intCmdArg('f')
iterations = _intCmdArg('i')
benchmarkMode = _strListCmdArg('bm')
include = _strListCmdArg('include', [''])
humanOutputFile = project.file("${project.buildDir}/reports/jmh/results.txt")
resultFormat = 'JSON'
}

// Gets a integer command argument, passed with -Pname=x, or the defaut if not provided.
def _intCmdArg(name, defaultValue) {
return project.hasProperty(name) ? project.property(name) as int : defaultValue
}

def _intCmdArg(name) {
return _intCmdArg(name, null)
}

def _strListCmdArg(name, defaultValue) {
if (!project.hasProperty(name))
return defaultValue

return ((String)project.property(name)).tokenize(',')
}

def _strListCmdArg(name) {
return _strListCmdArg(name, null)
}
4 changes: 3 additions & 1 deletion gradle/check-licenses.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ downloadLicenses {
(group('org.glassfish.jersey.bundles.repackaged')): apache,
(group('org.glassfish.jersey.connectors')): apache,
//Explicitly declare EPL 2.0 for jnr-poxix - it is simultaneously licensed under 3 licenses.
'com.github.jnr:jnr-posix:3.0.33': epl2_0
'com.github.jnr:jnr-posix:3.0.33': epl2_0,
//JMH-Core is licensed under GPLv2 with the Classpath Exception, which allows us to link it and license the derived work under our license.
'org.openjdk.jmh:jmh-core:1.21': apache
]
}

Expand Down
1 change: 0 additions & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ dependencyManagement {
dependency 'org.mockito:mockito-core:2.23.4'

dependency 'org.openjdk.jmh:jmh-core:1.21'
dependency 'org.openjdk.jmh:jmh-generator-annprocess:1.21'

dependency 'org.rocksdb:rocksdbjni:5.15.10'

Expand Down
31 changes: 6 additions & 25 deletions pow/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
plugins {
id 'java'
}

apply plugin: 'java-library'

jar {
baseName 'artemis-pow'
manifest {
Expand All @@ -13,26 +7,13 @@ jar {
}

dependencies {
api 'org.bouncycastle:bcprov-jdk15on'
api 'io.reactivex:rxjava:1.2.4'
api 'com.squareup.okhttp3:okhttp:3.8.1'
api 'com.squareup.okhttp3:logging-interceptor:3.8.1'
api 'org.web3j:abi:3.6.0'
//TODO org.web3j.abi and org.web3j.cyprto are used by org.web3j.core. Given that, is it necessary to export all 3 as API dependencies, or will just org.web3j.core suffice?
api 'org.web3j:core:3.6.0'
api 'org.web3j:abi:3.6.0'
api 'org.web3j:crypto:3.6.0'
implementation 'com.google.guava:guava'

testImplementation 'org.assertj:assertj-core'
testImplementation 'junit:junit'
}
version '1.0.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'io.reactivex:rxjava:1.2.4'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
implementation 'com.google.guava:guava'
}
8 changes: 3 additions & 5 deletions util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'java-library'

jar {
baseName 'beaconchain-util'
manifest {
Expand All @@ -9,11 +7,11 @@ jar {
}

dependencies {
api 'org.bouncycastle:bcprov-jdk15on'

implementation 'com.google.guava:guava'
implementation 'io.vertx:vertx-core'
implementation 'io.netty:netty-common'
testImplementation project(":crypto")
testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'

testImplementation 'org.mockito:mockito-core'
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.artemis.crypto;
package tech.pegasys.artemis.util.message;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static tech.pegasys.artemis.util.bytes.BytesValue.wrap;
import static tech.pegasys.artemis.util.bytes.BytesValue.wrapBuffer;

import tech.pegasys.artemis.crypto.BouncyCastleMessageDigestFactory;
import tech.pegasys.artemis.util.message.BouncyCastleMessageDigestFactory;

import java.math.BigInteger;
import java.security.MessageDigest;
Expand Down