Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Gradle build #1862

Merged
merged 38 commits into from Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c344e0d
Remove obsolete desktop/settings.gradle
cbeams Nov 4, 2018
b460894
Refactor gradle-witness plugin location and config
cbeams Nov 4, 2018
d3d3ea6
Remove obsolete gradle/wrapper dir
cbeams Nov 4, 2018
d6178f6
Remove osdetector plugin from desktop build
cbeams Nov 4, 2018
572155f
Remove duplicate openjfx dependencies
cbeams Nov 4, 2018
c257590
Upgrade to Gradle 4.10.2
cbeams Nov 4, 2018
cc5ed49
Eliminate unnecessary dependency from assets->common
cbeams Nov 4, 2018
394914e
Use single quotes for Gradle strings
cbeams Nov 4, 2018
3c1c402
Remove use of maven plugin
cbeams Nov 4, 2018
1a0b017
Remove use of lombok annotations in relay
cbeams Nov 4, 2018
b857e5d
Fix broken mainClassName in relay
cbeams Nov 4, 2018
f0b4496
Remove unnecessary JesusMcCloud repo from relay
cbeams Nov 4, 2018
95c8b8d
Pull up application and configuration of java plugin
cbeams Nov 4, 2018
4e1fa91
Pull up common repositories to root build.gradle
cbeams Nov 4, 2018
f6a68f8
Pull up common JavaCompile config to root
cbeams Nov 4, 2018
1cdb39a
Pull up JesusMcCloud repo to root
cbeams Nov 4, 2018
bd1e7e2
Pull up application plugin config to root
cbeams Nov 4, 2018
83118b6
Remove assets Javadoc jar
cbeams Nov 4, 2018
51d9f00
Inline $jmockitVersion core/desktop build.gradle
cbeams Nov 4, 2018
cdff12a
Fix incorrect name in pricenode jar and manifest
cbeams Nov 4, 2018
c895656
Pull up remaining assets config to root
cbeams Nov 4, 2018
d4edb81
Pull up remaining common config to root
cbeams Nov 4, 2018
0f5e9b7
Pull up remaining core config to root
cbeams Nov 4, 2018
3c54be2
Pull up remaining desktop config to root
cbeams Nov 4, 2018
e97625c
Pull up remaining monitor config to root
cbeams Nov 4, 2018
2f7c5f1
Pull up remaining p2p config to root
cbeams Nov 4, 2018
15b81df
Pull up remaining pricenode config to root
cbeams Nov 4, 2018
9c82b30
Pull up remaining relay config to root
cbeams Nov 4, 2018
b0886dd
Pull up remaining seednode config to root
cbeams Nov 4, 2018
3cd467c
Pull up remaining statsnode config to root
cbeams Nov 4, 2018
cb4f6ed
Minimize common subproject javafx dependencies
cbeams Nov 4, 2018
5cdacbe
Extract variables for duplicate dependency versions
cbeams Nov 4, 2018
22b92f7
Use two blank lines between configure blocks
cbeams Nov 4, 2018
adb3e9e
Remove unnecessary :desktop:test javaagent config
cbeams Nov 4, 2018
743a769
Remove unnecessary seednode resources config
cbeams Nov 4, 2018
3913988
Remove unnecessary application of 'java-base' plugin
cbeams Nov 4, 2018
f8ec6be
Remove unused $junitVersion
cbeams Nov 5, 2018
978fd2d
Use $springVersion variable consistently
cbeams Nov 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 0 additions & 38 deletions assets/build.gradle

This file was deleted.

18 changes: 13 additions & 5 deletions assets/src/main/java/bisq/asset/PrintTool.java
Expand Up @@ -17,8 +17,6 @@

package bisq.asset;

import bisq.common.util.Tuple2;

import java.util.Comparator;

public class PrintTool {
Expand All @@ -31,14 +29,24 @@ public static void main(String[] args) {
.sorted(Comparator.comparing(o -> o.getName().toLowerCase()))
.filter(e -> !e.getTickerSymbol().equals("BSQ")) // BSQ is not out yet...
.filter(e -> !e.getTickerSymbol().equals("BTC"))
.map(e -> new Tuple2(e.getName(), e.getTickerSymbol())) // We want to get rid of duplicated entries for regtest/testnet...
.map(e -> new Pair(e.getName(), e.getTickerSymbol())) // We want to get rid of duplicated entries for regtest/testnet...
.distinct()
.forEach(e -> sb.append("<li>&#8220;")
.append(e.second)
.append(e.right)
.append("&#8221;, &#8220;")
.append(e.first)
.append(e.left)
.append("&#8221;</li>")
.append("\n"));
System.out.println(sb.toString());
}

private static class Pair {
String left;
String right;

Pair(String left, String right) {
this.left = left;
this.right = right;
}
}
}
320 changes: 318 additions & 2 deletions build.gradle
@@ -1,3 +1,319 @@
plugins {
id 'java-base'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
classpath files('gradle/witness/gradle-witness.jar')
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE'
}
}


configure(subprojects) {
apply plugin: 'java'
apply plugin: 'com.google.osdetector'

sourceCompatibility = 1.10

ext {
bcVersion = '1.56'
codecVersion = '1.9'
easyVersion = '4.0.1'
jmockitVersion = '1.42'
joptVersion = '5.0.3'
langVersion = '3.4'
libdohjVersion = 'd4ace7bc'
lombokVersion = '1.18.2'
mockitoVersion = '2.21.0'
powermockVersion = '2.0.0-beta.5'
protobufVersion = '3.5.1'
sparkVersion = '2.5.2'
springVersion = '4.3.6.RELEASE'

os = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os
}

repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://raw.githubusercontent.com/JesusMcCloud/tor-binary/master/release/' }
}

dependencies {
testCompile 'junit:junit:4.12'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you have defined the junit version above, I assume this can be changed to the following?
testCompile "junit:junit:$junitVersion"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I extracted that variable when there were still multiple declarations of the same junit dependency across the projects. Now, however, there is just one declaration applied to all subprojects in the configure(subprojects) block, so I'll simply remove the variable as it's no longer needed. The practice here is to extract these variables only as needed to eliminate duplication. If there's just one declaration, the version can remain inline.

}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}


configure([project(':desktop'),
project(':monitor'),
project(':relay'),
project(':seednode'),
project(':statsnode')]) {
apply plugin: 'application'

build.dependsOn installDist
installDist.destinationDir = file('build/app')
distZip.enabled = false
}


configure(project(':assets')) {
dependencies {
compile("network.bisq.libdohj:libdohj-core:$libdohjVersion") {
exclude(module: 'protobuf-java')
}
compile "commons-codec:commons-codec:$codecVersion"
compile "org.apache.commons:commons-lang3:$langVersion"
compile "org.bouncycastle:bcpg-jdk15on:$bcVersion"
}
}


configure(project(':common')) {
apply plugin: 'com.google.protobuf'

sourceSets.main.java.srcDir "$buildDir/generated/source/proto/main/java"

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
}

dependencies {
compile "org.openjfx:javafx-base:11:$os"
compile "org.openjfx:javafx-graphics:11:$os"
compile "com.google.protobuf:protobuf-java:$protobufVersion"
compile 'com.google.code.gson:gson:2.7'
compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude(module: 'junit')
}
compile "org.springframework:spring-core:$springVersion"
compile 'org.slf4j:slf4j-api:1.7.22'
compile 'ch.qos.logback:logback-core:1.1.10'
compile 'ch.qos.logback:logback-classic:1.1.10'
compile 'com.google.code.findbugs:jsr305:3.0.1'
compile 'com.google.guava:guava:20.0'
compile('com.google.inject:guice:4.1.0') {
exclude(module: 'guava')
}
compile("network.bisq.libdohj:libdohj-core:$libdohjVersion") {
exclude(module: 'jsr305')
exclude(module: 'slf4j-api')
exclude(module: 'guava')
exclude(module: 'protobuf-java')
}
compile 'org.jetbrains:annotations:13.0'
runtime "org.bouncycastle:bcprov-jdk15on:$bcVersion"
compile "org.bouncycastle:bcpg-jdk15on:$bcVersion"
compile 'commons-io:commons-io:2.4'
compile "org.apache.commons:commons-lang3:$langVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}


configure(project(':p2p')) {
dependencies {
compile project(':common')
compile('com.github.JesusMcCloud.netlayer:tor.native:0.4.2') {
exclude(module: 'slf4j-api')
}
compile('org.apache.httpcomponents:httpclient:4.5.3') {
exclude(module: 'commons-logging')
}
compile "net.sf.jopt-simple:jopt-simple:$joptVersion"
compile 'org.fxmisc.easybind:easybind:1.0.3'
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompile 'org.jmockit:jmockit:1.30' // must not use current $jmockitVersion
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}


configure(project(':core')) {
dependencies {
compile project(':assets')
compile project(':p2p')
compile "net.sf.jopt-simple:jopt-simple:$joptVersion"
compile('network.bisq.btcd-cli4j:btcd-cli4j-core:3864e1c4') {
exclude(module: 'slf4j-api')
exclude(module: 'httpclient')
exclude(module: 'commons-lang3')
exclude(module: 'jackson-core')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-databind')
}
compile('network.bisq.btcd-cli4j:btcd-cli4j-daemon:3864e1c4') {
exclude(module: 'slf4j-api')
exclude(module: 'httpclient')
exclude(module: 'commons-lang3')
exclude(module: 'jackson-core')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-databind')
}
compile 'com.fasterxml.jackson.core:jackson-core:2.8.10'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.10'
compile('com.fasterxml.jackson.core:jackson-databind:2.8.10') {
exclude(module: 'jackson-annotations')
}

compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"

testCompile "org.jmockit:jmockit:$jmockitVersion"
testCompile("org.mockito:mockito-core:$mockitoVersion") {
exclude(module: 'objenesis')
}
testCompile "org.powermock:powermock-module-junit4:$powermockVersion"
testCompile "org.powermock:powermock-api-mockito2:$powermockVersion"
testCompile "org.springframework:spring-test:$springVersion"
testCompile "com.natpryce:make-it-easy:$easyVersion"
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
}

test {
systemProperty 'jdk.attach.allowAttachSelf', true

def jmockit = configurations.testCompile.files.find { it.name.contains("jmockit") }.absolutePath
jvmArgs "-javaagent:$jmockit"
}
}


configure(project(':desktop')) {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'witness'
apply from: '../gradle/witness/gradle-witness.gradle'

version = '0.8.0-SNAPSHOT'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that is out of scope for this PR. But perhaps this should be taken out of the gradle file and put into a resource file, similar to how it is done for pricenode?
version = file("src/main/resources/version.txt").text

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I cleaned up a number of unnecessary, unused, or just wrong instances of version metadata elsewhere in this PR, but in this case, the assignment of the $project.version variable affects the name of the resulting jar and shadow jar, so it's not quite as simple as extracting it to a resource file. There is also a lot of duplication of the current version throughout the codebase and supporting shell scripts that are used during releases. As you mention, it's a topic for another, more comprehensive PR that really cleans this stuff up.


mainClassName = 'bisq.desktop.app.BisqAppMain'

tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

sourceSets.main.resources.srcDirs += ['src/main/java'] // to copy fxml and css files

dependencies {
compile project(':p2p')
compile project(':core')
compile project(':common')
compile 'org.controlsfx:controlsfx:8.0.6_20'
compile 'org.reactfx:reactfx:2.0-M3'
compile 'net.glxn:qrgen:1.3'
compile 'de.jensd:fontawesomefx:8.0.0'
compile 'de.jensd:fontawesomefx-commons:9.1.2'
compile 'de.jensd:fontawesomefx-materialdesignfont:2.0.26-9.1.2'
compile 'com.googlecode.jcsv:jcsv:1.4.0'
compile 'com.github.sarxos:webcam-capture:0.3.12'
compile "org.openjfx:javafx-controls:11:$os"
compile "org.openjfx:javafx-fxml:11:$os"
compile "org.openjfx:javafx-swing:11:$os"

compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"

testCompile "org.jmockit:jmockit:$jmockitVersion"
testCompile("org.mockito:mockito-core:$mockitoVersion") {
exclude(module: 'objenesis')
}
testCompile "org.powermock:powermock-module-junit4:$powermockVersion"
testCompile "org.powermock:powermock-api-mockito2:$powermockVersion"
testCompile "org.springframework:spring-test:$springVersion"
testCompile "com.natpryce:make-it-easy:$easyVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}


configure(project(':monitor')) {
mainClassName = 'bisq.monitor.MonitorMain'

dependencies {
compile project(':core')
compile "com.sparkjava:spark-core:$sparkVersion"
compile 'net.gpedro.integrations.slack:slack-webhook:1.1.1'
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}


configure(project(':pricenode')) {
apply plugin: "org.springframework.boot"

version = file("src/main/resources/version.txt").text

jar.manifest.attributes(
"Implementation-Title": project.name,
"Implementation-Version": version)

dependencies {
compile project(":core")
compile project(":assets")
compile("org.knowm.xchange:xchange-bitcoinaverage:4.3.3")
compile("org.knowm.xchange:xchange-coinmarketcap:4.3.3")
compile("org.knowm.xchange:xchange-poloniex:4.3.3")
compile("org.springframework.boot:spring-boot-starter-web:1.5.10.RELEASE")
compile("org.springframework.boot:spring-boot-starter-actuator")
}

task stage {
dependsOn assemble
}
}


configure(project(':relay')) {
mainClassName = 'bisq.relay.RelayMain'

dependencies {
compile project(':common')
compile "com.sparkjava:spark-core:$sparkVersion"
compile 'com.turo:pushy:0.13.2'
compile 'com.google.firebase:firebase-admin:6.2.0'
compile "commons-codec:commons-codec:$codecVersion"
}
}


configure(project(':seednode')) {
apply plugin: 'com.github.johnrengelman.shadow'

mainClassName = 'bisq.seednode.SeedNodeMain'

dependencies {
compile project(':core')
runtime "org.bouncycastle:bcprov-jdk15on:$bcVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}


configure(project(':statsnode')) {
mainClassName = 'bisq.statistics.StatisticsMain'

dependencies {
compile project(':core')
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
}