Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 39 additions & 0 deletions java-scala-spark4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Eclipse files
.metadata/
.classpath
.project
.settings/

# Maven build artifacts
target/
dependency-reduced-pom.xml

# Gradle build artifacts
.gradle
build
gradle/wrapper/*.jar

# IntelliJ
*.ipr
*.iws
*.iml
.idea/
classes
**/out
23 changes: 23 additions & 0 deletions java-scala-spark4/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
style = defaultWithAlign

align = false
binPack {
literalArgumentLists = true
parentConstructors = true
}
docstrings = JavaDoc
lineEndings = unix
maxColumn = 100
newlines {
alwaysBeforeTopLevelStatements = true
penalizeSingleSelectMultiArgList = false
}
rewrite.rules = [
avoidinfix,
expandimportselectors,
prefercurlyfors,
]
spaces {
inImportCurlyBraces = false
}
unindentTopLevelOperators = true
169 changes: 169 additions & 0 deletions java-scala-spark4/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

= Kudu Java Developer Documentation

== System Requirements

- Runtime
* Java 8+
- Build time
* Java 8+
- Test time
* Built Kudu Binaries
* MIT Kerberos (krb5)

== Building Everything

[source,bash]
----
$ ./gradlew assemble
----

== Building Just the Client

[source,bash]
----
$ ./gradlew :kudu-client:assemble
----

The client jar can then be found at `kudu-client/build/libs`.

== Running the Tests

The tests may locate the master and tablet server
binaries by looking in `build/latest/bin` from the root of
the git repository. If you have recently built the C++ code
for Kudu, those should be present already.

If for some reason the binaries aren't in the expected location
as shown above, you can pass
`-DkuduBinDir=/path/to/directory`.

Once everything is setup correctly, run:

[source,bash]
----
$ ./gradlew test
----

If you would like to force tests that were already run to re-run
you can pass `-PrerunTests`. Another option is to run

[source,bash]
----
$ ./gradlew cleanTest test
----

The difference is that the latter spends extra time re-building test state,
while the former runs them again. Using -PrerunTests can be useful to quickly
loop on tests with less slowdown. See
https://docs.gradle.org/5.6.4/userguide/java_testing.html#sec:forcing_java_tests_to_run[here]
for more details.

If you would like to run a subset of the tests or a single test
you can pass the Gradle `--tests <pattern>` argument to filter
the tests ran.
See https://docs.gradle.org/current/userguide/java_testing.html#test_filtering[here]
for detailed documentation of all pattern options.

Single Test Class Example:

[source,bash]
----
$ ./gradlew :kudu-client:test --tests org.apache.kudu.TestColumnSchema
----

Single Test Method Example:

[source,bash]
----
$ ./gradlew :kudu-client:test --tests org.apache.kudu.TestColumnSchema.testEquals
----

Pattern Example:

[source,bash]
----
$ ./gradlew test --tests *IT*
----

== Additional Gradle Commands

=== Discovering Other Gradle Tasks

[source,bash]
----
$ ./gradlew tasks
----

=== Clearing Build State

[source,bash]
----
$ ./gradlew clean
----

Note: You generally don't need to run this task, but it can be useful
to rule out any build issues.

=== Installing Artifacts to the Local Maven Repository

[source,bash]
----
$ ./gradlew install
----

=== Checking for Dependency Updates

[source,bash]
----
./gradlew dependencyUpdates
----

NOTE: Additional Gradle command line flag options can be found
https://docs.gradle.org/current/userguide/command_line_interface.html[here].

== Tips for IDEs

=== IntelliJ

Follow the standard instructions as laid out
https://www.jetbrains.com/help/idea/gradle.html#gradle_import[here]
to import the Gradle project.

For the most consistent behavior on the command line and
in the IDE, be sure to enable `Delegate IDE build/run actions to gradle`
and run tests using the `Gradle Test Runner` as described
https://www.jetbrains.com/help/idea/gradle.html#delegate_build_gradle[here].

Some of the classes generated by Kudu Protobuf files are larger than the
default "intellisense" limit in Intellij. This means Intellij won't
provide code assistance for the classes in those files and may indicate
that the classes in those files are not found. Follow the instructions
https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties[here]
to set "idea.max.intellisense.filesize=5000" in the `idea.properties` file
to work around this issue.

=== Eclipse

Follow the instructions as laid out
http://www.vogella.com/tutorials/EclipseGradle/article.html#eclipse-gradle-support[here]
to install the Eclipse Gradle (Buildship) tooling.
Then follow the instruction on the same page
http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project[here]
to import an existing project.
114 changes: 114 additions & 0 deletions java-scala-spark4/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.apache.kudu.gradle.DistTestTask

// This file is the entry-point for the gradle build and contains
// common logic for the various subprojects in the build.
// Plugins and scripts are applied in the natural "build order"
// they are used to ensure there are no dependency issues.

// Plugins and scripts applied at the root level only, instead of per module.
apply plugin: "idea"
apply plugin: "eclipse"
apply plugin: "org.barfuin.gradle.jacocolog"
apply from: "$rootDir/gradle/properties.gradle"
apply from: "$rootDir/gradle/dependencies.gradle"
apply from: "$rootDir/gradle/wrapper.gradle"

allprojects {
// These are common to all projects, including this
// top level parent project.
repositories {
mavenCentral()
mavenLocal()
}

// Read the version.txt file to set the project version
project.version = file("$rootDir/../version.txt").text.trim()

apply from: "$rootDir/gradle/docs.gradle"
}

subprojects {
// These are common to all subprojects. However, subprojects may
// include their own plugins and scripts as well.
apply plugin: "java"
apply from: "$rootDir/gradle/scopes.gradle"
apply from: "$rootDir/gradle/compile.gradle"
apply from: "$rootDir/gradle/tests.gradle"
apply from: "$rootDir/gradle/quality.gradle"
apply from: "$rootDir/gradle/artifacts.gradle"
apply from: "$rootDir/gradle/publishing.gradle"

// Ignore the transitive annotations libraries that are
// not marked as optional in Guava version 22.0+.
// See https://github.com/google/guava/issues/2824
configurations.compile {
exclude group: "com.google.errorprone", module: "error_prone_annotations"
exclude group: "com.google.code.findbugs", module: "jsr305"
exclude group: "com.google.j2objc", module: "j2objc-annotations"
exclude group: "org.checkerframework", module: "checker-compat-qual"
exclude group: "org.codehaus.mojo", module: "animal-sniffer-annotations"
}

sourceSets {
all {
configurations.all { conf ->
attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm")
}
}
}
}

// A task that does nothing, but is useful to ensure the Gradle build and tasks are initialized.
task initializeTasks() {
doLast {
println("Initialized Gradle tasks")
}
}

task javadocAggregate(type: Javadoc, group: "Documentation") {
description = "Generates Aggregate Javadoc API documentation for the main source code."
source subprojects.collect { it.sourceSets.main.allJava }
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
destinationDir = file("${buildDir}/docs/javadoc")
}

// Copies all the dependency jars locally so that we can reference
// them inside the project structure while running the distributed
// tests instead of in the gradle cache which is in the users home
// directory by default.
task copyDistTestJars(type: Copy) {
into "$buildDir/jars/"
from subprojects.collect {
it.configurations.testRuntime
}
from subprojects.collect {
it.configurations.provided
}
}

// Task called by dist_test.py to generate the needed .isolate and .gen.json
// files needed to run the distributed tests.
task distTest(type: DistTestTask, dependsOn: copyDistTestJars) {
subprojects.each {
it.tasks.withType(Test).each {
addTestTask it
}
}
}
49 changes: 49 additions & 0 deletions java-scala-spark4/buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// This file contains the dependencies required for the gradle build itself.

repositories {
mavenCentral()
jcenter()
maven { url "https://clojars.org/repo" } // Only used for the clojure plugin below.
maven { url "https://plugins.gradle.org/m2/" }
}

// Manage plugin dependencies since the plugin block can't be used in included build scripts yet.
// For more details see: https://docs.gradle.org/current/userguide/plugins.html#plugins_dsl_limitations
dependencies {
compile "com.github.ben-manes:gradle-versions-plugin:0.41.0"
compile "com.github.jengelman.gradle.plugins:shadow:6.1.0"
compile "gradle.plugin.org.barfuin.gradle.jacocolog:gradle-jacoco-log:1.2.4"
compile "gradle.plugin.com.google.gradle:osdetector-gradle-plugin:1.7.0"
compile "com.google.protobuf:protobuf-gradle-plugin:0.8.18"
compile "com.netflix.nebula:nebula-clojure-plugin:10.1.1"
compile "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.0"
compile "gradle.plugin.cn.bestwu.gradle:propdeps-plugin:0.0.10"
compile "net.ltgt.gradle:gradle-errorprone-plugin:2.0.2"
compile "ru.vyarus:gradle-animalsniffer-plugin:1.5.4"
compile "com.google.code.gson:gson:2.8.9"
compile "cz.alenkacz:gradle-scalafmt:1.14.0"
compile "com.google.guava:guava:31.0.1-jre"
compile "me.champeau.gradle:jmh-gradle-plugin:0.5.3"
}

// Compiler configuration
tasks.withType(GroovyCompile) {
options.compilerArgs << '-proc:none' // Ignore leaked annotation processors on the compile classpath.
}
Loading