Skip to content

Commit 3bf8d7e

Browse files
authored
Merge pull request #30 from ether-camp/with-release-1.4.x
With release 1.4.x
2 parents dc82dae + d340036 commit 3bf8d7e

38 files changed

+1214
-233
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ unsaved-data
1313
walletstore
1414
src/main/resources/solcJ-all
1515

16-
sampleDB*
16+
sampleDB*
17+
18+
access.info

EthereumHarmony.install4j

Lines changed: 474 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Ethereum network private peer. Based on EthereumJ implementation.
3030
.
3131

3232
## Prerequisites Installed:
33-
* Java 8
33+
* Java 8 (64 bit)
3434

3535
.
3636

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

6060
.
6161

62-
6362
.
6463

65-
6664
.
6765

66+
### Special thanks
6867

68+
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)
6969

7070
### License
7171

build.gradle

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ buildscript {
4747
dependencies {
4848
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE")
4949
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4"
50+
classpath "co.riiid:gradle-github-plugin:0.4.2" // github releases
5051
}
5152
}
5253

@@ -81,7 +82,7 @@ dependencies {
8182
compile "org.springframework.boot:spring-boot-starter-actuator"
8283
compile "org.springframework.boot:spring-boot-starter-websocket"
8384
compile "org.springframework.boot:spring-boot-starter-data-jpa"
84-
compile "org.springframework.boot:spring-boot-devtools"
85+
// compile "org.springframework.boot:spring-boot-devtools"
8586

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

9495
// don't forget to adjust {ethereumJ.version} in application.properties
95-
compile ("org.ethereum:ethereumj-core:1.4.1+") {
96+
compile ("org.ethereum:ethereumj-core:1.4.2-RELEASE") {
97+
changing = true
98+
9699
exclude group: "log4j"
97100
exclude group: "org.slf4j", module: "log4j-over-slf4j"
98101
exclude group: "org.slf4j", module: "slf4j-log4j12"
99102
exclude group: "org.ethereum", module: "solcJ-all"
100103
}
101104

102-
compile "com.ethercamp:contract-data:1.3.3"
105+
compile "com.ethercamp:contract-data:1.4.0"
103106

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

146+
// desktop GUI
147+
compile group: 'com.dorkbox', name: 'SystemTray', version: '2.20'
148+
compile group: 'org.codehaus.janino', name: 'janino', version: '3.0.6' // for having if-statement in logback.xml
149+
150+
143151
testCompile "junit:junit"
144152
testCompile "org.springframework:spring-test"
145153
testCompile "org.springframework.boot:spring-boot-starter-test"
146154
// compile group: 'org.springframework', name: 'spring-test', version: '2.5'
147155
}
148156

157+
apply from: 'desktop.gradle'
158+
149159
mainClassName = 'com.ethercamp.harmony.Application'
150160
def defaultJvmArgs = ["-server",
151-
"-Xss32m",
161+
"-Xss2M",
152162
"-XX:+UseCompressedOops",
153163
"-XX:+HeapDumpOnOutOfMemoryError",
154164
"-XX:-OmitStackTraceInFastThrow"]
155165
applicationDefaultJvmArgs = []
156166

157167

158168
task wrapper(type: Wrapper) {
159-
gradleVersion = '2.3'
169+
gradleVersion = '3.4'
160170
}
161171

162172
task stage {
@@ -190,6 +200,10 @@ bootRun {
190200
// println "After adding " + jvmArgs
191201
}
192202

203+
bootRepackage {
204+
excludeDevtools = true
205+
}
206+
193207
springBoot {
194208
mainClass = "com.ethercamp.harmony.Application"
195209
}
@@ -211,30 +225,53 @@ sourceCompatibility=1.8
211225
* Tasks for connecting to predefined networks.
212226
* It is not possible to override task defined values from command line.
213227
*/
214-
task runMain << {
215-
addJvmArgIfEmpty "sync.fast.enabled", "true"
216-
addJvmArgIfEmpty "ethereumj.conf.res", "ethereumj.conf"
217-
addJvmArgIfEmpty "database.name", "database"
218-
addJvmArgIfEmpty "networkProfile", "main"
219-
bootRunWithNetworkConfig('main', false)
228+
task runMain() {
229+
doLast {
230+
addJvmArgIfEmpty "database.dir", getDatabaseDir("database")
231+
addJvmArgIfEmpty "sync.fast.enabled", "true"
232+
addJvmArgIfEmpty "ethereumj.conf.res", "ethereumj.conf"
233+
addJvmArgIfEmpty "database.name", "database"
234+
addJvmArgIfEmpty "networkProfile", "main"
235+
bootRunWithNetworkConfig('main', false)
236+
}
237+
}
238+
239+
task runRopsten() {
240+
doLast {
241+
bootRunWithNetworkConfig('ropsten', true)
242+
}
220243
}
221244

222-
task runRopsten << { bootRunWithNetworkConfig('ropsten', true) }
245+
task runTest() {
246+
doLast {
247+
bootRunWithNetworkConfig('test', true)
248+
}
249+
}
223250

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

226-
task runPrivate << {
227-
// change default max heap value for this task as it involves mining
228-
maxHeapSize = "-Xmx3500M"
256+
bootRunWithNetworkConfig('private', true)
257+
}
258+
}
229259

230-
bootRunWithNetworkConfig('private', true)
260+
task runClassic() {
261+
doLast {
262+
addJvmArgIfEmpty "sync.fast.enabled", "true"
263+
bootRunWithNetworkConfig('classic', true)
264+
}
231265
}
232266

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

235271
def bootRunWithNetworkConfig(String name, boolean includePresets) {
236272
def newArgs = []
237273
if (includePresets) {
274+
addJvmArgIfEmpty "database.dir", getDatabaseDir("database-" + name)
238275
newArgs.addAll([
239276
'-Dethereumj.conf.res=' + name + '.conf',
240277
'-Ddatabase.name=database-' + name,
@@ -295,9 +332,25 @@ task importBlocks(type: JavaExec) {
295332
systemProperties System.properties
296333
systemProperty "logback.configurationFile", "src/main/resources/logback.xml"
297334
systemProperty "peer.discovery.enabled", false
335+
systemProperty "peer.listen.port", 0
298336
systemProperty "sync.enabled", false
299337
}
300338

301339

340+
//
341+
//tasks.processResources.doLast() {
342+
// println 'This will be printed after the build task even if something else calls the build task'
343+
//
344+
// File versionfile = file(new File('build/resources/main/build-info.properties'))
345+
// versionfile.text = [
346+
//// 'build.hash=' + gitCommitHash(),
347+
//// 'build.time=' + buildTime(),
348+
//// 'build.branch=' + gitCurBranch(),
349+
// 'build.number=' + getNextBuildNumber()
350+
// ].join('\n')
351+
//}
352+
353+
354+
302355

303356

desktop.gradle

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
* Copyright 2015, 2016 Ether.Camp Inc. (US)
3+
* This file is part of Ethereum Harmony.
4+
*
5+
* Ethereum Harmony is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* Ethereum Harmony is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with Ethereum Harmony. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
/**
20+
* Tasks:
21+
* - desktop
22+
* - githubRelease
23+
*/
24+
25+
apply plugin: 'co.riiid.gradle' // upload to github releases
26+
27+
project.ext.productName = "EthereumHarmony"
28+
29+
project.ext.versionNameValue = "2.1";
30+
31+
project.ext.buildNumberFilePath = System.getProperty('user.home') + "/harmony.desktop.number.properties"
32+
33+
// Build number is zero for debug or incremented for release
34+
project.ext.buildNumber = 0;
35+
36+
// pass via -PgithubToken=1234567890
37+
def githubAccessToken = project.hasProperty('githubToken') ? project.property('githubToken') : System.getenv('githubToken')
38+
39+
// Increase version code if releasing binaries for QA or Production
40+
if (project.gradle.startParameter.taskNames.indexOf('desktop') > -1) {
41+
buildNumber = getNextBuildNumber()
42+
}
43+
44+
// Check github token presence
45+
if (project.gradle.startParameter.taskNames.indexOf('githubRelease') > -1) {
46+
if (!githubAccessToken) {
47+
throw new RuntimeException("Please set github access token via -PgithubToken=1234567890")
48+
}
49+
buildNumber = getCurrentBuildNumber()
50+
println("Using github token " + githubAccessToken.substring(0, 6) + "...")
51+
}
52+
53+
github {
54+
baseUrl = "https://api.github.com"
55+
56+
owner = "ether-camp"
57+
repo = "ethereum-harmony"
58+
token = "$githubAccessToken"
59+
tagName = "v${versionNameValue}b${buildNumber}"
60+
name = "${productName} $versionNameValue Build $buildNumber"
61+
draft = true
62+
body = """
63+
# Implemented:
64+
...
65+
"""
66+
assets = getBinFileNames()
67+
}
68+
69+
/**
70+
* Create installers.
71+
* Note: license must be set either in env variable or passed via `-PINSTALL4J_LICENSE=AAAAAAA`
72+
*/
73+
task desktop() {
74+
doLast {
75+
String license = project.hasProperty('INSTALL4J_LICENSE') ? project.property('INSTALL4J_LICENSE') : System.getenv('INSTALL4J_LICENSE')
76+
77+
if (license == null) {
78+
throw new GradleException('License must be provided') // or remove it from command line
79+
}
80+
81+
task unpackJar(type: Exec) {
82+
workingDir "build/libs"
83+
commandLine "jar", "xf", "harmony.ether.camp.jar"
84+
}
85+
86+
task createInstaller(type: Exec) {
87+
workingDir "."
88+
commandLine "install4jc", "--license", license, "EthereumHarmony.install4j", "-r", (versionNameValue + '.' + buildNumber)
89+
}
90+
91+
unpackJar.execute();
92+
createInstaller.execute();
93+
94+
// rename to proper pattern
95+
final versionNormal = "${versionNameValue}.${buildNumber}"
96+
final versionUnderscored = versionNormal.replaceAll("\\.", "_")
97+
getBinFileNames().each {
98+
final String to = it;
99+
final String from = to.replace(versionNormal, versionUnderscored)
100+
new File(from).renameTo(new File(to))
101+
}
102+
}
103+
}
104+
desktop.dependsOn bootRepackage
105+
106+
def getBinFileNames() {
107+
return ["build/${productName}-macos-${versionNameValue}.${buildNumber}.dmg",
108+
"build/${productName}-windows-x64-${versionNameValue}.${buildNumber}.exe"]
109+
}
110+
111+
def getNextBuildNumber() {
112+
String key = 'build.number'
113+
114+
def props = new Properties()
115+
int result = 0
116+
117+
File file = file(buildNumberFilePath)
118+
if (file.exists()) {
119+
file.withInputStream { props.load(it) }
120+
if (props) {
121+
result = Integer.parseInt(props[key]) + 1
122+
}
123+
}
124+
125+
ant.propertyfile(file: buildNumberFilePath) {
126+
entry(key: key, value: result)
127+
}
128+
129+
println('Next build number is ' + result + ' from ' + buildNumberFilePath)
130+
return result
131+
}
132+
133+
def getCurrentBuildNumber() {
134+
String key = 'build.number'
135+
136+
def props = new Properties()
137+
int buildNumber = 0
138+
139+
File file = file(buildNumberFilePath)
140+
if (file.exists()) {
141+
file.withInputStream { props.load(it) }
142+
if (props) {
143+
buildNumber = Integer.parseInt(props[key])
144+
}
145+
}
146+
147+
println('Current build number is ' + buildNumber + ' from ' + buildNumberFilePath)
148+
return buildNumber
149+
}
150+

gradle/wrapper/gradle-wrapper.jar

1.89 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Aug 19 11:44:15 EEST 2016
1+
#Wed Mar 08 12:19:36 EET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip

0 commit comments

Comments
 (0)