Skip to content

Commit

Permalink
Basic infrastructure.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalohlava committed Oct 14, 2014
1 parent e645edd commit f4f87e5
Show file tree
Hide file tree
Showing 11 changed files with 469 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
@@ -0,0 +1,4 @@
*.java text eol=lf
*.py text eol=lf
*.sh text eol=lf
.git* text eol=lf
14 changes: 14 additions & 0 deletions .gitignore
Expand Up @@ -10,3 +10,17 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Private things
private/
tmp/
build/
lib/
out/
*iws
*ipr
.settings/
.gradle/
.DS_Store*
*.ipr

66 changes: 66 additions & 0 deletions build.gradle
@@ -0,0 +1,66 @@
//
// The top-level h2o-dev project does not have any java pieces itself, but
// apply from the standard java.gradle so that 'gradle idea' generates IDE
// files with the right settings.
//
// The top-level h2o-dev.jar file that gets produced is empty and not usable
// for anything. Use the jar file produced by the h2o-web subproject.
//

// The build script settings to fetch plugins and put them on
// classpath
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url "http://dl.bintray.com/releashaus/release" }
}

dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.1.1'
classpath 'org.github.mansur.scalastyle:gradle-scalastyle-plugin_2.10:0.4.1'
}
}

//
// For all projects (this and all subprojects) specify common properties and tasks
//
configure(allprojects) { project ->
group = 'ai.h2o'

apply plugin: 'idea'
apply plugin: 'eclipse'
apply from: "$rootDir/gradle/artifacts.gradle"

// Version of main components
ext {
scalaVersion = '2.10.4'
scalaBinaryVersion = '2.10'
h2oVersion = '0.1.6'
sparkVersion = '1.1.0'
}
}

//
// Common configuration for all subprojects
//
configure(subprojects) { project ->
// All project inherits the same versioning number
version = rootProject.version

repositories {
mavenCentral()
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos/"
}
}


// All subprojects are scala project so apply the plugin directly
apply from: "$rootDir/gradle/scala.gradle"
}

task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}

4 changes: 4 additions & 0 deletions gradle.properties
@@ -0,0 +1,4 @@
version=0.1.6-SNAPSHOT
major=0
minor=1
incremental=6
13 changes: 13 additions & 0 deletions gradle/artifacts.gradle
@@ -0,0 +1,13 @@
// Print all artifacts of given project
task artifacts {
group = "Help"
description = "Displays the artifacts associated with each configuration of " + project
doFirst {
configurations.findAll().each { config ->
println "${config}:"
config.allArtifacts.getFiles().each { file -> println " " + file}
println ' '
}
}
}

144 changes: 144 additions & 0 deletions gradle/conf/scalastyle-config.xml
@@ -0,0 +1,144 @@
<!--
~ 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.
-->
<!-- If you wish to turn off checking for a section of code, you can put a comment in the source
before and after the section, with the following syntax: -->
<!-- // scalastyle:off -->
<!-- ... -->
<!-- // naughty stuff -->
<!-- ... -->
<!-- // scalastyle:on -->

<scalastyle>
<name>Scalastyle standard configuration</name>
<check level="error" class="org.scalastyle.file.FileTabChecker" enabled="true"></check>
<!-- <check level="error" class="org.scalastyle.file.FileLengthChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="maxFileLength"><![CDATA[800]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<check level="error" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
<parameters>
<parameter name="header"><![CDATA[/*
* 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.
*/]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="false"></check>
<check level="error" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
<parameters>
<parameter name="maxLineLength"><![CDATA[100]]></parameter>
<parameter name="tabSize"><![CDATA[2]]></parameter>
<parameter name="ignoreImports">true</parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="false"></check>
<!-- <check level="error" class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<check level="error" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true">
<parameters>
<parameter name="maxParameters"><![CDATA[10]]></parameter>
</parameters>
</check>
<!-- <check level="error" class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="ignore"><![CDATA[-1,0,1,2,3]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<check level="error" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="false"></check>
<check level="error" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="false"></check>
<!-- <check level="error" class="org.scalastyle.scalariform.ReturnChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.NullChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.NoCloneChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"></check> -->
<!-- <check level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="regex"><![CDATA[println]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="maxTypes"><![CDATA[30]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="maximum"><![CDATA[10]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<check level="error" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="false"></check>
<check level="error" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true">
<parameters>
<parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
<parameter name="doubleLineAllowed"><![CDATA[true]]></parameter>
</parameters>
</check>
<!-- <check level="error" class="org.scalastyle.scalariform.MethodLengthChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="maxLength"><![CDATA[50]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="true"> -->
<!-- <parameters> -->
<!-- <parameter name="maxMethods"><![CDATA[30]]></parameter> -->
<!-- </parameters> -->
<!-- </check> -->
<!-- <check level="error" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true"></check> -->
<check level="error" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="false"></check>
<check level="error" class="org.apache.spark.scalastyle.SparkSpaceAfterCommentStartChecker" enabled="true"></check>
</scalastyle>
39 changes: 39 additions & 0 deletions gradle/scala.gradle
@@ -0,0 +1,39 @@
apply plugin: 'scala'

// Specify properties
project.ext {
scalaBinaryVersion = '2.10'
scalaVersion = '2.10.4'
}

// Activate Zinc compiler and configure scalac
tasks.withType(ScalaCompile) {
scalaCompileOptions.useCompileDaemon = false
scalaCompileOptions.useAnt = false
scalaCompileOptions.additionalParameters = ['-target:jvm-1.6']
}

jar {
baseName = "${project.name}_${scalaBinaryVersion}"
}

// Create jar
task testJar(type: Jar, dependsOn: testClasses) {
baseName = "${project.name}_${scalaBinaryVersion}"
appendix = 'test'
from sourceSets.test.output
}

// Create a configuration containing only for test artifacts
configurations {
testArchives
}

// Explicitly
artifacts {
testArchives testJar
}

// Enable scalastyle
apply from: "$rootDir/gradle/scalastyle.gradle"

10 changes: 10 additions & 0 deletions gradle/scalastyle.gradle
@@ -0,0 +1,10 @@
apply plugin: 'scalaStyle'

scalaStyle {
//configLocation = "$rootDir/gradle/conf/scalastyle_conf.xml"
configLocation = "$rootDir/gradle/conf/scalastyle-config.xml"
includeTestSourceDirectory = true
source = "src/main/scala"
testSource = "src/test/scala"
}

6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
#Tue Aug 26 17:18:31 PDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip

0 comments on commit f4f87e5

Please sign in to comment.