diff --git a/.gitignore b/.gitignore index f0a61e8e9fa..1384f8b49cc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,8 @@ build *.java.hsp *.~ava /bundles -/bisq* +/bisq-* +/lib /xchange desktop.ini */target/* diff --git a/build.gradle b/build.gradle index cac738ea197..ded96f64440 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,14 @@ buildscript { } } +configure(rootProject) { + // remove the 'bisq-*' scripts and 'lib' dir generated by the 'installDist' task + task clean { + doLast { + delete fileTree(dir: rootProject.projectDir, include: 'bisq-*'), 'lib' + } + } +} configure(subprojects) { apply plugin: 'java' @@ -57,11 +65,51 @@ configure([project(':desktop'), project(':relay'), project(':seednode'), project(':statsnode')]) { + apply plugin: 'application' build.dependsOn installDist installDist.destinationDir = file('build/app') distZip.enabled = false + + // the 'installDist' and 'startScripts' blocks below configure bisq executables to put + // generated shell scripts in the root project directory, such that users can easily + // discover and invoke e.g. ./bisq-desktop, ./bisq-seednode, etc. + // See https://stackoverflow.com/q/46327736 for details. + + installDist { + doLast { + // copy generated shell scripts, e.g. `bisq-desktop` directly to the project + // root directory for discoverability and ease of use + copy { + from "$destinationDir/bin" + into rootProject.projectDir + } + // copy libs required for generated shell script classpaths to 'lib' dir under + // the project root directory + copy { + from "$destinationDir/lib" + into "${rootProject.projectDir}/lib" + } + } + } + + startScripts { + // rename scripts from, e.g. `desktop` to `bisq-desktop` + applicationName = "bisq-$applicationName" + + // edit generated shell scripts such that they expect to be executed in the + // project root dir as opposed to a 'bin' subdirectory + doLast { + def windowsScriptFile = file getWindowsScript() + windowsScriptFile.text = windowsScriptFile.text.replace( + 'set APP_HOME=%DIRNAME%..', 'set APP_HOME=%DIRNAME%') + + def unixScriptFile = file getUnixScript() + unixScriptFile.text = unixScriptFile.text.replace( + 'cd "`dirname \\"$PRG\\"`/.." >/dev/null', 'cd "`dirname \\"$PRG\\"`" >/dev/null') + } + } } diff --git a/docs/build.md b/docs/build.md index 5a97d66321f..ee9db1a440f 100644 --- a/docs/build.md +++ b/docs/build.md @@ -18,9 +18,9 @@ You do _not_ need to install Gradle to complete the following command. The `grad ## Run -The Bisq executable jar is now available in the `desktop/build/libs/` directory. Run it as follows, replacing `{version}` with the actual version found in the filename: +Bisq executables are now available in the root project directory. Run Bisq Desktop as follows: - java -jar desktop/build/libs/desktop-{version}-all.jar + ./bisq-desktop ## See also diff --git a/docs/dev-setup.md b/docs/dev-setup.md index b2a6ba721d3..638b93bedf9 100644 --- a/docs/dev-setup.md +++ b/docs/dev-setup.md @@ -61,14 +61,14 @@ Here is an overview: ## Run Bisq seednode -For localhost/regtest mode run the `SeedNodeMain.java` class or the `seednode.jar` (inside the `seednode/build/libs` folder) with following program arguments: +For localhost/regtest mode run the `SeedNodeMain` class or `./bisq-seednode` script in the root project dir with following program arguments: --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=2002 --myAddress=localhost:2002 --appName=bisq-BTC_REGTEST_Seed_2002 ### Run Bisq arbitrator instance -For localhost/regtest mode run the `BisqAppMain.java` class or the `desktop.jar` (inside the `desktop/build/libs` folder) with following program arguments: +For localhost/regtest mode run the `BisqAppMain` class or `./bisq-desktop` script in the root project dir with following program arguments: --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=4444 --appName=bisq-BTC_REGTEST_arbitrator @@ -79,7 +79,7 @@ _Note: You need only register once but if you have shut down all nodes (includin ### Run two Bisq trade instances -For localhost/regtest mode run the `BisqAppMain.java` class or the `desktop.jar` (inside the `desktop/build/libs` folder) with following program arguments: +For localhost/regtest mode run the `BisqAppMain` class or `./bisq-desktop` script in the root project dir with following program arguments: --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=5555 --appName=bisq-BTC_REGTEST_Alice