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

Updated gradle to 6.9.3 and optimized build process #1636

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
ajordanow marked this conversation as resolved.
Show resolved Hide resolved
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

Choose a reason for hiding this comment

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

you can add the task provider here to automatically wire the task dependencies to ensure they are executed in the correct order

Suggested change
resources.srcDir consoleDir
resources.srcDir tasks.named('attachHermesConsole')

Copy link
Author

Choose a reason for hiding this comment

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

I think this will break the current behaviour of the build as the static files are not attached to the distZip package. This change would add a dependency that will cause static files to be included in the output.

Choose a reason for hiding this comment

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

ah, i see. i suggested this with the assumption that all the outputs would be added.

Do we still would need to make sure that the ProcessResources task dependsOn attachHermesConsole?

Copy link
Author

Choose a reason for hiding this comment

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

I think not - attachHermesConsole is an auxilliary task that copies static files from other subproject. It's intended to be run manually when needed.

}
}
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