Port build from Maven to Gradle

This commit is contained in:
Chris Beams 2014-12-26 14:23:44 +01:00
parent a63f6445cc
commit 996e98d5cc
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
4 changed files with 100 additions and 478 deletions

18
.gitignore vendored
View File

@ -1,10 +1,14 @@
# local credentials
credentials.properties
# Java
*.class
# Vim
*.sw[op]
# Intellij
# Gradle
.gradle
build
# IDEA
.idea/
*.iml
*.iws
@ -19,12 +23,6 @@ credentials.properties
log/
target/
# Package Files #
*.zip
*.jar
*.war
*.ear
# Output #
*/logs
*/dmp
@ -34,4 +32,4 @@ target/
*/src/main/java/sample
# Mac
.DS_Store
.DS_Store

View File

@ -1,32 +1,31 @@
The core library API for Ethereum project can be included
into any other Java/Scala project by simple maven
script include:
## ethereum-core
```
<dependency>
<groupId>org.ethereum</groupId>
<artifactId>ethereumj</artifactId>
<version>0.5.7</version>
<type>jar</type>
</dependency>
```
### Include ethereum-core in your project
1. Add http://dl.bintray.com/ethereum/maven as a repository to your build script
2. Add a dependency on `org.ethereum:ethereumj:$version`, where `$version` is one of those listed at https://bintray.com/ethereum/maven/org.ethereum/view
EthereumJ release repository can be found here:
* https://bintray.com/ethereum/maven/org.ethereum/view
### Examples
See [ethereumj-studio](../ethereumj-studio).
The showcase for ethereumj-core usage can be found in [ethereumj-studio](../ethereumj-studio)
### Build from source
###### :small_blue_diamond: Build instructions (maven)
1. build_1: [no test run] , [released to local repository] : ~> ` mvn clean install -Dmaven.test.skip=true `
2. build_2: [include test run] , [released to local repository] : ~> ` mvn clean install `
#### Compile, test and package
###### :small_blue_diamond: release instructions (ant) (!) credential required
1. ` mvn install ` - which release the lib to a local repositroy
2. after the release - ` ant -f bintray-publish-version.xml `
Run `./gradlew build`.
- find jar artifacts at `build/libs`
- find unit test and code coverage reports at `build/reports`
#### Run an ethereum node
- run `./gradlew run`, or
- build a standalone executable jar with `./gradlew shadow` and execute the `-all` jar in `build/libs` using `java -jar [jarfile]`.
#### Publish ethereumj-core builds
_TODO: integrate bintray gradle plugin_

View File

@ -0,0 +1,73 @@
plugins {
id 'application'
id 'eclipse'
id 'jacoco'
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'
}
wrapper.gradleVersion = '2.2.1'
sourceCompatibility = 1.7
version = '0.7.15-SNAPSHOT'
mainClassName = 'org.ethereum.Start'
compileJava.dependsOn antlr4
sourceSets.main.java.srcDirs += antlr4.output
configurations {
compile.extendsFrom antlr4
}
antlr4 {
extraArgs=['-package', 'org.ethereum.serpent']
}
ext {
slf4jVersion = '1.7.7'
leveldbVersion = '0.7'
scastleVersion = '1.51.0.0'
log4jVersion = '1.2.17'
springVersion = '4.1.2.RELEASE'
hibernateVersion = '4.3.7.Final'
junitVersion = '4.11'
}
repositories {
jcenter()
}
dependencies {
compile "io.netty:netty-all:4.0.23.Final"
compile "com.madgag.spongycastle:core:${scastleVersion}" // for SHA3 and SECP256K1
compile "org.iq80.leveldb:leveldb:${leveldbVersion}"
compile "com.cedarsoftware:java-util:1.8.0" // for deep equals
compile "org.antlr:antlr4-runtime:4.3" // for serpent compilation
compile "org.antlr:antlr4-maven-plugin:4.3"
compile "com.yuvalshavit:antlr-denter:1.1"
compile "org.javassist:javassist:3.15.0-GA"
compile "commons-logging:commons-logging:1.0" // TODO: provided scope
compile "org.slf4j:slf4j-api:${slf4jVersion}"
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}" // TODO: runtime scope
compile "org.slf4j:slf4j-log4j12:${slf4jVersion}" // TODO: runtime scope
compile "log4j:log4j:${log4jVersion}"
compile "log4j:apache-log4j-extras:${log4jVersion}"
compile "com.googlecode.json-simple:json-simple:1.1.1"
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.2.0"
compile "org.apache.commons:commons-collections4:4.0"
compile "org.springframework:spring-context:${springVersion}"
compile "org.springframework:spring-tx:${springVersion}"
compile "org.springframework:spring-orm:${springVersion}"
compile "org.hsqldb:hsqldb:1.8.0.10" // best performance - do not upgrade!
compile "org.hibernate:hibernate-core:${hibernateVersion}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVersion}"
compile "commons-dbcp:commons-dbcp:1.4"
testCompile "junit:junit:${junitVersion}"
testCompile "org.springframework:spring-test:${springVersion}"
}

View File

@ -1,448 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ethereum</groupId>
<artifactId>ethereumj</artifactId>
<packaging>jar</packaging>
<version>0.7.14</version>
<name>EthereumJ</name>
<url>http://www.ethereumj.org</url>
<!--
* Install jar with sources to the local maven repository
mvn install -Dmaven.test.skip=true
* To generate source for ANTLR parser/lexer
mvn antlr4:antlr4
-->
<developers>
<developer>
<name>Roman Mandeleil</name>
</developer>
<developer>
<name>Nick Savers</name>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/ethereum/ethereumj.git</connection>
<developerConnection>scm:git:ssh://git@github.com/ethereum/ethereumj.git</developerConnection>
<url>https://github.com/ethereum/ethereumj</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Third-party dependencies -->
<junit.version>4.11</junit.version>
<slf4j.version>1.7.7</slf4j.version>
<leveldb.version>0.7</leveldb.version>
<spongycastle.version>1.51.0.0</spongycastle.version>
<generated.sourceDirectory>gen</generated.sourceDirectory>
<github.global.server>github</github.global.server>
</properties>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.23.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Spongy Castle for SHA3 and SECP256K1 -->
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>core</artifactId>
<version>${spongycastle.version}</version>
</dependency>
<dependency>
<groupId>org.iq80.leveldb</groupId>
<artifactId>leveldb</artifactId>
<version>${leveldb.version}</version>
</dependency>
<!-- Added Cedarsoft for DeepEquals function -->
<dependency>
<groupId>com.cedarsoftware</groupId>
<artifactId>java-util</artifactId>
<version>1.8.0</version>
</dependency>
<!-- For Serpent compile -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.15.0-GA</version>
</dependency>
<!-- remove the real commons-logging from classpath -->
<dependency>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!-- add slf4j interfaces to classpath -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>compile</scope>
</dependency>
<!-- add commons logging to slf4j bridge to classpath -->
<!-- acts as jcl but routes commons-logging calls to slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- add log4j binding to classpath -->
<!-- routes slf4j calls to log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- add log4j to classpath -->
<!-- does the logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.yuvalshavit</groupId>
<artifactId>antlr-denter</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.1.2.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.2.RELEASE</version>
</dependency>
<dependency> <!-- !*! BEST PERFORMANCE EVER DO NOT UPGRADE !*! -->
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency> <!-- !*! BEST PERFORMANCE EVER DO NOT UPGRADE !*! -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.7.Final</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/system.properties</file>
<replacements>
<replacement>
<token>PROJECT.VERSION</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.ethereum.Start</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>2.2.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>org/ethereum/gui/**/*.class</exclude>
<exclude>org/ethereum/**/*Test.class</exclude>
</excludes>
</configuration>
</plugin>
<!--
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<property name="maven.project.artifactId" value="${project.artifactId}"/>
<property name="maven.project.version" value="${project.version}"/>
<ant antfile="build-post-package.xml" target="run"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.3</version>
<configuration>
<listener>true</listener>
<visitor>true</visitor>
</configuration>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<versionRange>[0.7.1.201405082137,)</versionRange>
<goals>
<goal>prepare-agent</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>