Skip to content

Commit

Permalink
Upgrade baseline to 0.41.0 (apache-spark-on-k8s#454)
Browse files Browse the repository at this point in the history
Need to figure out how to merge the checkstyles because otherwise we will end up with a lot of mess
  • Loading branch information
robert3005 authored and Robert Kruszewski committed Jan 6, 2019
1 parent 8f1c124 commit 4da7726
Show file tree
Hide file tree
Showing 18 changed files with 541 additions and 536 deletions.
5 changes: 5 additions & 0 deletions .baseline/checkstyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VariableDeclarationUsageDistance" />
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VisibilityModifier" />
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="AvoidStaticImport" />
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemOut" />
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemErr" />

<!-- Suppress test resources -->
<suppress files="[/\\]src[/\\]test[/\\]resources.*" checks="." />

<!-- JavadocStyle enforces existence of package-info.java package-level Javadoc; we consider this a bug. -->
<suppress files="package-info.java" checks="JavadocStyle" />
Expand Down
45 changes: 35 additions & 10 deletions .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@
<message key="import.illegal" value="Use JUnit 4-style (org.junit.*) test classes and assertions instead of JUnit 3 (junit.framework.*)."/>
</module>
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
<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"/>
<property name="illegalPkgs" value="org.elasticsearch.common.base, com.clearspring.analytics.util, org.spark_project.guava"/>
<message key="import.illegal" value="Must not import repackaged classes."/>
</module>
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
<property name="illegalPkgs" value=".*\.(repackaged|shaded|thirdparty)"/>
<property name="regexp" value="true" />
<message key="import.illegal" value="Must not import repackaged classes."/>
</module>
<module name="IllegalImport">
<property name="illegalPkgs" value="^org\.gradle\..*internal"/>
<property name="illegalPkgs" value="^org\.gradle\.(internal|.*\.internal)"/>
<property name="regexp" value="true" />
<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."/>
</module>
<module name="IllegalImport">
Expand All @@ -148,6 +154,10 @@
<property name="illegalPkgs" value="org.apache.log4j, org.apache.logging.log4j, java.util.logging, ch.qos.logback"/>
<message key="import.illegal" value="Use SLF4J instead of a logging framework directly."/>
</module>
<module name="IllegalImport">
<property name="illegalClasses" value="com.google.common.base.Optional, com.google.common.base.Supplier"/>
<message key="import.illegal" value="Use the Java8 version of Guava objects."/>
</module>
<module name="IllegalInstantiation"> <!-- Java Coding Guidelines: Never instantiate primitive types -->
<property name="classes" value="java.lang.Boolean"/>
<property name="classes" value="java.lang.Byte"/>
Expand All @@ -171,17 +181,15 @@
<property name="illegalClassNames" value="com.google.common.cache.CacheBuilder, com.google.common.cache.Cache, com.google.common.cache.LoadingCache"/>
<message key="illegal.type" value="Do not use Guava caches, they are outperformed by and harder to use than Caffeine caches"/>
</module>
<!-- Use Spark's built-in import ordering -->
<module name="ImportOrder">
<module name="ImportOrder"> <!-- Java Style Guide: Ordering and spacing -->
<property name="groups" value="/.*/"/>
<property name="option" value="top"/>
<property name="separated" value="true"/>
<property name="ordered" value="true"/>
<property name="groups" value="/^javax?\./,scala,*,org.apache.spark"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="Indentation"> <!-- Java Style Guide: Block indentation: +2 spaces -->
<property name="arrayInitIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="basicOffset" value="2"/>
<module name="Indentation"> <!-- Java Style Guide: Block indentation: +4 spaces -->
<property name="arrayInitIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
</module>
<module name="InnerAssignment"/> <!-- Java Coding Guidelines: Inner assignments: Not used -->
<module name="LeftCurly"/> <!-- Java Style Guide: Nonempty blocks: K & R style -->
Expand Down Expand Up @@ -272,6 +280,11 @@
<property name="format" value="CoreMatchers\.equalTo"/>
<property name="message" value="Use Assert.assertEquals()."/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="BanJacksonFindAndRegisterModulesMethod"/>
<property name="format" value="findAndRegisterModules"/>
<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)."/>
</module>
<module name="RegexpSinglelineJava"> <!-- Java Coding Guidelines: Use appropriate assertion methods -->
<property name="format" value="CoreMatchers\.notNull"/>
<property name="message" value="Use better assertion method(s): Assert.assertEquals(), assertNull(), assertSame(), etc."/>
Expand Down Expand Up @@ -322,6 +335,18 @@
<property name="message" value="printStackTrace is not generally allowed."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="BanSystemOut"/>
<property name="format" value="System\.out\."/>
<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;)."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="BanSystemErr"/>
<property name="format" value="System\.err\."/>
<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;)."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="\bCharsets\."/>
<property name="message" value="Use JDK StandardCharsets instead of alternatives."/>
Expand Down
2 changes: 2 additions & 0 deletions .baseline/copyright/001_apache-2.0.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(c) Copyright ${today.year} Palantir Technologies Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
17 changes: 13 additions & 4 deletions .baseline/idea/intellij-java-palantir-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
Expand Down Expand Up @@ -85,31 +86,39 @@
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="5" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="ENUM_CONSTANTS_WRAP" value="2" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="1" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="OPTIMIZE_IMPORTS_ON_THE_FLY" value="true" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<option name="RESOURCE_LIST_WRAP" value="5" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1" />
<option name="WHILE_BRACE_FORCE" value="3" />
Expand Down
27 changes: 4 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,23 @@ buildscript {
}

dependencies {
classpath 'com.palantir.baseline:gradle-baseline-java:0.29.2'
classpath 'com.palantir.baseline:gradle-baseline-java:0.41.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.11.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:nebula-dependency-recommender:5.2.0'
classpath 'com.netflix.nebula:nebula-publishing-plugin:5.1.5'
classpath 'com.netflix.nebula:nebula-publishing-plugin:9.2.0'
}
}

plugins {
id 'com.palantir.git-version' version '0.9.1'
id "org.inferred.processors" version "1.2.16"
}

apply plugin: 'com.palantir.baseline-config' // provides baselineUpdateConfig task
apply plugin: 'com.palantir.baseline-idea'
apply plugin: 'com.palantir.baseline'
apply plugin: 'com.palantir.baseline-class-uniqueness'

dependencies {
baseline "com.palantir.baseline:gradle-baseline-java-config:0.29.2@zip"
}
apply plugin: 'com.palantir.git-version'

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

apply plugin: 'idea'
apply plugin: 'nebula.dependency-recommender'

repositories {
jcenter()
maven { url "http://palantir.bintray.com/releases" }
}

dependencyRecommendations {
strategy OverrideTransitives
propertiesFile file: project.rootProject.file('versions.props')
}
}
18 changes: 6 additions & 12 deletions spark-docker-image-generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
* limitations under the License.
*/

plugins {
id 'java-gradle-plugin'
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'java-gradle-plugin'
apply from: "${rootDir}/gradle/publish.gradle"

sourceCompatibility = 1.8
java {
sourceCompatibility JavaVersion.VERSION_1_8
}

dependencies {
compile gradleApi()
Expand All @@ -36,11 +33,6 @@ dependencies {
testCompile gradleTestKit()
}

test {
minHeapSize = "512m"
maxHeapSize = "512m"
}

task prepareDockerBundleDir(type: Zip) {
from("${rootDir}/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile") {
into 'kubernetes/dockerfiles/spark'
Expand Down Expand Up @@ -83,6 +75,8 @@ publishing {

test {
systemProperty 'docker-resources-zip-path', "${buildDir}/docker-resources/docker-resources.zip"
minHeapSize = "512m"
maxHeapSize = "512m"
}

tasks.test.dependsOn tasks.publishDockerBundlePublicationToMavenTestRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,56 @@
package org.apache.spark.deploy.kubernetes.docker.gradle;

import java.io.File;

import org.gradle.api.DefaultTask;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.TaskAction;

public class DockerBuildTask extends DefaultTask {
public class DockerBuildTask extends DefaultTask {

private File dockerFile;
private File dockerBuildDirectory;
private Property<String> imageName;
private File dockerFile;
private File dockerBuildDirectory;
private Property<String> imageName;

@InputFile
public final File getDockerFile() {
return dockerFile;
}
@InputFile
public final File getDockerFile() {
return dockerFile;
}

@InputDirectory
public final File getDockerBuildDirectory() {
return dockerBuildDirectory;
}
@InputDirectory
public final File getDockerBuildDirectory() {
return dockerBuildDirectory;
}

@Input
public final Property<String> getImageName() {
return imageName;
}
@Input
public final Property<String> getImageName() {
return imageName;
}

public final void setDockerFile(File dockerFile) {
this.dockerFile = dockerFile;
}
public final void setDockerFile(File dockerFile) {
this.dockerFile = dockerFile;
}

public final void setDockerBuildDirectory(File dockerBuildDirectory) {
this.dockerBuildDirectory = dockerBuildDirectory;
}
public final void setDockerBuildDirectory(File dockerBuildDirectory) {
this.dockerBuildDirectory = dockerBuildDirectory;
}

public final void setImageName(Property<String> imageName) {
this.imageName = imageName;
}
public final void setImageName(Property<String> imageName) {
this.imageName = imageName;
}

@TaskAction
public final void exec() {
getProject().exec(execSpec -> execSpec.commandLine(
"docker",
"build",
"-f",
dockerFile.getAbsolutePath(),
"-t",
imageName.get(),
dockerBuildDirectory.getAbsolutePath()));
}
@TaskAction
public final void exec() {
getProject().exec(execSpec -> execSpec.commandLine(
"docker",
"build",
"-f",
dockerFile.getAbsolutePath(),
"-t",
imageName.get(),
dockerBuildDirectory.getAbsolutePath()));
}

}
Loading

0 comments on commit 4da7726

Please sign in to comment.