mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-18 05:12:42 +01:00
Generate scripts for Bisq executables in root dir
This change configures the Gradle build to generate "start scripts" for each Bisq executable (e.g. Bisq Desktop, Bisq Seednode, etc) in the root project directory, such that after invoking `./gradle build`, the following executable scripts become available: ~/Work/bisq-network/bisq $ ls -1 | egrep '(bisq*|lib)' bisq-desktop bisq-desktop.bat bisq-monitor bisq-monitor.bat bisq-relay bisq-relay.bat bisq-seednode bisq-seednode.bat bisq-statsnode bisq-statsnode.bat lib This makes it possible for users (developers) to easily discover and use these scripts in an idiomatic and platform-agnostic way as opposed to the previous situation where we would advise users to run e.g. java -jar desktop/build/libs/desktop-0.8.0-SNAPSHOT-all.jar This approach works, but is cumbersome and focuses unnecessarily on the Java-based nature of the project. Now, with the changes in this commit, the user would simply run: ./bisq-desktop The 'lib' directory shown above contains all the jar files necessary to construct classpaths for these various scripts. The 'cleanInstallDist' task deletes the 'bisq-*' files and the 'lib' directory, and the default 'clean' task has been configured to depend on the 'cleanInstallDist' task to ensure this cleanup happens automatically when most users would expect it. In the future, these same scripts can be used when installing Bisq executables properly on users' systems via package managers like Brew and Apt. The goal is to have the user experience around running `bisq-desktop` (and more importantly, the forthcoming `bisqd`) be similar in every way to installing and using `bitcoind`, `lnd` and other idiomatic *nix-style utilities, be they Bitcoin-related or not. See the changes in docs/build.md and docs/dev-setup.md for a further sense of the how this change impacts the developer experience.
This commit is contained in:
parent
a57a4a71c0
commit
fc0491d8da
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,7 +21,8 @@ build
|
||||
*.java.hsp
|
||||
*.~ava
|
||||
/bundles
|
||||
/bisq*
|
||||
/bisq-*
|
||||
/lib
|
||||
/xchange
|
||||
desktop.ini
|
||||
*/target/*
|
||||
|
48
build.gradle
48
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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user