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 Jan 12, 2023
1 parent d9dfb02 commit 948649d
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 = 2
}

checkstyle {
toolVersion '10.3.4'
maxWarnings getIntProperty('maxCheckstyleWarnings', Integer.MAX_VALUE)
Expand Down
2 changes: 1 addition & 1 deletion config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
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
29 changes: 18 additions & 11 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') {
task attachHermesConsole(type: Copy) {
def targetDir = consoleDir
from tasks.named('buildHermesConsole')
into targetDir
include("static/**")
doLast {
def indexPath = sourceSets.main.output.resourcesDir.path + '/static/index.html'
ant.move file: indexPath,
tofile: indexPath + '.ftl'
ant.move file: targetDir + '/static/index.html',
tofile: targetDir + '/static/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 948649d

Please sign in to comment.