Skip to content

Commit 4da7726

Browse files
robert3005Robert Kruszewski
authored andcommitted
Upgrade baseline to 0.41.0 (apache-spark-on-k8s#454)
Need to figure out how to merge the checkstyles because otherwise we will end up with a lot of mess
1 parent 8f1c124 commit 4da7726

File tree

18 files changed

+541
-536
lines changed

18 files changed

+541
-536
lines changed

.baseline/checkstyle/checkstyle-suppressions.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VariableDeclarationUsageDistance" />
1313
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VisibilityModifier" />
1414
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="AvoidStaticImport" />
15+
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemOut" />
16+
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemErr" />
17+
18+
<!-- Suppress test resources -->
19+
<suppress files="[/\\]src[/\\]test[/\\]resources.*" checks="." />
1520

1621
<!-- JavadocStyle enforces existence of package-info.java package-level Javadoc; we consider this a bug. -->
1722
<suppress files="package-info.java" checks="JavadocStyle" />

.baseline/checkstyle/checkstyle.xml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,17 @@
124124
<message key="import.illegal" value="Use JUnit 4-style (org.junit.*) test classes and assertions instead of JUnit 3 (junit.framework.*)."/>
125125
</module>
126126
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
127-
<property name="illegalPkgs" value="org.elasticsearch.common.base, jersey.repackaged.com.google.common, com.google.api.client.repackaged, org.apache.hadoop.thirdparty.guava, com.clearspring.analytics.util, org.spark_project.guava"/>
127+
<property name="illegalPkgs" value="org.elasticsearch.common.base, com.clearspring.analytics.util, org.spark_project.guava"/>
128+
<message key="import.illegal" value="Must not import repackaged classes."/>
129+
</module>
130+
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
131+
<property name="illegalPkgs" value=".*\.(repackaged|shaded|thirdparty)"/>
132+
<property name="regexp" value="true" />
128133
<message key="import.illegal" value="Must not import repackaged classes."/>
129134
</module>
130135
<module name="IllegalImport">
131-
<property name="illegalPkgs" value="^org\.gradle\..*internal"/>
136+
<property name="illegalPkgs" value="^org\.gradle\.(internal|.*\.internal)"/>
137+
<property name="regexp" value="true" />
132138
<message key="import.illegal" value="Do not rely on gradle internal classes as these may change in minor releases - use org.gradle.api versions instead."/>
133139
</module>
134140
<module name="IllegalImport">
@@ -148,6 +154,10 @@
148154
<property name="illegalPkgs" value="org.apache.log4j, org.apache.logging.log4j, java.util.logging, ch.qos.logback"/>
149155
<message key="import.illegal" value="Use SLF4J instead of a logging framework directly."/>
150156
</module>
157+
<module name="IllegalImport">
158+
<property name="illegalClasses" value="com.google.common.base.Optional, com.google.common.base.Supplier"/>
159+
<message key="import.illegal" value="Use the Java8 version of Guava objects."/>
160+
</module>
151161
<module name="IllegalInstantiation"> <!-- Java Coding Guidelines: Never instantiate primitive types -->
152162
<property name="classes" value="java.lang.Boolean"/>
153163
<property name="classes" value="java.lang.Byte"/>
@@ -171,17 +181,15 @@
171181
<property name="illegalClassNames" value="com.google.common.cache.CacheBuilder, com.google.common.cache.Cache, com.google.common.cache.LoadingCache"/>
172182
<message key="illegal.type" value="Do not use Guava caches, they are outperformed by and harder to use than Caffeine caches"/>
173183
</module>
174-
<!-- Use Spark's built-in import ordering -->
175-
<module name="ImportOrder">
184+
<module name="ImportOrder"> <!-- Java Style Guide: Ordering and spacing -->
185+
<property name="groups" value="/.*/"/>
186+
<property name="option" value="top"/>
176187
<property name="separated" value="true"/>
177-
<property name="ordered" value="true"/>
178-
<property name="groups" value="/^javax?\./,scala,*,org.apache.spark"/>
179188
<property name="sortStaticImportsAlphabetically" value="true"/>
180189
</module>
181-
<module name="Indentation"> <!-- Java Style Guide: Block indentation: +2 spaces -->
182-
<property name="arrayInitIndent" value="4"/>
183-
<property name="lineWrappingIndentation" value="4"/>
184-
<property name="basicOffset" value="2"/>
190+
<module name="Indentation"> <!-- Java Style Guide: Block indentation: +4 spaces -->
191+
<property name="arrayInitIndent" value="8"/>
192+
<property name="lineWrappingIndentation" value="8"/>
185193
</module>
186194
<module name="InnerAssignment"/> <!-- Java Coding Guidelines: Inner assignments: Not used -->
187195
<module name="LeftCurly"/> <!-- Java Style Guide: Nonempty blocks: K & R style -->
@@ -272,6 +280,11 @@
272280
<property name="format" value="CoreMatchers\.equalTo"/>
273281
<property name="message" value="Use Assert.assertEquals()."/>
274282
</module>
283+
<module name="RegexpSinglelineJava">
284+
<property name="id" value="BanJacksonFindAndRegisterModulesMethod"/>
285+
<property name="format" value="findAndRegisterModules"/>
286+
<property name="message" value="Use ObjectMapper#registerModule(&lt;yourModule&gt;) explicitly. ObjectMapper#findAndRegisterModules() is dangerous because it will change behaviour depending on which modules are on your classpath (including transitive dependencies)."/>
287+
</module>
275288
<module name="RegexpSinglelineJava"> <!-- Java Coding Guidelines: Use appropriate assertion methods -->
276289
<property name="format" value="CoreMatchers\.notNull"/>
277290
<property name="message" value="Use better assertion method(s): Assert.assertEquals(), assertNull(), assertSame(), etc."/>
@@ -322,6 +335,18 @@
322335
<property name="message" value="printStackTrace is not generally allowed."/>
323336
<property name="ignoreComments" value="true"/>
324337
</module>
338+
<module name="RegexpSinglelineJava">
339+
<property name="id" value="BanSystemOut"/>
340+
<property name="format" value="System\.out\."/>
341+
<property name="message" value="Logging with System.out is not allowed because it has no metadata and can't be configured at runtime. Please use an SLF4J logger instead, e.g. log.info(&quot;Message&quot;)."/>
342+
<property name="ignoreComments" value="true"/>
343+
</module>
344+
<module name="RegexpSinglelineJava">
345+
<property name="id" value="BanSystemErr"/>
346+
<property name="format" value="System\.err\."/>
347+
<property name="message" value="Logging with System.err is not allowed because it has no metadata and can't be configured at runtime. Please use an SLF4J logger instead, e.g. log.info(&quot;Message&quot;)."/>
348+
<property name="ignoreComments" value="true"/>
349+
</module>
325350
<module name="RegexpSinglelineJava">
326351
<property name="format" value="\bCharsets\."/>
327352
<property name="message" value="Use JDK StandardCharsets instead of alternatives."/>

.baseline/copyright/001_apache-2.0.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
(c) Copyright ${today.year} Palantir Technologies Inc. All rights reserved.
2+
13
Licensed under the Apache License, Version 2.0 (the "License");
24
you may not use this file except in compliance with the License.
35
You may obtain a copy of the License at

.baseline/idea/intellij-java-palantir-style.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
5151
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
5252
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
53+
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
5354
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
5455
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
5556
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
@@ -85,31 +86,39 @@
8586
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
8687
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
8788
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
89+
<option name="ASSIGNMENT_WRAP" value="1" />
8890
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
8991
<option name="BINARY_OPERATION_WRAP" value="1" />
9092
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
91-
<option name="CALL_PARAMETERS_WRAP" value="1" />
93+
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
94+
<option name="CALL_PARAMETERS_WRAP" value="5" />
9295
<option name="DOWHILE_BRACE_FORCE" value="3" />
96+
<option name="ENUM_CONSTANTS_WRAP" value="2" />
9397
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
9498
<option name="EXTENDS_LIST_WRAP" value="1" />
9599
<option name="FIELD_ANNOTATION_WRAP" value="1" />
96100
<option name="FOR_BRACE_FORCE" value="3" />
97101
<option name="FOR_STATEMENT_WRAP" value="1" />
98102
<option name="IF_BRACE_FORCE" value="3" />
99-
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
103+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
104+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
105+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
100106
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
101107
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
102108
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
109+
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
103110
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
104111
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
105112
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
106-
<option name="METHOD_PARAMETERS_WRAP" value="1" />
113+
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
114+
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
115+
<option name="METHOD_PARAMETERS_WRAP" value="5" />
107116
<option name="OPTIMIZE_IMPORTS_ON_THE_FLY" value="true" />
108117
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
109118
<option name="RESOURCE_LIST_WRAP" value="5" />
110119
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
111120
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
112-
<option name="TERNARY_OPERATION_WRAP" value="1" />
121+
<option name="TERNARY_OPERATION_WRAP" value="5" />
113122
<option name="THROWS_KEYWORD_WRAP" value="1" />
114123
<option name="THROWS_LIST_WRAP" value="1" />
115124
<option name="WHILE_BRACE_FORCE" value="3" />

build.gradle

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,23 @@ buildscript {
2323
}
2424

2525
dependencies {
26-
classpath 'com.palantir.baseline:gradle-baseline-java:0.29.2'
26+
classpath 'com.palantir.baseline:gradle-baseline-java:0.41.0'
27+
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.11.0'
2728
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
28-
classpath 'com.netflix.nebula:nebula-dependency-recommender:5.2.0'
29-
classpath 'com.netflix.nebula:nebula-publishing-plugin:5.1.5'
29+
classpath 'com.netflix.nebula:nebula-publishing-plugin:9.2.0'
3030
}
3131
}
3232

33-
plugins {
34-
id 'com.palantir.git-version' version '0.9.1'
35-
id "org.inferred.processors" version "1.2.16"
36-
}
37-
38-
apply plugin: 'com.palantir.baseline-config' // provides baselineUpdateConfig task
39-
apply plugin: 'com.palantir.baseline-idea'
4033
apply plugin: 'com.palantir.baseline'
41-
apply plugin: 'com.palantir.baseline-class-uniqueness'
42-
43-
dependencies {
44-
baseline "com.palantir.baseline:gradle-baseline-java-config:0.29.2@zip"
45-
}
34+
apply plugin: 'com.palantir.git-version'
4635

4736
allprojects {
4837
group 'org.apache.spark'
4938
version System.env.CIRCLE_TAG ?: gitVersion()
5039
buildDir = 'gradle-build'
5140

52-
apply plugin: 'idea'
53-
apply plugin: 'nebula.dependency-recommender'
54-
5541
repositories {
5642
jcenter()
5743
maven { url "http://palantir.bintray.com/releases" }
5844
}
59-
60-
dependencyRecommendations {
61-
strategy OverrideTransitives
62-
propertiesFile file: project.rootProject.file('versions.props')
63-
}
6445
}

spark-docker-image-generator/build.gradle

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18-
plugins {
19-
id 'java-gradle-plugin'
20-
}
21-
22-
apply plugin: 'java'
23-
apply plugin: 'idea'
18+
apply plugin: 'java-gradle-plugin'
2419
apply from: "${rootDir}/gradle/publish.gradle"
2520

26-
sourceCompatibility = 1.8
21+
java {
22+
sourceCompatibility JavaVersion.VERSION_1_8
23+
}
2724

2825
dependencies {
2926
compile gradleApi()
@@ -36,11 +33,6 @@ dependencies {
3633
testCompile gradleTestKit()
3734
}
3835

39-
test {
40-
minHeapSize = "512m"
41-
maxHeapSize = "512m"
42-
}
43-
4436
task prepareDockerBundleDir(type: Zip) {
4537
from("${rootDir}/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile") {
4638
into 'kubernetes/dockerfiles/spark'
@@ -83,6 +75,8 @@ publishing {
8375

8476
test {
8577
systemProperty 'docker-resources-zip-path', "${buildDir}/docker-resources/docker-resources.zip"
78+
minHeapSize = "512m"
79+
maxHeapSize = "512m"
8680
}
8781

8882
tasks.test.dependsOn tasks.publishDockerBundlePublicationToMavenTestRepository

spark-docker-image-generator/src/main/java/org/apache/spark/deploy/kubernetes/docker/gradle/DockerBuildTask.java

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,56 @@
1717
package org.apache.spark.deploy.kubernetes.docker.gradle;
1818

1919
import java.io.File;
20-
2120
import org.gradle.api.DefaultTask;
2221
import org.gradle.api.provider.Property;
2322
import org.gradle.api.tasks.Input;
2423
import org.gradle.api.tasks.InputDirectory;
2524
import org.gradle.api.tasks.InputFile;
2625
import org.gradle.api.tasks.TaskAction;
2726

28-
public class DockerBuildTask extends DefaultTask {
27+
public class DockerBuildTask extends DefaultTask {
2928

30-
private File dockerFile;
31-
private File dockerBuildDirectory;
32-
private Property<String> imageName;
29+
private File dockerFile;
30+
private File dockerBuildDirectory;
31+
private Property<String> imageName;
3332

34-
@InputFile
35-
public final File getDockerFile() {
36-
return dockerFile;
37-
}
33+
@InputFile
34+
public final File getDockerFile() {
35+
return dockerFile;
36+
}
3837

39-
@InputDirectory
40-
public final File getDockerBuildDirectory() {
41-
return dockerBuildDirectory;
42-
}
38+
@InputDirectory
39+
public final File getDockerBuildDirectory() {
40+
return dockerBuildDirectory;
41+
}
4342

44-
@Input
45-
public final Property<String> getImageName() {
46-
return imageName;
47-
}
43+
@Input
44+
public final Property<String> getImageName() {
45+
return imageName;
46+
}
4847

49-
public final void setDockerFile(File dockerFile) {
50-
this.dockerFile = dockerFile;
51-
}
48+
public final void setDockerFile(File dockerFile) {
49+
this.dockerFile = dockerFile;
50+
}
5251

53-
public final void setDockerBuildDirectory(File dockerBuildDirectory) {
54-
this.dockerBuildDirectory = dockerBuildDirectory;
55-
}
52+
public final void setDockerBuildDirectory(File dockerBuildDirectory) {
53+
this.dockerBuildDirectory = dockerBuildDirectory;
54+
}
5655

57-
public final void setImageName(Property<String> imageName) {
58-
this.imageName = imageName;
59-
}
56+
public final void setImageName(Property<String> imageName) {
57+
this.imageName = imageName;
58+
}
6059

61-
@TaskAction
62-
public final void exec() {
63-
getProject().exec(execSpec -> execSpec.commandLine(
64-
"docker",
65-
"build",
66-
"-f",
67-
dockerFile.getAbsolutePath(),
68-
"-t",
69-
imageName.get(),
70-
dockerBuildDirectory.getAbsolutePath()));
71-
}
60+
@TaskAction
61+
public final void exec() {
62+
getProject().exec(execSpec -> execSpec.commandLine(
63+
"docker",
64+
"build",
65+
"-f",
66+
dockerFile.getAbsolutePath(),
67+
"-t",
68+
imageName.get(),
69+
dockerBuildDirectory.getAbsolutePath()));
70+
}
7271

7372
}

0 commit comments

Comments
 (0)