Commit Graph

600 Commits

Author SHA1 Message Date
Manfred Karrer
46a56e4e4f Update to BitcoinJ 0.12.2 2014-11-17 18:57:58 +01:00
Manfred Karrer
f6d6f80a64 Update to lastest TomP2P master 2014-11-17 17:40:22 +01:00
Manfred Karrer
9a010a1a4d Update to latest master 2014-11-14 01:34:44 +01:00
Chris Beams
75b7482bf1
Polish formatting 2014-11-12 11:15:28 +01:00
Chris Beams
6c36b2fa46
Add 'appJar' and 'bootstapNodeJar' tasks to build
The build now exposes two explicit ShadowJar tasks: one for the main
JavaFX client (`appJar`) and one for the headless bootstrap node
(`bootstrapNodeJar`).

Run as follows:

    ./gradlew appJar
    -- or --
    ./gradlew bootstrapNodeJar

The resulting executable jar for each will be found in the `build/libs`
directory.

Thanks to @johnrengleman for his help at johnrengelman/shadow#108

Resolves #265
Resolves #252
2014-11-11 23:53:32 +01:00
Chris Beams
9adc41e23f
Introduce 'app.version' property and remove hardcoded version 2014-11-11 22:55:33 +01:00
Chris Beams
0136ea2884
Polish and test BitsquareEnvironment
- Introduce a test-time dependency on spring-test module for access to
   MockPropertySource and friends.

 - Add BitsquareEnvironmentTests and test that property source precedence
   works as expected, i.e. that properties supplied on the command line
   have highest precedence, overriding those picked up via environment
   variables, system properties, the bitsquare.properties file or any of
   the other available property sources.
2014-11-11 19:29:26 +01:00
Chris Beams
2b3c22d382
Merge branch 'wip-cbeams'
* wip-cbeams:
  Overhaul property management and main class infrastructure

Conflicts:
	build.gradle
2014-11-11 04:28:14 +01:00
Chris Beams
acf44128b2
Overhaul property management and main class infrastructure
Use of the Spring Environment
-----------------------------

This change replaces the use of the argparse4j library and basic
Properties objects with the Spring Framework's Environment abstraction.
The Environment allows for managing any number of 'property sources' in
a hierarchical fashion, such that a call to
`environment.getProperty("someKey")` iterates through an ordered set of
property sources, returning the first value associated with the given
key.

BitsquareEnvironment, introduced in this commit, eliminates the
functionality previously present in ConfigLoader, modeling the
bitsquare.conf and bitsquare.properties files as Spring Resource
objects, and in turn creating ResourcePropertySources out of them. These
custom property sources are combined with standard property sources
based on system environment variables and Java system properties as well
as a property source based on the command-line arguments passed to a
Bitsquare application to form a unified, one-stop configuration
hierarchy.

For example, let's say a Bitsquare user wishes to customize the port
that his Bitsquare application listens on. The simplest approach
(assuming the user is comfortable with the command line), would be the
following:

    java -jar bitsquare.jar --port=1234

where '1234' is the custom port of choice. This is convenient enough for
one-off experimentation, but if the user wishes to make this a permanent
arrangement, he may want to add a `port=1234` entry to his
{bitsquare_app_dir}/bitsquare.conf file.

Alternatively, the user may wish to specify the port value as an
environment variable, e.g.:

    PORT=1234 java -jar bitsquare.jar

or with a JVM system property, e.g.:

    java -jar -DPORT=1234 bitsquare.jar

With BitsquareEnvironment, and its customized set of PropertySources in
place, the value of the port property may be specified in any of the
ways described above, and it is all handled in a unified way.

Restructuring of *Main classes
------------------------------

This commit also introduces significant changes to the structure of
executable Bitsquare applications. For example, prior to this change,
the io.bitsquare.app.gui.Main class was responsible for being both a
JavaFX Application and a standard Java main class.

Now, however, these concerns have been renamed and separated.
BitsquareApp is the JavaFX Application, and BitsquareAppMain is the Java
main class. Likewise, BootstrapNode has been broken out into
BootstrapNode and BootstrapNodeMain.

A common base class for the *Main classes has been extracted, named
BitsquareExecutable, which creates a template for option parsing,
environment creation, and ultimately application execution that applies
both to the BootstrapNode and BitsquareApp cases.

Improved help text
------------------

With the removal of argparse4j and the introduction of JOpt for argument
parsing, the application's help text has been improved. Use --help to
display this text, where you'll see information about default values,
etc. To do this easily from the Gradle build, run any of the following
commands:

    # Display help text
    ./gradlew run -Pargs="--help"

    # Qualify the application name as "Bitsquare-Alice"
    ./gradlew run -Pargs="--appName=Alice"

    # Customize the port
    ./gradlew run -Pargs="--port=7377"

Renaming of FatalException
--------------------------

Finally, the exception formerly known as io.bitsquare.gui.FatalException
has been moved up a package and generalized to
io.bitsquare.BitsquareException, as it is now used more widely.
2014-11-11 04:20:48 +01:00
Manfred Karrer
78a09d874d Update TomP2P aa0c736 2014-11-11 00:01:53 +01:00
Chris Beams
20db54e87b
Remove Akka-based seed node infrastructure (for now)
In favor of using the simplified app.cli.SeedNode class while we
continue to debug basic UPnP functionality.
2014-11-10 00:44:17 +01:00
Chris Beams
dfbe6973e7
Split Gradle arguments on comma vs. spaces
Prior to this commit, Gradle was configured to take a -Pargs property
and split the value on whitespace, passing the result to the Gradle
application plugin's 'args' property, for example:

    gradle run -Pargs="--id=foo --ip=1.1.1.1 --port=10001"

While this approach works fine when passing a single argument (i.e. when
no space delimiters are required), when multiple arguments are passed,
such as in the example above, it would result in the following error
from Gradle's own command line parser:

    Unknown command-line option '--ip'

This commit simply splits the value of -Pargs on commas rather than
spaces, meaning that now multiple -Pargs values should be supplied as
follows:

    gradle run -Pargs="--id=foo,--ip=1.1.1.1,--port=10001"

Resolves #264
2014-11-09 23:09:15 +01:00
Manfred Karrer
5d5fd49a45 Update to latest TomP2P master 2014-11-09 13:48:24 +01:00
Manfred Karrer
232a208a03 Revert to 0.12 as 0.12.1 has changes in the Coin class 2014-11-07 17:28:59 +01:00
Manfred Karrer
182218612e Update to bitcoinJ 12.1 2014-11-07 16:04:56 +01:00
Manfred Karrer
7faff2d244 Use latest TomP2P verison 2014-11-06 16:41:22 +01:00
Chris Beams
a969b415b4
Rename io.bitsquare.{BitsquareUI=>app.gui.Main} 2014-11-05 01:13:26 +01:00
Chris Beams
f6368754b9
Begin separation of JavaFX GUI and seed node CLI 2014-11-05 01:13:25 +01:00
Manfred Karrer
8731194921 Merge remote-tracking branch 'origin/master' 2014-11-05 00:28:17 +01:00
Manfred Karrer
74baf63763 Update to latest master 2014-11-05 00:28:05 +01:00
Chris Beams
43cf337fe4
Support code coverage using JaCoCo and Coveralls
The Gradle build now supports generating code coverage reports using
JaCoCo. The reports can be run with:

    ./gradle jacocoTestReport

and then view the HTML output at:

    build/reports/jacoco/test/html/index.html

The bitsquare repository has now also been registered with a (free)
account at http://coveralls.io. Our Travis CI configuration has been
updated to publish JaCoCo XML test report data to coveralls.io, which
results in the reports found at:

 - https://coveralls.io/r/bitsquare/bitsquare

For more information on the JaCoCo and Coveralls Gradle plugins, see:

 - http://www.gradle.org/docs/current/userguide/jacoco_plugin.html
 - https://github.com/kt3k/coveralls-gradle-plugin
2014-11-03 13:56:14 +01:00
Manfred Karrer
5ef1df11b2 Update to verison 91276e8 2014-11-01 14:27:21 +01:00
Manfred Karrer
137cf1ca82 Use new TomP2P build 3784b7a 2014-10-31 18:13:33 +01:00
Chris Beams
311e15c0e5
Remove Mockito dependency for now
Mockito was causing conflicts with JUnit's use of the Hamcrest library
and its Matchers. Sort this out when Mockito is actually needed.
2014-10-30 16:50:51 +01:00
Chris Beams
cbdd60631c
Introduce dependency on eu.hansolo.enzo:Enzo:0.1.5
Remove manually-copied classes and resources in favor of depending on the
latest released Enzo distribution.
2014-10-30 15:52:20 +01:00
Chris Beams
88951d71b8
Capitalize 'Bitsquare' consistently 2014-10-30 15:52:19 +01:00
Chris Beams
1323e77608
Support generation of native installer binaries
Use `./gradlew run` to build and run Bitsquare directly.

Use `./gradlew shadowJar` to generate a portable, executable jar.

Use `./gradlew packageNative` to generate an installer binary specific
to the platform you are running on.

In the case of Windows, it is necessary to copy the two .dll files in
the `package/` directory to the directory where Bitsquare.exe is
ultimately installed.

Resolves #243
2014-10-28 15:44:21 +01:00
Manfred Karrer
9c8b76d2b6 Update to latest TomP2P master 2014-10-27 15:09:52 +01:00
Manfred Karrer
ec2301c6ab Update to lasted TomP2P head 2014-10-24 21:50:51 +02:00
Steve Myers
3d77cc7296 added application plugin and ability to pass gradle run command line args 2014-10-19 18:30:41 -07:00
Manfred Karrer
e42bae9148 Update to latest TomP2P master 2014-10-19 15:17:17 +02:00
Chris Beams
b254ad234a
Upgrade to new TomP2P snapshot 2014-10-14 22:32:10 +02:00
Chris Beams
f135873f58
Enable Gradle Eclipse project metadata generation
This commit applies the 'eclipse' Gradle plugin, such that .classpath,
.project and .settings files can be generated using:

    ./gradlew eclipse

Once the above is complete, import the project into Eclipse with the
following command:

    File->Import->Existing projects into workspace

The .gitignore file has been updated accordingly.

Resolves #222
2014-10-13 12:02:43 +02:00
Chris Beams
5f53fea190
Remove use of Gradle JavaFX plugin
As documented at [1], version 8.1.1 of the Gradle JavaFX plugin has
disappeared from bintray. This causes Travis CI build failures. Version
8.1.0 is still in place [2], but downgrading to it causes further build
errors.

This commit removes use of the plugin entirely in order to fix the CI
problem immediately. In the meantime, the Bitsquare UI must be launched
directly from within IDEA.

Resolves #221
See #66

[1]: https://bitbucket.org/shemnon/javafx-gradle/issue/46/received-status-code-401-from-server
[2]: http://dl.bintray.com/content/shemnon/javafx-gradle/org/bitbucket/shemnon/javafxplugin/gradle-javafx-plugin/
2014-10-13 11:13:43 +02:00
Steve Myers
f8b9408514 Merged seedpeer branch with master branch
Conflicts:
	src/main/java/io/bitsquare/BitSquare.java
	src/main/java/io/bitsquare/gui/main/MainModel.java
2014-10-12 13:07:28 -07:00
Chris Beams
db663db007
Remove obsolete 'apply plugin' Gradle directives
- The 'java' plugin is added implicitly by the gradle/javafx.gradle
   script, so there is no longer a need to explicitly apply it.

 - The 'application' plugin is no longer necessary now that we are
   building native installers with the javafx plugin.
2014-10-09 07:35:38 +02:00
Steve Myers
b4cd7467b2 moved UI Application to BitSquareUI class so BitSquare class can startup as seed peer on headless server. 2014-10-07 09:24:44 -07:00
Steve Myers
47232eebc2 Added command line arguments parser and flag to start app in seed mode. Also added default properties loader, but not using it yet. 2014-10-05 23:53:49 -07:00
Steve Myers
5e9f97953f Added built in dht seed node 2014-10-04 19:19:18 -07:00
Chris Beams
d16c2740b6
Generate native installers with Gradle JavaFX plugin
The plugin's jfx* tasks tie into the normal Gradle build lifecycle, such
that `gradle build` will now generate executables and installers
according to the OS on which the build is being run. These files are
output to the `build/distributions` directory.

Installers work as expected OS X and Linux at this point.

Windows installers do build, but a very particular configuration is
necessary on the Windows machine doing the building (this configuration
is to be documented in #109). However, even when the configuration is in
place and the MSI installer is successfully built, there is still a
fatal error at installer execution time relating to a missing
msvp100.dll file. See details at
https://bitbucket.org/shemnon/javafx-gradle/issue/43. An issue has been
created to track this from the Bitsquare side as well--see #108.

The changes made in this commit are based on on the samples at
http://bitbucket.org/shemnon/javafx-gradle and the article at
http://jaxenter.com/tutorial-a-guide-to-the-gradle-javafx-plugin-46270.html

The gradle/javafx.gradle file is copied directly from the sources in the
bitbucket repository above, as is apparently the convention (not sure
why this isn't part of the plugin itself, but that's a question to be
addressed later).

Resolves #66, #100
See #108, #109
2014-10-03 18:32:03 +02:00
Chris Beams
1031a72e52
Upgrade to BitcoinJ 0.12 GA
Resolves #98
2014-10-03 18:13:14 +02:00
Chris Beams
9727ea21a8
Upgrade to BitcoinJ 0.12-SNAPSHOT
- Update imports to reflect BitcoinJ's repackaging, including:

   git grep -l 'import com.google.bitcoin' | \
   xargs perl -p -i -e 's/import com.google.bitcoin/import org.bitcoinj/'

   git grep -l 'com.google.bitcoin' | \
   xargs perl -p -i -e 's/com.google.bitcoin/org.bitcoinj/'

 - Replace use of BitcoinJ's CoinFormat, which has now been renamed to
   MonetaryFormat, using:

   git grep -l 'CoinFormat' | \
   xargs perl -p -i -e 's/CoinFormat/MonetaryFormat/g'

 - Fix calls to BitcoinJ's Script#correctlySpends, whose signature has
   changed from 0.11 => 0.12.

See #98
2014-10-03 18:13:14 +02:00
Manfred Karrer
a334beb1a7 Update controlsfx to be compatible with latest jdk 2014-09-30 23:36:00 +02:00
Chris Beams
4d4787d84a
Upgrade Gradle wrapper version from 2.0 => 2.1 2014-09-29 09:56:30 +02:00
Chris Beams
d536258871
Use published snapshots for BitcoinJ and TomP2P
Bitsquare depends on specific versions of BitcoinJ and TomP2P that have
not previously been published to any maven repository--until now. Based
on the 'published' branch of the bitcoinj [1] and tomp2p [2] forks under
the bitsquare organization, snapshots have been published to a temporary
repository [3] that has been made available to us by JFrog.

To be as explicit as possible, these custom-published snapshots have
had their version numbers qualified with the short hash of the commit
they were built from. So for bitcoinj, the dependency is no longer
0.12-SNAPSHOT, but 0.12.308de4e-SNAPSHOT. For TomP2P, the version has
gone from 5.0-Alpha24-SNAPSHOT to 5.0-Alpha24.805623c-SNAPSHOT.
Accordingly, these qualified versions are now reflected in the
dependency declarations in build.gradle.

This means that it is no longer necessary to build bitcoinj and tomp2p
locally in order to get up and running with Bitsquare development, and
the README has been updated accordingly. And it also means we can now
set up a Travis CI build with ease (which shall be done with #86).

Resolves #97

[1]: https://github.com/bitsquare/bitcoinj/tree/published
[2]: https://github.com/bitsquare/tomp2p/tree/published
[3]: http://partnerdemo.artifactoryonline.com/partnerdemo/libs-snapshots-local/
2014-09-29 08:49:23 +02:00
Manfred Karrer
1efc1da6a6 Update to controlsFX 8.0.6 2014-09-03 23:33:00 +02:00
Chris Beams
bf7e46d1d5
Add Gradle OneJar plugin
For creation of a self-contained executable jar.

Run:
 - `./gradle executableJar`
 - `java -jar ./build/libs/bitsquare.jar

Note that actually executing the jar fails with an exception from
io.bitsquare.util.AppDirectoryUtil.createDirIfNotExists. This will be
fixed later. The purpose of this commit is only to establish the
executable jar infrastructure.
2014-08-28 13:56:06 +02:00
Chris Beams
0501965b99
Configure Gradle application plugin
- `./gradlew run` to launch Bitsquare
 - `./gradlew installApp` to create scripts in build/install/bitsquare

See http://www.gradle.org/docs/current/userguide/userguide_single.html#application_plugin
2014-08-28 13:56:05 +02:00
Chris Beams
62cb43dce5
Configure Gradle build
- Set version at 0.1.0-SNAPSHOT, per http://semver.org practices
 - Configure dependencies per existing Maven pom
 - Resolve dependencies from jcenter by default, mavenLocal for custom
   BitcoinJ and TomP2P binaries (which still must be built separately)
 - Copy non-java files (fxml, etc) from src/main/java when processing
   resources

`./gradle build` is now completes successfully.
2014-08-28 13:56:05 +02:00
Chris Beams
49adf9cc97
Add Gradle build file with wrapper configuration 2014-08-28 13:56:04 +02:00