Skip to content

Commit

Permalink
Merge pull request #30 from ether-camp/with-release-1.4.x
Browse files Browse the repository at this point in the history
With release 1.4.x
  • Loading branch information
cupuyc committed Mar 15, 2017
2 parents dc82dae + d340036 commit 3bf8d7e
Show file tree
Hide file tree
Showing 38 changed files with 1,214 additions and 233 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -13,4 +13,6 @@ unsaved-data
walletstore
src/main/resources/solcJ-all

sampleDB*
sampleDB*

access.info
474 changes: 474 additions & 0 deletions EthereumHarmony.install4j

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -30,7 +30,7 @@ Ethereum network private peer. Based on EthereumJ implementation.
.

## Prerequisites Installed:
* Java 8
* Java 8 (64 bit)

.

Expand Down Expand Up @@ -59,13 +59,13 @@ JSON-RPC is available at `http://localhost:8080/rpc`

.


.


.

### Special thanks

Powered by [![multi-platform installer builder](https://www.ej-technologies.com/images/product_banners/install4j_medium.png)](https://www.ej-technologies.com/products/install4j/overview.html)

### License

Expand Down
89 changes: 71 additions & 18 deletions build.gradle
Expand Up @@ -47,6 +47,7 @@ buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE")
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4"
classpath "co.riiid:gradle-github-plugin:0.4.2" // github releases
}
}

Expand Down Expand Up @@ -81,7 +82,7 @@ dependencies {
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-websocket"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-devtools"
// compile "org.springframework.boot:spring-boot-devtools"

compile "org.hsqldb:hsqldb"
compile 'com.h2database:h2:1.4.191'
Expand All @@ -92,14 +93,16 @@ dependencies {
compile "org.ethereum:solcJ-all:0.4.8" // Solidity Compiler win/mac/linux binaries

// don't forget to adjust {ethereumJ.version} in application.properties
compile ("org.ethereum:ethereumj-core:1.4.1+") {
compile ("org.ethereum:ethereumj-core:1.4.2-RELEASE") {
changing = true

exclude group: "log4j"
exclude group: "org.slf4j", module: "log4j-over-slf4j"
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "org.ethereum", module: "solcJ-all"
}

compile "com.ethercamp:contract-data:1.3.3"
compile "com.ethercamp:contract-data:1.4.0"

compile "org.projectlombok:lombok:1.16.4"
compile "com.maxmind.geoip:geoip-api:1.3.1"
Expand Down Expand Up @@ -140,23 +143,30 @@ dependencies {
compile("org.webjars.bower:underscore:1.8.3")
compile("org.webjars.npm:bignumber.js:2.4.0")

// desktop GUI
compile group: 'com.dorkbox', name: 'SystemTray', version: '2.20'
compile group: 'org.codehaus.janino', name: 'janino', version: '3.0.6' // for having if-statement in logback.xml


testCompile "junit:junit"
testCompile "org.springframework:spring-test"
testCompile "org.springframework.boot:spring-boot-starter-test"
// compile group: 'org.springframework', name: 'spring-test', version: '2.5'
}

apply from: 'desktop.gradle'

mainClassName = 'com.ethercamp.harmony.Application'
def defaultJvmArgs = ["-server",
"-Xss32m",
"-Xss2M",
"-XX:+UseCompressedOops",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:-OmitStackTraceInFastThrow"]
applicationDefaultJvmArgs = []


task wrapper(type: Wrapper) {
gradleVersion = '2.3'
gradleVersion = '3.4'
}

task stage {
Expand Down Expand Up @@ -190,6 +200,10 @@ bootRun {
// println "After adding " + jvmArgs
}

bootRepackage {
excludeDevtools = true
}

springBoot {
mainClass = "com.ethercamp.harmony.Application"
}
Expand All @@ -211,30 +225,53 @@ sourceCompatibility=1.8
* Tasks for connecting to predefined networks.
* It is not possible to override task defined values from command line.
*/
task runMain << {
addJvmArgIfEmpty "sync.fast.enabled", "true"
addJvmArgIfEmpty "ethereumj.conf.res", "ethereumj.conf"
addJvmArgIfEmpty "database.name", "database"
addJvmArgIfEmpty "networkProfile", "main"
bootRunWithNetworkConfig('main', false)
task runMain() {
doLast {
addJvmArgIfEmpty "database.dir", getDatabaseDir("database")
addJvmArgIfEmpty "sync.fast.enabled", "true"
addJvmArgIfEmpty "ethereumj.conf.res", "ethereumj.conf"
addJvmArgIfEmpty "database.name", "database"
addJvmArgIfEmpty "networkProfile", "main"
bootRunWithNetworkConfig('main', false)
}
}

task runRopsten() {
doLast {
bootRunWithNetworkConfig('ropsten', true)
}
}

task runRopsten << { bootRunWithNetworkConfig('ropsten', true) }
task runTest() {
doLast {
bootRunWithNetworkConfig('test', true)
}
}

task runTest << { bootRunWithNetworkConfig('test') }
task runPrivate() {
doLast {
// change default max heap value for this task as it involves mining
maxHeapSize = "-Xmx3500M"

task runPrivate << {
// change default max heap value for this task as it involves mining
maxHeapSize = "-Xmx3500M"
bootRunWithNetworkConfig('private', true)
}
}

bootRunWithNetworkConfig('private', true)
task runClassic() {
doLast {
addJvmArgIfEmpty "sync.fast.enabled", "true"
bootRunWithNetworkConfig('classic', true)
}
}

task runClassic << { bootRunWithNetworkConfig('classic') }
def getDatabaseDir(String name) {
return System.getProperty("user.home") + "/ethereumj/" + name
}

def bootRunWithNetworkConfig(String name, boolean includePresets) {
def newArgs = []
if (includePresets) {
addJvmArgIfEmpty "database.dir", getDatabaseDir("database-" + name)
newArgs.addAll([
'-Dethereumj.conf.res=' + name + '.conf',
'-Ddatabase.name=database-' + name,
Expand Down Expand Up @@ -295,9 +332,25 @@ task importBlocks(type: JavaExec) {
systemProperties System.properties
systemProperty "logback.configurationFile", "src/main/resources/logback.xml"
systemProperty "peer.discovery.enabled", false
systemProperty "peer.listen.port", 0
systemProperty "sync.enabled", false
}


//
//tasks.processResources.doLast() {
// println 'This will be printed after the build task even if something else calls the build task'
//
// File versionfile = file(new File('build/resources/main/build-info.properties'))
// versionfile.text = [
//// 'build.hash=' + gitCommitHash(),
//// 'build.time=' + buildTime(),
//// 'build.branch=' + gitCurBranch(),
// 'build.number=' + getNextBuildNumber()
// ].join('\n')
//}





150 changes: 150 additions & 0 deletions desktop.gradle
@@ -0,0 +1,150 @@
/*
* Copyright 2015, 2016 Ether.Camp Inc. (US)
* This file is part of Ethereum Harmony.
*
* Ethereum Harmony is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Ethereum Harmony is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Ethereum Harmony. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Tasks:
* - desktop
* - githubRelease
*/

apply plugin: 'co.riiid.gradle' // upload to github releases

project.ext.productName = "EthereumHarmony"

project.ext.versionNameValue = "2.1";

project.ext.buildNumberFilePath = System.getProperty('user.home') + "/harmony.desktop.number.properties"

// Build number is zero for debug or incremented for release
project.ext.buildNumber = 0;

// pass via -PgithubToken=1234567890
def githubAccessToken = project.hasProperty('githubToken') ? project.property('githubToken') : System.getenv('githubToken')

// Increase version code if releasing binaries for QA or Production
if (project.gradle.startParameter.taskNames.indexOf('desktop') > -1) {
buildNumber = getNextBuildNumber()
}

// Check github token presence
if (project.gradle.startParameter.taskNames.indexOf('githubRelease') > -1) {
if (!githubAccessToken) {
throw new RuntimeException("Please set github access token via -PgithubToken=1234567890")
}
buildNumber = getCurrentBuildNumber()
println("Using github token " + githubAccessToken.substring(0, 6) + "...")
}

github {
baseUrl = "https://api.github.com"

owner = "ether-camp"
repo = "ethereum-harmony"
token = "$githubAccessToken"
tagName = "v${versionNameValue}b${buildNumber}"
name = "${productName} $versionNameValue Build $buildNumber"
draft = true
body = """
# Implemented:
...
"""
assets = getBinFileNames()
}

/**
* Create installers.
* Note: license must be set either in env variable or passed via `-PINSTALL4J_LICENSE=AAAAAAA`
*/
task desktop() {
doLast {
String license = project.hasProperty('INSTALL4J_LICENSE') ? project.property('INSTALL4J_LICENSE') : System.getenv('INSTALL4J_LICENSE')

if (license == null) {
throw new GradleException('License must be provided') // or remove it from command line
}

task unpackJar(type: Exec) {
workingDir "build/libs"
commandLine "jar", "xf", "harmony.ether.camp.jar"
}

task createInstaller(type: Exec) {
workingDir "."
commandLine "install4jc", "--license", license, "EthereumHarmony.install4j", "-r", (versionNameValue + '.' + buildNumber)
}

unpackJar.execute();
createInstaller.execute();

// rename to proper pattern
final versionNormal = "${versionNameValue}.${buildNumber}"
final versionUnderscored = versionNormal.replaceAll("\\.", "_")
getBinFileNames().each {
final String to = it;
final String from = to.replace(versionNormal, versionUnderscored)
new File(from).renameTo(new File(to))
}
}
}
desktop.dependsOn bootRepackage

def getBinFileNames() {
return ["build/${productName}-macos-${versionNameValue}.${buildNumber}.dmg",
"build/${productName}-windows-x64-${versionNameValue}.${buildNumber}.exe"]
}

def getNextBuildNumber() {
String key = 'build.number'

def props = new Properties()
int result = 0

File file = file(buildNumberFilePath)
if (file.exists()) {
file.withInputStream { props.load(it) }
if (props) {
result = Integer.parseInt(props[key]) + 1
}
}

ant.propertyfile(file: buildNumberFilePath) {
entry(key: key, value: result)
}

println('Next build number is ' + result + ' from ' + buildNumberFilePath)
return result
}

def getCurrentBuildNumber() {
String key = 'build.number'

def props = new Properties()
int buildNumber = 0

File file = file(buildNumberFilePath)
if (file.exists()) {
file.withInputStream { props.load(it) }
if (props) {
buildNumber = Integer.parseInt(props[key])
}
}

println('Current build number is ' + buildNumber + ' from ' + buildNumberFilePath)
return buildNumber
}

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Fri Aug 19 11:44:15 EEST 2016
#Wed Mar 08 12:19:36 EET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip

0 comments on commit 3bf8d7e

Please sign in to comment.