Skip to content

Commit e37a7d7

Browse files
committed
Remove leftover build files and simplify ProgressLogger usage
These files should have been removed in an earlier commit. This commit also simplifies usage of ProgressLoggerWrapper by using the Groovy delegation instead of using explicit delegation.
1 parent 5103b76 commit e37a7d7

File tree

7 files changed

+25
-81
lines changed

7 files changed

+25
-81
lines changed

buildSrc/src/compile/groovy/gradle-2.13-loggers.groovy

Lines changed: 0 additions & 26 deletions
This file was deleted.

buildSrc/src/compile/groovy/gradle-2.14-loggers.groovy

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@
1818
*/
1919
package org.elasticsearch.gradle
2020

21-
import org.gradle.logging.ProgressLogger
22-
2321
/**
2422
* Wraps a ProgressLogger so that code in src/main/groovy does not need to
2523
* define imports on Gradle 2.13/2.14+ ProgressLoggers
2624
*/
27-
class ProgressLoggerWrapper {
28-
ProgressLogger progressLogger
25+
class ProgressLogger {
26+
@Delegate org.gradle.logging.ProgressLogger progressLogger
2927

30-
ProgressLoggerWrapper(ProgressLogger progressLogger) {
28+
ProgressLogger(org.gradle.logging.ProgressLogger progressLogger) {
3129
this.progressLogger = progressLogger
3230
}
3331
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@
1818
*/
1919
package org.elasticsearch.gradle
2020

21-
import org.gradle.internal.logging.progress.ProgressLogger
22-
2321
/**
2422
* Wraps a ProgressLogger so that code in src/main/groovy does not need to
2523
* define imports on Gradle 2.13/2.14+ ProgressLoggers
2624
*/
27-
class ProgressLoggerWrapper {
28-
ProgressLogger progressLogger
25+
class ProgressLogger {
26+
@Delegate org.gradle.internal.logging.progress.ProgressLogger progressLogger
2927

30-
ProgressLoggerWrapper(ProgressLogger progressLogger) {
28+
ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger progressLogger) {
3129
this.progressLogger = progressLogger
3230
}
3331
}

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedStartEvent
2525
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent
2626
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent
2727
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
28-
import org.elasticsearch.gradle.ProgressLoggerWrapper
28+
import org.elasticsearch.gradle.ProgressLogger
2929

3030
import static com.carrotsearch.ant.tasks.junit4.FormattingUtils.formatDurationInSeconds
3131
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.ERROR
@@ -51,7 +51,7 @@ import static java.lang.Math.max
5151
* quick.
5252
*/
5353
class TestProgressLogger implements AggregatedEventListener {
54-
ProgressLoggerWrapper progressLoggerWrapper
54+
ProgressLogger progressLogger
5555
int totalSuites
5656
int totalSlaves
5757

@@ -77,16 +77,16 @@ class TestProgressLogger implements AggregatedEventListener {
7777
lets us move things around without worying about breaking things. */
7878

7979
TestProgressLogger(Map args) {
80-
progressLoggerWrapper = new ProgressLoggerWrapper(args.factory.newOperation(TestProgressLogger))
81-
progressLoggerWrapper.progressLogger.setDescription('Randomized test runner')
80+
progressLogger = new ProgressLogger(args.factory.newOperation(TestProgressLogger))
81+
progressLogger.setDescription('Randomized test runner')
8282
}
8383

8484
@Subscribe
8585
void onStart(AggregatedStartEvent e) throws IOException {
8686
totalSuites = e.suiteCount
8787
totalSlaves = e.slaveCount
88-
progressLoggerWrapper.progressLogger.started()
89-
progressLoggerWrapper.progressLogger.progress(
88+
progressLogger.started()
89+
progressLogger.progress(
9090
"Starting JUnit4 for ${totalSuites} suites on ${totalSlaves} jvms")
9191

9292
suitesFormat = "%0${widthForTotal(totalSuites)}d"
@@ -178,7 +178,7 @@ class TestProgressLogger implements AggregatedEventListener {
178178
log += "J${sprintf(slavesFormat, eventSlave)} "
179179
}
180180
log += "completed ${eventDescription}"
181-
progressLoggerWrapper.progressLogger.progress(log)
181+
progressLogger.progress(log)
182182
}
183183

184184
private static int widthForTotal(int total) {

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/TapLoggerOutputStream.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package org.elasticsearch.gradle.vagrant
2020

2121
import com.carrotsearch.gradle.junit4.LoggingOutputStream
2222
import groovy.transform.PackageScope
23-
import org.elasticsearch.gradle.ProgressLoggerWrapper
23+
import org.elasticsearch.gradle.ProgressLogger
2424
import org.gradle.api.GradleScriptException
2525
import org.gradle.api.logging.Logger
2626

@@ -37,7 +37,7 @@ import java.util.regex.Matcher
3737
* entire TAP stream at once and won't parse it stream-wise.
3838
*/
3939
public class TapLoggerOutputStream extends LoggingOutputStream {
40-
private final ProgressLoggerWrapper progressLoggerWrapper
40+
private final ProgressLogger progressLogger
4141
private boolean isStarted = false
4242
private final Logger logger
4343
private int testsCompleted = 0
@@ -48,14 +48,14 @@ public class TapLoggerOutputStream extends LoggingOutputStream {
4848

4949
TapLoggerOutputStream(Map args) {
5050
logger = args.logger
51-
progressLoggerWrapper = new ProgressLoggerWrapper(args.factory.newOperation(VagrantLoggerOutputStream))
52-
progressLoggerWrapper.progressLogger.setDescription("TAP output for `${args.command}`")
51+
progressLogger = new ProgressLogger(args.factory.newOperation(VagrantLoggerOutputStream))
52+
progressLogger.setDescription("TAP output for `${args.command}`")
5353
}
5454

5555
@Override
5656
public void flush() {
5757
if (isStarted == false) {
58-
progressLoggerWrapper.progressLogger.started()
58+
progressLogger.started()
5959
isStarted = true
6060
}
6161
if (end == start) return
@@ -104,7 +104,7 @@ public class TapLoggerOutputStream extends LoggingOutputStream {
104104

105105
String counts = sprintf(countsFormat,
106106
[testsCompleted, testsFailed, testsSkipped, testCount])
107-
progressLoggerWrapper.progressLogger.progress("Tests $counts, $status [$suiteName] $testName")
107+
progressLogger.progress("Tests $counts, $status [$suiteName] $testName")
108108
if (!success) {
109109
logger.warn(line)
110110
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantLoggerOutputStream.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
package org.elasticsearch.gradle.vagrant
2020

2121
import com.carrotsearch.gradle.junit4.LoggingOutputStream
22-
import org.elasticsearch.gradle.ProgressLoggerWrapper
22+
import org.elasticsearch.gradle.ProgressLogger
2323

2424
/**
2525
* Adapts an OutputStream being written to by vagrant into a ProcessLogger. It
@@ -45,23 +45,23 @@ import org.elasticsearch.gradle.ProgressLoggerWrapper
4545
public class VagrantLoggerOutputStream extends LoggingOutputStream {
4646
private static final String HEADING_PREFIX = '==> '
4747

48-
private final ProgressLoggerWrapper progressLoggerWrapper
48+
private final ProgressLogger progressLogger
4949
private boolean isStarted = false
5050
private String squashedPrefix
5151
private String lastLine = ''
5252
private boolean inProgressReport = false
5353
private String heading = ''
5454

5555
VagrantLoggerOutputStream(Map args) {
56-
progressLoggerWrapper = new ProgressLoggerWrapper(args.factory.newOperation(VagrantLoggerOutputStream))
57-
progressLoggerWrapper.progressLogger.setDescription("Vagrant output for `$args.command`")
56+
progressLogger = new ProgressLogger(args.factory.newOperation(VagrantLoggerOutputStream))
57+
progressLogger.setDescription("Vagrant output for `$args.command`")
5858
squashedPrefix = args.squashedPrefix
5959
}
6060

6161
@Override
6262
public void flush() {
6363
if (isStarted == false) {
64-
progressLoggerWrapper.progressLogger.started()
64+
progressLogger.started()
6565
isStarted = true
6666
}
6767
if (end == start) return
@@ -96,6 +96,6 @@ public class VagrantLoggerOutputStream extends LoggingOutputStream {
9696
} else {
9797
return
9898
}
99-
progressLoggerWrapper.progressLogger.progress(line)
99+
progressLogger.progress(line)
100100
}
101101
}

0 commit comments

Comments
 (0)