Skip to content

Commit

Permalink
[CALCITE-2905] Migrate build scripts to Gradle
Browse files Browse the repository at this point in the history
In case you are lost:

./gradlew tasks # shows the list of possible tasks
./gradlew assemble # creates the archives, zips, etc

The results of the tasks is produced to build/* folders
For instance, core/build/libs/...

./gradlew test # executes tests
./gradlew build # builds and executes the tests

./gradlew dependencies # shows "classpath"
  • Loading branch information
vlsi committed Nov 19, 2019
1 parent 94e6272 commit 66c9cd5
Show file tree
Hide file tree
Showing 99 changed files with 3,516 additions and 373 deletions.
46 changes: 46 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
indent_style = space

[{*.sh,gradlew}]
end_of_line = lf

[{*.bat,*.cmd}]
end_of_line = crlf

[{*.kts,*.kt}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_name_count_to_use_star_import = 99
ij_kotlin_name_count_to_use_star_import_for_members = 99
ij_java_use_single_class_imports = true
max_line_length = 100
ij_any_wrap_long_lines = true

[*.java]
# Doc: https://youtrack.jetbrains.com/issue/IDEA-170643#focus=streamItem-27-3708697.0-0
# $ means "static"
ij_java_imports_layout = org.apache.calcite.**,|,org.apache.**,|,au.com.**,|,com.**,|,io.**,|,mondrian.**,|,net.**,|,org.**,|,scala.**,|,java.**,javax.**,|,*,|,$com.**,|,$org.apache.calcite.**,|,$org.apache.**,|,$org.**,|,$java,|,$*
indent_size = 2
tab_width = 2
max_line_length = 100
ij_any_spaces_around_additive_operators = true
ij_any_spaces_around_assignment_operators = true
ij_any_spaces_around_bitwise_operators = true
ij_any_spaces_around_equality_operators = true
ij_any_spaces_around_lambda_arrow = true
ij_any_spaces_around_logical_operators = true
ij_any_spaces_around_multiplicative_operators = true
ij_any_spaces_around_relational_operators = true
ij_any_spaces_around_shift_operators = true
ij_continuation_indent_size = 4
ij_java_if_brace_force = always
ij_java_indent_case_from_switch = false
ij_java_space_after_colon = true
ij_java_space_before_colon = true
ij_java_ternary_operation_signs_on_next_line = true
ij_java_use_single_class_imports = true
ij_java_wrap_long_lines = true
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners

jobs:
windows:
name: 'Windows (JDK 11)'
runs-on: windows-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 50
- name: 'Set up JDK 11'
uses: actions/setup-java@v1
with:
java-version: 11
- name: 'Test'
shell: cmd
run: |
./gradlew --no-parallel --no-daemon build javadoc
linux-avatica:
name: 'Linux (JDK 13), Avatica master'
runs-on: ubuntu-latest
steps:
- name: 'Set up JDK 13'
uses: actions/setup-java@v1
with:
java-version: 13
- name: 'Install Avatica to Maven Local repository'
run: |
git clone --branch master --depth 100 https://github.com/apache/calcite-avatica.git ../calcite-avatica
cd ../calcite-avatica
./gradlew publishToMavenLocal -Pcalcite.avatica.version=1.0.0-dev-master -PskipJavadoc
- uses: actions/checkout@master
with:
fetch-depth: 50
- name: 'Test'
run: |
./gradlew --no-parallel --no-daemon build javadoc -Pcalcite.avatica.version=1.0.0-dev-master-SNAPSHOT -PenableMavenLocal
mac:
name: 'macOS (JDK 13)'
runs-on: macos-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 50
- name: 'Set up JDK 13'
uses: actions/setup-java@v1
with:
java-version: 13
- name: 'Test'
run: |
./gradlew --no-parallel --no-daemon build javadoc
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@
# limitations under the License.
#
*~
target
.idea
.gradle
/target
/*/target
/example/*/target
/build
/*/build
/example/*/build
/buildSrc/build
/buildSrc/subprojects/*/build

# IDEA
/out
/*/out/
/example/*/out
/.idea
*.iml

settings.xml
.classpath.txt
.fullclasspath.txt
Expand Down
47 changes: 47 additions & 0 deletions .ratignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
**/.editorconfig
**/.gitignore
**/.gitattributes
.github/workflows
.ratignore
**/META-INF/services/java.sql.Driver
**/src/test/resources/**/*.csv
**/src/test/resources/**/*.txt
**/src/test/resources/bug/archers.json
**/src/test/resources/foodmart-schema.spec
**/src/test/resources/*.json
**/data.txt
**/data2.txt
#bu ildSrc/build
#b uildSrc/subprojects/*/build

# TODO: remove when pom.xml files are removed
src/main/config/licenses

# Files generated by Jekyll
site/_includes/anchor_links.html
site/_includes/docs_contents.html
site/_includes/docs_contents_mobile.html
site/_includes/docs_option.html
site/_includes/docs_ul.html
site/_includes/footer.html
site/_includes/header.html
site/_includes/news_contents.html
site/_includes/news_contents_mobile.html
site/_includes/news_item.html
site/_includes/primary-nav-items.html
site/_includes/section_nav.html
site/_includes/top.html
site/_layouts/default.html
site/_layouts/docs.html
site/_layouts/external.html
site/_layouts/news.html
site/_layouts/news_item.html
site/_layouts/page.html
site/_sass/**
site/css/screen.scss
site/fonts/**
site/js/**

# Images
site/img/*.png
site/favicon.ico
40 changes: 16 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,32 @@ language: java
matrix:
fast_finish: true
include:
- env: IMAGE=maven:3-jdk-13
- env: IMAGE=maven:3-jdk-12
- env: IMAGE=maven:3-jdk-11 JDOC=Y RAT=Y
- env: IMAGE=maven:3-jdk-10 SLOW_TESTS=Y
- env: IMAGE=maven:3-jdk-9
- env: IMAGE=maven:3-jdk-8 JDOC=Y
- jdk: openjdk8
- jdk: openjdk11
- jdk: openjdk11
env:
- SLOW_TESTS=Y
branches:
only:
- master
- new-master
- javadoc
- /^branch-.*$/
- /^[0-9]+-.*$/
env:
global:
- DOCKERRUN="docker run -it --rm -v $PWD:/src -v $HOME/.m2:/root/.m2 -w /src"
services:
- docker
before_install:
- docker pull $IMAGE
install:
# Print the Maven version, skip tests and javadoc
- $DOCKERRUN $IMAGE mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Djavax.net.ssl.trustStorePassword=changeit -B -V
install: true
script:
# Print surefire output to the console instead of files
- unset _JAVA_OPTIONS
- if [ $JDOC = "Y" ]; then export JDOC=javadoc:javadoc; fi
- if [ $RAT = "Y" ]; then export RAT="apache-rat:check -Drat.consoleOutput"; fi
- if [ $SLOW_TESTS = "Y" ]; then export TESTS="-Dgroups=org.apache.calcite.test.SlowTests --projects :calcite-core"; else export TESTS=-DskipSlowTests; fi
- $DOCKERRUN $IMAGE mvn -Dcheckstyle.skip -Dsurefire.useFile=false -Dsurefire.threadCount=1 -Dsurefire.perCoreThreadCount=false -Djavax.net.ssl.trustStorePassword=changeit test $TESTS $JDOC $RAT
- if [ $SLOW_TESTS = "Y" ]; then export TEST_TAGS=-PincludeTestTags=org.apache.calcite.test.SlowTests; fi
- ./gradlew --no-daemon build $TEST_TAGS
git:
depth: 10000
sudo: required
depth: 100
cache:
directories:
- $HOME/.m2
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

# End .travis.yml
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
{% endcomment %}
-->
[![Travis Build Status](https://travis-ci.org/apache/calcite.svg?branch=master)](https://travis-ci.org/apache/calcite)
[![CI Status](https://github.com/apache/calcite/workflows/CI/badge.svg)](https://github.com/apache/calcite/actions)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/apache/calcite?svg=true&branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/calcite)

# Apache Calcite
Expand Down
62 changes: 62 additions & 0 deletions babel/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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.
*
*/

plugins {
kotlin("jvm")
id("com.github.vlsi.ide")
calcite.fmpp
calcite.javacc
}

dependencies {
api(project(":core"))

implementation("com.google.guava:guava")
implementation("org.apache.calcite.avatica:avatica-core")
implementation("org.slf4j:slf4j-api")

testImplementation("net.hydromatic:quidem")
testImplementation("net.hydromatic:scott-data-hsqldb")
testImplementation("org.hsqldb:hsqldb")
testImplementation("org.incava:java-diff")
testImplementation("org.slf4j:slf4j-log4j12")
testImplementation(project(":core", "testClasses"))
}

val fmppMain by tasks.registering(org.apache.calcite.buildtools.fmpp.FmppTask::class) {
inputs.dir("src/main/codegen")
config.set(file("src/main/codegen/config.fmpp"))
templates.set(file("$rootDir/core/src/main/codegen/templates"))
}

val javaCCMain by tasks.registering(org.apache.calcite.buildtools.javacc.JavaCCTask::class) {
dependsOn(fmppMain)
lookAhead.set(2)
val parserFile = fmppMain.map {
it.output.asFileTree.matching { include("**/Parser.jj") }.singleFile
}
inputFile.set(parserFile)
packageName.set("org.apache.calcite.sql.parser.babel")
}

ide {
fun generatedSource(javacc: TaskProvider<org.apache.calcite.buildtools.javacc.JavaCCTask>, sourceSet: String) =
generatedJavaSources(javacc.get(), javacc.get().output.get().asFile, sourceSets.named(sourceSet))

generatedSource(javaCCMain, "main")
}
Loading

0 comments on commit 66c9cd5

Please sign in to comment.