From e3b602e4fb9001679eef7cd74dfc8ed1bbd582ce Mon Sep 17 00:00:00 2001 From: Filip Ocelka Date: Mon, 9 Oct 2023 13:16:16 +0200 Subject: [PATCH] BATM-5470 Removed root build.gradle --- annotations/build.gradle | 1 + batm_ssh_tunnel/build.gradle | 6 +- build.gradle | 65 ------------------- .../groovy/shared-build-conventions.gradle | 48 +++++++------- .../groovy/shared-publish-conventions.gradle | 29 +++++++++ ...shared-repositories-ext-conventions.gradle | 24 +++++++ currencies/build.gradle | 1 + dependencySubstitutions.txt | 2 +- gradle.properties | 2 +- gradle/verification-metadata.xml | 11 ++++ operators_sample_website/build.gradle | 1 + server_extensions_api/build.gradle | 1 + server_extensions_extra/build.gradle | 2 + server_extensions_test/build.gradle | 8 +-- 14 files changed, 105 insertions(+), 96 deletions(-) delete mode 100644 build.gradle create mode 100644 buildSrc/src/main/groovy/shared-publish-conventions.gradle create mode 100644 buildSrc/src/main/groovy/shared-repositories-ext-conventions.gradle diff --git a/annotations/build.gradle b/annotations/build.gradle index e47c2d3bb..21d483d7f 100644 --- a/annotations/build.gradle +++ b/annotations/build.gradle @@ -1,5 +1,6 @@ plugins { id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/batm_ssh_tunnel/build.gradle b/batm_ssh_tunnel/build.gradle index 08507bcff..3fede2f26 100644 --- a/batm_ssh_tunnel/build.gradle +++ b/batm_ssh_tunnel/build.gradle @@ -1,6 +1,10 @@ plugins { - id("java") id("application") + id("shared-build-conventions") +} + +repositories { + mavenCentral() } version = "1.0.0" diff --git a/build.gradle b/build.gradle deleted file mode 100644 index ed7652ae2..000000000 --- a/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -buildscript { - ext.with { - hasGbArtifactory = (project.hasProperty('gbArtifactoryUrl') - && project.hasProperty('gbArtifactoryUser') - && project.hasProperty('gbArtifactoryPassword')) - - setRepositoriesFor = { RepositoryHandler repositoryHandler -> - if (hasGbArtifactory) { - repositoryHandler.maven { - credentials { - username gbArtifactoryUser - password gbArtifactoryPassword - } - url gbArtifactoryUrl - } - } - repositoryHandler.mavenCentral() - repositoryHandler.maven { url 'https://jitpack.io' } - } - batmDependencySubstitutionConfig = file('dependencySubstitutions.txt') - } - setRepositoriesFor(repositories) -} - -allprojects { - setRepositoriesFor(buildscript.repositories) - setRepositoriesFor(repositories) - repositories { - //bitcoin-json-rpc-client-1.0.jar isn't part of any well known maven repo - //so we search the libs dir; gradle generates (guesses) metadata except dependencies. - //Artifacts from repos with real metadata take precedence. - flatDir { - dirs rootProject.file('libs') - } - } - tasks.withType(JavaCompile) { - project.sourceCompatibility = JavaVersion.VERSION_1_8 - options.encoding = 'UTF-8' - options.incremental = true - } - // Jars with the same contents should have the same checksums - tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true - } - afterEvaluate { - if (pluginManager.hasPlugin('com.generalbytes.gradle.dependency.verification')) { - dependencyChecksums { - global = true - } - dependencyVerifications { - setConfigurations([]) // effectively turns off all checksum verifications - } - } - if (pluginManager.hasPlugin('com.generalbytes.gradle.dependency.strict')) { - strictDependencies { -// conflictFail false // turns off failure on version conflict - } - } - } - - wrapper { - distributionType = Wrapper.DistributionType.ALL - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/shared-build-conventions.gradle b/buildSrc/src/main/groovy/shared-build-conventions.gradle index 65557fec6..9b32d6e78 100644 --- a/buildSrc/src/main/groovy/shared-build-conventions.gradle +++ b/buildSrc/src/main/groovy/shared-build-conventions.gradle @@ -1,35 +1,39 @@ plugins { id("java") - id("maven-publish") id("com.generalbytes.gradle.main") } -publishing { - if (hasGbUploadArtifactory()) { - repositories { - maven { - credentials { - username gbArtifactoryUser - password gbArtifactoryPassword - } - url gbArtifactoryUploadUrl - } - } - } +repositories { + mavenCentral() +} - publications { - mavenJava(MavenPublication) { - from components.java - } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) } } +tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" + options.incremental = true +} + dependencySubstitutions { - substitute file(batmDependencySubstitutionConfig) + substitute file("$project.rootDir/dependencySubstitutions.txt") } -boolean hasGbUploadArtifactory() { - return project.hasProperty("gbArtifactoryUploadUrl") - && project.hasProperty("gbArtifactoryUser") - && project.hasProperty("gbArtifactoryPassword") +tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true } + +afterEvaluate { + if (pluginManager.hasPlugin('com.generalbytes.gradle.dependency.verification')) { + dependencyChecksums { + global = true + } + dependencyVerifications { + setConfigurations([]) // effectively turns off all checksum verifications - replaced by gradle's verification-metadata.xml + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/shared-publish-conventions.gradle b/buildSrc/src/main/groovy/shared-publish-conventions.gradle new file mode 100644 index 000000000..b04143398 --- /dev/null +++ b/buildSrc/src/main/groovy/shared-publish-conventions.gradle @@ -0,0 +1,29 @@ +plugins { + id("maven-publish") +} + +publishing { + if (hasGbUploadArtifactory()) { + repositories { + maven { + credentials { + username gbArtifactoryUser + password gbArtifactoryPassword + } + url gbArtifactoryUploadUrl + } + } + } + + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} + +private boolean hasGbUploadArtifactory() { + return project.hasProperty("gbArtifactoryUploadUrl") + && project.hasProperty("gbArtifactoryUser") + && project.hasProperty("gbArtifactoryPassword") +} diff --git a/buildSrc/src/main/groovy/shared-repositories-ext-conventions.gradle b/buildSrc/src/main/groovy/shared-repositories-ext-conventions.gradle new file mode 100644 index 000000000..67cae8a8b --- /dev/null +++ b/buildSrc/src/main/groovy/shared-repositories-ext-conventions.gradle @@ -0,0 +1,24 @@ +ext { + hasGbArtifactory = hasGbArtifactory() +} + +repositories { + maven { + url = uri("https://jitpack.io") + } + if (hasGbArtifactory) { + maven { + url = uri(project.findProperty("gbArtifactoryUrl").toString()) + credentials { + username = project.findProperty("gbArtifactoryUser").toString() + password = project.findProperty("gbArtifactoryPassword").toString() + } + } + } +} + +private boolean hasGbArtifactory() { + return project.hasProperty('gbArtifactoryUrl') + && project.hasProperty('gbArtifactoryUser') + && project.hasProperty('gbArtifactoryPassword') +} \ No newline at end of file diff --git a/currencies/build.gradle b/currencies/build.gradle index d0ffed15d..5bf5e6e8c 100644 --- a/currencies/build.gradle +++ b/currencies/build.gradle @@ -1,5 +1,6 @@ plugins { id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/dependencySubstitutions.txt b/dependencySubstitutions.txt index 9b0deac26..57fbad937 100644 --- a/dependencySubstitutions.txt +++ b/dependencySubstitutions.txt @@ -33,7 +33,7 @@ substitute module: 'org.jetbrains.kotlin:kotlin-stdlib-jdk8', versions: ['1.3.31 substitute module: 'org.jetbrains.kotlin:kotlin-stdlib', versions: ['1.4.0'], toVersion: '1.4.10' substitute module: 'org.jetbrains.kotlin:kotlin-stdlib-common', versions: ['1.4.0'], toVersion: '1.4.10' substitute module: 'org.json:json', versions: ['20140107'], toVersion: '20180130' -substitute module: 'org.slf4j:slf4j-api', versions: ['1.7.20', '1.7.21', '1.7.25', '1.7.30', '1.7.32', '1.7.33', '1.8.0-beta4'], toVersion: '1.7.28' +substitute module: 'org.slf4j:slf4j-api', versions: ['1.7.20', '1.7.21', '1.7.25', '1.7.26', '1.7.30', '1.7.32', '1.7.33', '1.8.0-beta4'], toVersion: '1.7.28' substitute module: 'org.knowm.xchange:xchange-core', versions: ['5.0.12', '5.0.13'], toVersion: '5.0.10' substitute module: 'org.bouncycastle:bcprov-jdk15to18', versions: ['1.66'], toVersion: '1.69' substitute module: 'com.fasterxml.jackson.datatype:jackson-datatype-guava', versions: ['2.11.2'], toVersion: '2.12.0' diff --git a/gradle.properties b/gradle.properties index 58b1c827b..bbecb7f86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # buildscript - project id projectGroup=com.generalbytes.batm.public -projectVersion=1.1.16-snapshot +projectVersion=1.1.15 # buildscript - common dependency versions bitrafaelVersion=1.0.44 diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 5e960157e..e6b58b0f2 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1616,6 +1616,17 @@ + + + + + + + + + + + diff --git a/operators_sample_website/build.gradle b/operators_sample_website/build.gradle index a6c78c78a..ef0e74659 100644 --- a/operators_sample_website/build.gradle +++ b/operators_sample_website/build.gradle @@ -1,5 +1,6 @@ plugins { id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/server_extensions_api/build.gradle b/server_extensions_api/build.gradle index f804a2172..ea584b18c 100644 --- a/server_extensions_api/build.gradle +++ b/server_extensions_api/build.gradle @@ -1,5 +1,6 @@ plugins { id("shared-build-conventions") + id("shared-publish-conventions") id("distribution") } diff --git a/server_extensions_extra/build.gradle b/server_extensions_extra/build.gradle index 3c0ca358d..1a83b86b1 100644 --- a/server_extensions_extra/build.gradle +++ b/server_extensions_extra/build.gradle @@ -1,5 +1,7 @@ plugins { id("shared-build-conventions") + id("shared-publish-conventions") + id("shared-repositories-ext-conventions") } group = projectGroup diff --git a/server_extensions_test/build.gradle b/server_extensions_test/build.gradle index a9b4e60ef..fd5e7cc19 100644 --- a/server_extensions_test/build.gradle +++ b/server_extensions_test/build.gradle @@ -1,7 +1,7 @@ plugins { - id("java") id("application") - id("com.generalbytes.gradle.main") + id("shared-build-conventions") + id("shared-repositories-ext-conventions") } application { @@ -19,7 +19,3 @@ dependencies { implementation("net.sf.jopt-simple:jopt-simple:4.9") runtimeOnly("org.slf4j:slf4j-simple:1.7.28") } - -dependencySubstitutions { - substitute file(batmDependencySubstitutionConfig) -}