Skip to content

Commit 7a70ae5

Browse files
committed
[Java] Upgrade to Gradle 7.2.
1 parent 5d1a8e2 commit 7a70ae5

File tree

3 files changed

+187
-134
lines changed

3 files changed

+187
-134
lines changed

build.gradle

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ project(':sbe-samples') {
406406
compileGeneratedJava.dependsOn 'generateCodecs'
407407

408408
task generateCodecs(type: JavaExec) {
409-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
409+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
410410
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
411411
systemProperties(
412412
'sbe.output.dir': generatedDir,
@@ -420,19 +420,19 @@ project(':sbe-samples') {
420420
}
421421

422422
task runExampleUsingGeneratedStub(dependsOn: 'compileJava', type: JavaExec) {
423-
mainClass = 'uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStub'
423+
mainClass.set('uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStub')
424424
classpath = sourceSets.main.runtimeClasspath
425425
systemProperties System.getProperties()
426426
}
427427

428428
task runExampleUsingGeneratedStubExtension(dependsOn: 'compileJava', type: JavaExec) {
429-
mainClass = 'uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStubExtension'
429+
mainClass.set('uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStubExtension')
430430
classpath = sourceSets.main.runtimeClasspath
431431
systemProperties System.getProperties()
432432
}
433433

434434
task runOtfExample(dependsOn: 'compileJava', type: JavaExec) {
435-
mainClass = 'uk.co.real_logic.sbe.examples.OtfExample'
435+
mainClass.set('uk.co.real_logic.sbe.examples.OtfExample')
436436
classpath = sourceSets.main.runtimeClasspath
437437
workingDir = 'src/main/resources'
438438
}
@@ -516,7 +516,7 @@ project(':sbe-benchmarks') {
516516
compileJava.dependsOn 'compileGeneratedJava'
517517

518518
task generateCodecs(type: JavaExec) {
519-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
519+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
520520
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
521521
systemProperties(
522522
'sbe.output.dir': 'build/generated-src',
@@ -542,7 +542,7 @@ project(':sbe-benchmarks') {
542542
* Rust codec targets used for testing
543543
*/
544544
task generateRustExamples(type: JavaExec) {
545-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
545+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
546546
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
547547
systemProperties(
548548
'sbe.output.dir': 'generated/rust',
@@ -557,7 +557,7 @@ task generateRustExamples(type: JavaExec) {
557557
}
558558

559559
task generateRustTestCodecs(type: JavaExec) {
560-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
560+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
561561
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
562562
systemProperties(
563563
'sbe.output.dir': 'generated/rust',
@@ -570,15 +570,15 @@ task generateRustTestCodecs(type: JavaExec) {
570570
}
571571

572572
task generateCarExampleDataFile(type: JavaExec) {
573-
mainClass = 'uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStub'
573+
mainClass.set('uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStub')
574574
classpath = project(':sbe-samples').sourceSets.main.runtimeClasspath
575575
systemProperties('sbe.encoding.filename': 'rust/car_example_baseline_data.sbe')
576576
args = []
577577
standardOutput = new ByteArrayOutputStream()
578578
}
579579

580580
task generateCarExampleExtensionDataFile(type: JavaExec) {
581-
mainClass = 'uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStubExtension'
581+
mainClass.set('uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStubExtension')
582582
classpath = project(':sbe-samples').sourceSets.main.runtimeClasspath
583583
systemProperties('sbe.encoding.filename': 'rust/car_example_extension_data.sbe')
584584
args = []
@@ -608,7 +608,7 @@ task runRustTests(type: Exec) {
608608
* *) Some examples need to fiddle with WorkingDir to deal with XInclude
609609
*/
610610
task generateGolangCodecTestComposite(type: JavaExec) {
611-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
611+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
612612
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
613613
systemProperties(
614614
'sbe.output.dir': 'gocode/src',
@@ -617,7 +617,7 @@ task generateGolangCodecTestComposite(type: JavaExec) {
617617
}
618618

619619
task generateGolangCodecTestBasic(type: JavaExec) {
620-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
620+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
621621
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
622622
systemProperties(
623623
'sbe.output.dir': 'gocode/src/basic',
@@ -626,7 +626,7 @@ task generateGolangCodecTestBasic(type: JavaExec) {
626626
}
627627

628628
task generateGolangCodecTestGroup(type: JavaExec) {
629-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
629+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
630630
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
631631
systemProperties(
632632
'sbe.output.dir': 'gocode/src/group',
@@ -635,7 +635,7 @@ task generateGolangCodecTestGroup(type: JavaExec) {
635635
}
636636

637637
task generateGolangCodecTestVarData(type: JavaExec) {
638-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
638+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
639639
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
640640
systemProperties(
641641
'sbe.output.dir': 'gocode/src/vardata',
@@ -644,7 +644,7 @@ task generateGolangCodecTestVarData(type: JavaExec) {
644644
}
645645

646646
task generateGolangCodecsWithXIncludes(type: JavaExec) {
647-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
647+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
648648
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
649649
systemProperties(
650650
'sbe.output.dir': 'gocode/src',
@@ -656,7 +656,7 @@ task generateGolangCodecsWithXIncludes(type: JavaExec) {
656656
}
657657

658658
task generateGolangCodecsWithXSD(type: JavaExec) {
659-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
659+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
660660
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
661661
systemProperties(
662662
'sbe.output.dir': 'gocode/src',
@@ -696,7 +696,7 @@ task generateGolangCodecs {
696696
* multiple targets as XInclude forces us to change working dir
697697
*/
698698
task generateCSharpCodecsWithXIncludes(type: JavaExec) {
699-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
699+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
700700
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
701701
systemProperties(
702702
'sbe.output.dir': 'csharp/sbe-generated',
@@ -708,7 +708,7 @@ task generateCSharpCodecsWithXIncludes(type: JavaExec) {
708708
}
709709

710710
task generateCSharpCodecsTests(type: JavaExec) {
711-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
711+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
712712
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
713713
systemProperties(
714714
'sbe.output.dir': 'csharp/sbe-generated',
@@ -731,7 +731,7 @@ task generateCSharpCodecs {
731731
}
732732

733733
task generateJavaIrCodecs(type: JavaExec, dependsOn: 'computeOriginalIrHash') {
734-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
734+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
735735
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
736736
systemProperties(
737737
'sbe.output.dir': 'sbe-tool/src/main/java',
@@ -741,7 +741,7 @@ task generateJavaIrCodecs(type: JavaExec, dependsOn: 'computeOriginalIrHash') {
741741
}
742742

743743
task generateCppIrCodecs(type: JavaExec) {
744-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
744+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
745745
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
746746
systemProperties(
747747
'sbe.output.dir': 'sbe-tool/src/main/cpp',
@@ -751,7 +751,7 @@ task generateCppIrCodecs(type: JavaExec) {
751751
}
752752

753753
task generateGolangIrCodecs(type: JavaExec) {
754-
mainClass = 'uk.co.real_logic.sbe.SbeTool'
754+
mainClass.set('uk.co.real_logic.sbe.SbeTool')
755755
classpath = project(':sbe-tool').sourceSets.main.runtimeClasspath
756756
systemProperties(
757757
'sbe.output.dir': 'sbe-tool/src/main/golang',
@@ -820,15 +820,15 @@ tasks.named('dependencyUpdates').configure {
820820
tasks.findByName('build').dependsOn verifyJavaIrCodecsInSync
821821

822822
wrapper {
823-
gradleVersion = '7.1.1'
823+
gradleVersion = '7.2'
824824
distributionType = 'ALL'
825825
}
826826

827827
class ChecksumTask extends DefaultTask
828828
{
829-
private static final MessageDigest SHA_256 = MessageDigest.getInstance("SHA-256");
830-
private static final byte CR = (byte) ('\r' as char)
831-
private static final byte LF = (byte) ('\n' as char)
829+
private static final MessageDigest SHA_256 = MessageDigest.getInstance("SHA-256")
830+
private static final byte CR = (byte)('\r' as char)
831+
private static final byte LF = (byte)('\n' as char)
832832

833833
@InputDirectory
834834
File inputDirectory
@@ -837,14 +837,15 @@ class ChecksumTask extends DefaultTask
837837
File outputFile
838838

839839
@TaskAction
840-
def checksum() {
840+
def checksum()
841+
{
841842
SHA_256.reset()
842843

843-
final File[] files = inputDirectory.listFiles();
844+
final File[] files = inputDirectory.listFiles()
844845
for (final File f : files)
845846
{
846847
final byte[] raw = Files.readAllBytes(f.toPath())
847-
final byte[] normalized = normalizeEOL(raw);
848+
final byte[] normalized = normaliseEol(raw)
848849
SHA_256.update(normalized)
849850
}
850851

@@ -858,18 +859,21 @@ class ChecksumTask extends DefaultTask
858859
StandardOpenOption.TRUNCATE_EXISTING)
859860
}
860861

861-
private byte[] normalizeEOL(final byte[] raw)
862+
private static byte[] normaliseEol(final byte[] raw)
862863
{
863864
final byte[] result = new byte[raw.length]
864865
int i = 0
866+
865867
for (int j = 0, size = raw.length; j < size; j++)
866868
{
867869
if (CR == raw[j] && (j == size - 1 || LF == raw[j + 1]))
868870
{
869871
continue;
870872
}
873+
871874
result[i++] = raw[j]
872875
}
873-
return raw.length == i ? result : Arrays.copyOf(result, i);
876+
877+
return raw.length == i ? result : Arrays.copyOf(result, i)
874878
}
875879
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)