-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
140 lines (116 loc) · 4.72 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
plugins {
id("groovy")
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.ajoberstar.git-publish' version '4.2.0'
id("com.bmuschko.docker-remote-api") version "9.3.2" apply false
id("io.micronaut.application") version "${micronautAppGradlePluginVersion}"
}
version = btcProxyVersion
group = "org.consensusj.bitcoin.proxyd"
buildScan {
if (System.getenv('CI')) {
publishAlways()
tag 'CI'
}
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
repositories {
if (useMavenLocal == "true") {
mavenLocal()
}
mavenCentral()
maven { url 'https://gitlab.com/api/v4/projects/8482916/packages/maven' } // ConsensusJ/consensusj
maven { url 'https://gitlab.com/api/v4/projects/26583853/packages/maven' } // OmniJ
}
micronaut {
version = "${micronautVersion}"
runtime("netty")
testRuntime("spock2")
processing {
incremental(true)
annotations("org.consensusj.bitcoin.proxyd.*")
}
}
graalvmNative {
binaries {
main {
imageName = 'btcproxyd'
buildArgs.add('--initialize-at-run-time=io.netty.handler.ssl.OpenSslAsyncPrivateKeyMethod,io.netty.handler.ssl.OpenSsl,io.netty.handler.ssl.OpenSslPrivateKeyMethod,io.netty.internal.tcnative.CertificateVerifier,io.netty.internal.tcnative.SSL,io.netty.internal.tcnative.SSLPrivateKeyMethod')
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.matching("GraalVM Community")
}
}
}
}
dependencies {
compileOnly("org.graalvm.nativeimage:svm")
implementation "io.micronaut:micronaut-jackson-databind"
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.acme:micronaut-acme")
implementation "jakarta.annotation:jakarta.annotation-api"
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut.rxjava3:micronaut-rxjava3")
runtimeOnly "org.yaml:snakeyaml"
runtimeOnly("ch.qos.logback:logback-classic")
implementation 'org.bouncycastle:bcprov-jdk15to18:1.76'
implementation "com.msgilligan:cj-btc-jsonrpc:${consensusjVersion}"
implementation "com.msgilligan:cj-btc-rx-jsonrpc:${consensusjVersion}"
implementation "foundation.omni:omnij-jsonrpc:${omnijVersion}"
implementation "foundation.omni:omnij-net-api:${omnijVersion}"
testImplementation "com.msgilligan:consensusj-jsonrpc-gvy:${consensusjVersion}"
}
application {
mainClass.set("org.consensusj.bitcoin.proxyd.Application")
}
java {
sourceCompatibility = JavaVersion.toVersion("17")
targetCompatibility = JavaVersion.toVersion("17")
}
run {
def runConfigPath = "${project.rootDir}/config/proxy-omni-regtest.yml"
environment(['MICRONAUT_CONFIG_FILES':runConfigPath])
}
test {
// Don't use MICRONAUT_CONFIG_FILES env variable in test
environment(['MICRONAUT_CONFIG_FILES':''])
}
// TODO: See if we can use this HOW-TO to build AMD64 & ARM64: https://dev.to/cloudx/multi-arch-docker-images-the-easy-way-with-github-actions-4k54
// See also: https://github.com/bmuschko/gradle-docker-plugin/issues/967#issuecomment-1103768609
tasks.named("dockerfile") {
baseImage = "eclipse-temurin:17-jre-jammy"
}
dockerBuild {
images = ["${System.env.DOCKER_IMAGE ?: project.name + '-jit'}:$project.version"]
}
dockerBuildNative {
images = ["${System.env.DOCKER_IMAGE ?: project.name}:$project.version"]
}
def registry = 'consensusj'
def jitImageName = "$project.name-jit"
def nativeImageName = "$project.name"
// Build and Push btcproxyd-jit for ARM64 and AMD64 architectures
task dockerBuildxImage(type:Exec) {
group 'build'
description "Builds multiplatform image using 'docker buildx'"
dependsOn dockerfile, buildLayers
workingDir 'build/docker/main'
executable 'docker'
args = ['buildx', 'build', '--platform', 'linux/amd64,linux/arm64',
'-t', "$registry/$jitImageName:$project.version",
'-t', "$registry/$jitImageName:latest", '--push', '.']
}
task dockerBuildxNativeImage(type:Exec) {
group 'build'
description "Builds multiplatform native image using 'docker buildx'"
dependsOn dockerfileNative, buildNativeLayersTask, dockerPrepareContext
workingDir 'build/docker/native-main'
executable 'docker'
args = ['buildx', 'build', '--file', 'DockerfileNative','--platform', 'linux/amd64,linux/arm64',
'-t', "$registry/$nativeImageName:$project.version",
'-t', "$registry/$nativeImageName:latest", '--push', '.']
}
apply from: 'gradle/asciidoctor.gradle'
apply from: 'gradle/github-pages.gradle'