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

Excavator: Upgrades Baseline to the latest version #12

Merged
merged 1 commit into from
Nov 22, 2019
Merged
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
1 change: 0 additions & 1 deletion .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@
<property name="format" value="^_?[a-z][a-zA-Z0-9]+$"/>
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->
<module name="SummaryJavadocCheck"> <!-- Java Coding Guidelines: Javadoc -->
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:nebula-publishing-plugin:14.1.1'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4'
classpath 'com.palantir.baseline:gradle-baseline-java:2.31.0'
classpath 'com.palantir.baseline:gradle-baseline-java:2.35.2'
classpath 'com.palantir.gradle.conjure:gradle-conjure:4.13.4'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.gradle.api.tasks.TaskAction;

public class CompileMetricSchemaTask extends SourceTask {
private static final ObjectReader reader =
ObjectMappers.withDefaultModules(new ObjectMapper(new YAMLFactory())).readerFor(MetricSchema.class);
private static final ObjectReader reader = ObjectMappers.withDefaultModules(new ObjectMapper(new YAMLFactory()))
.readerFor(MetricSchema.class);
private static final ObjectWriter writer = ObjectMappers.newServerObjectMapper().writer();

private final RegularFileProperty outputFile = getProject().getObjects().fileProperty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,14 @@ private Stream<MetricSchema> discoverMetricSchema() {
CompileMetricSchemaTask compileMetricSchemaTask = (CompileMetricSchemaTask)
dependencyProject.getTasks().getByName(MetricSchemaPlugin.COMPILE_METRIC_SCHEMA);

metricSchemaStream =
Files.asByteSource(compileMetricSchemaTask.getOutputFile().get().getAsFile()).openStream();
metricSchemaStream = Files.asByteSource(compileMetricSchemaTask.getOutputFile().get().getAsFile())
.openStream();
} else {
if (!artifact.getFile().exists()) {
log.debug("Artifact did not exist: {}", artifact.getFile());
return Stream.empty();
} else if (!Files.getFileExtension(artifact.getFile().getName()).equals("jar")) {
} else if (!Files.getFileExtension(artifact.getFile().getName())
.equals("jar")) {
log.debug("Artifact is not jar: {}", artifact.getFile());
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ private static TaskProvider<CompileMetricSchemaTask> createCompileSchemaTask(
.named("processResources", processResources -> processResources.dependsOn(compileMetricSchema));

javaPlugin.getSourceSets().getByName("main").resources(resources -> {
SourceDirectorySet sourceDir =
project.getObjects().sourceDirectorySet("metricSchema", "metric schema").srcDir(metricSchemaDir);
SourceDirectorySet sourceDir = project.getObjects()
.sourceDirectorySet("metricSchema", "metric schema")
.srcDir(metricSchemaDir);
sourceDir.include("metric-schema/**");
resources.source(sourceDir);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ private static void generateMetricFactoryBuilder(
.collect(ImmutableList.toImmutableList()))
.addSuperinterface(ClassName.bestGuess(buildStage(metricName)))
.addFields(tagList.stream()
.map(tag ->
FieldSpec.builder(String.class, Custodian.sanitizeName(tag), Modifier.PRIVATE).build())
.map(tag -> FieldSpec.builder(String.class, Custodian.sanitizeName(tag), Modifier.PRIVATE)
.build())
.collect(ImmutableList.toImmutableList()))
.addMethod(buildMethodBuilder.build())
.addMethods(tagList.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ void testEmptyTag() {
assertThatThrownBy(() -> Validator.validate(MetricSchema.builder()
.namespaces("test", MetricNamespace.builder()
.docs(DOCS)
.metrics(
"name",
MetricDefinition.builder().docs(DOCS).type(MetricType.COUNTER).tags("").build())
.metrics("name", MetricDefinition.builder()
.docs(DOCS)
.type(MetricType.COUNTER)
.tags("")
.build())
.build())
.build()))
.isInstanceOf(SafeIllegalArgumentException.class)
Expand Down