Skip to content

Commit

Permalink
Updated gradle to 6.9.3 and optimized build process
Browse files Browse the repository at this point in the history
  • Loading branch information
ajordanow committed Dec 12, 2022
1 parent 3d170bc commit ebed400
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 23 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ subprojects {
}
}

tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}

checkstyle {
toolVersion '10.3.4'
maxWarnings getIntProperty('maxCheckstyleWarnings', Integer.MAX_VALUE)
Expand Down
4 changes: 2 additions & 2 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<suppress checks="[a-zA-Z0-9]*"
files="test\/helper\/"
/>

<!-- Suppress magic strings in default properties -->
<suppress checks="MagicNumber"
files="[/\\]src[/\\](main)[/\\]java[/\\].+Properties\.java$"
Expand Down Expand Up @@ -39,7 +39,7 @@

<!-- Build dirs -->
<suppress checks="[a-zA-Z0-9]*"
files="[/\\]build[/\\]generated[/\\]java[/\\]" />
files="[/\\]build[/\\]generated[/\\]" />

<!-- Classes repackaged from external libraries -->
<suppress checks="[a-zA-Z0-9]*"
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=1024m
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=1024m
org.gradle.parallel=true
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo
import static com.github.tomakehurst.wiremock.client.WireMock.post
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig
import static pl.allegro.tech.hermes.client.HermesMessage.hermesMessage

class HermesSenderTest extends Specification {

@ClassRule
@Shared
WireMockClassRule service = new WireMockClassRule(14523)
WireMockClassRule service = new WireMockClassRule(wireMockConfig().dynamicPort().dynamicHttpsPort())

void setup() {
WireMock.reset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo
import static com.github.tomakehurst.wiremock.client.WireMock.post
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig
import static pl.allegro.tech.hermes.client.HermesMessage.hermesMessage

class ReactiveHermesSenderTest extends Specification {

@ClassRule
@Shared
WireMockClassRule service = new WireMockClassRule(14523)
WireMockClassRule service = new WireMockClassRule(wireMockConfig().dynamicPort().dynamicHttpsPort())

void setup() {
WireMock.reset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class IntegrationTest extends Specification {

@ClassRule
@Shared
ZookeeperResource zookeeperResource = new ZookeeperResource(42182, true, { starter ->
ZookeeperResource zookeeperResource = new ZookeeperResource(-1, true, { starter ->
starter.curator().create().creatingParentsIfNeeded().forPath("/hermes/groups")
} as Consumer)

Expand Down
21 changes: 15 additions & 6 deletions hermes-consumers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,37 @@ dependencies {
sbeClasspath group: 'uk.co.real-logic', name: 'sbe-all', version: '1.12.8'
}

def generatedPath = "${buildDir}/generated/java/"
def generatedPathMaxRate = "${buildDir}/generated/maxrate/java/"
def generatedPathWorkload = "${buildDir}/generated/workload/java/"

task generateMaxRateSbeStubs(type: JavaExec) {
def input = 'src/main/resources/sbe/max-rate.xml'
inputs.file input
outputs.dir generatedPathMaxRate
outputs.cacheIf { true }
description = "Generate SBE stubs for max-rate"
classpath configurations.sbeClasspath
main = 'uk.co.real_logic.sbe.SbeTool'
systemProperties(
'sbe.output.dir': generatedPath,
'sbe.output.dir': generatedPathMaxRate,
'sbe.xinclude.aware': 'true'
)
args = ['src/main/resources/sbe/max-rate.xml']
args = [input]
}

task generateWorkloadSbeStubs(type: JavaExec) {
def input = 'src/main/resources/sbe/workload.xml'
inputs.file input
outputs.dir generatedPathWorkload
outputs.cacheIf { true }
description = "Generate SBE stubs for workload"
classpath configurations.sbeClasspath
main = 'uk.co.real_logic.sbe.SbeTool'
systemProperties(
'sbe.output.dir': generatedPath,
'sbe.output.dir': generatedPathWorkload,
'sbe.xinclude.aware': 'true'
)
args = ['src/main/resources/sbe/workload.xml']
args = [input]
}

task generateSbeStubs(type: DefaultTask) {
Expand All @@ -79,7 +88,7 @@ task generateSbeStubs(type: DefaultTask) {

sourceSets {
main {
java.srcDir generatedPath
java.srcDirs([generatedPathMaxRate, generatedPathWorkload])
}
}

Expand Down
27 changes: 17 additions & 10 deletions hermes-management/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,29 @@ dependencies {
testCompile group: 'org.testcontainers', name: 'kafka', version: versions.testcontainers
}

def consoleDir = "${buildDir}/generated/console"

task buildHermesConsole(type: Exec) {
workingDir '../hermes-console'
def dir = '../hermes-console'
workingDir dir
outputs.dir(dir + "/dist")
inputs.dir(dir + "/static")
commandLine './package.sh'
}

task attachHermesConsole(type: Copy, dependsOn: 'buildHermesConsole') {
from '../hermes-console/dist/static'
into(sourceSets.main.output.resourcesDir.path + '/static')
}

tasks.register('prepareIndexTemplate') {
def srcDir = '../hermes-console/dist/static'
def targetDir = consoleDir + '/static'
from srcDir
into targetDir
doLast {
def indexPath = sourceSets.main.output.resourcesDir.path + '/static/index.html'
ant.move file: indexPath,
tofile: indexPath + '.ftl'
ant.move file: targetDir + '/index.html',
tofile: targetDir + '/index.html.ftl'
}
}

jar.dependsOn(attachHermesConsole, 'prepareIndexTemplate')
sourceSets {
main {
resources.srcDir consoleDir
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected ZookeeperBaseTest() {

@BeforeClass
public static void beforeZookeeperClass() throws Exception {
zookeeperServer = new TestingServer(45678);
zookeeperServer = new TestingServer();
zookeeperClient = CuratorFrameworkFactory.builder()
.connectString(zookeeperServer.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
Expand Down

0 comments on commit ebed400

Please sign in to comment.