Skip to content

Commit adfb03f

Browse files
authored
Feature/#1 initial setup (#2)
- Added the code from other repository. - Added a new Scala 2.13.x version. - Prepared for sonatype release.
1 parent c99abbc commit adfb03f

27 files changed

+3197
-1
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# .editorconfig
2+
# http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 2
9+
end_of_line = lf
10+
indent_style = space
11+
max_line_length = 98
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
max_line_length = 80
16+
trim_trailing_whitespace = false
17+
18+
[Makefile]
19+
indent_style = tab

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# .gitignore
2+
3+
# credentials
4+
project/.gnupg/local*
5+
6+
# sbt
7+
project/target
8+
target/
9+
.history
10+
11+
# Java
12+
*.class
13+
14+
# Logs
15+
*.log
16+
log/
17+
logs/
18+
19+
# Temporary files
20+
*~
21+
*.bak
22+
*.old
23+
*.tmp
24+
nohup.out
25+
tmp/
26+
27+
# vim
28+
.*.sw[a-z]
29+
30+
# IntelliJ
31+
.idea/
32+
.idea_modules/
33+
*.iml
34+
*.ipr
35+
*.iws
36+
37+
# Eclipse
38+
.cache
39+
.classpath
40+
.project
41+
.scala_dependencies
42+
.settings/
43+
*.sc
44+
45+
# Ensime
46+
.ensime
47+
.ensime_cache/
48+
49+
# Mac OS X
50+
._*
51+
.DS_Store
52+
53+
# Windows
54+
Desktop.ini
55+
Thumbs.db

.scalafmt.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project.git = true
2+
3+
maxColumn = 98
4+
docstrings = JavaDoc
5+
6+
align = true
7+
align.openParenCallSite = false
8+
align.openParenDefnSite = false
9+
continuationIndent.defnSite = 2
10+
danglingParentheses = true
11+
12+
assumeStandardLibraryStripMargin = true
13+
rewrite.redundantBraces.stringInterpolation = true
14+
rewrite.rules = [
15+
RedundantBraces,
16+
RedundantParens,
17+
PreferCurlyFors,
18+
SortImports
19+
]

.travis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
language: scala
2+
3+
sudo: required
4+
dist: trusty
5+
services: docker
6+
7+
addons:
8+
apt:
9+
packages:
10+
- shellcheck
11+
12+
before_install:
13+
- git fetch --tags
14+
15+
matrix:
16+
include:
17+
- jdk: openjdk11
18+
scala: 2.12.12
19+
20+
- jdk: oraclejdk11
21+
scala: 2.12.12
22+
23+
- jdk: openjdk11
24+
scala: 2.13.3
25+
26+
- jdk: oraclejdk11
27+
scala: 2.13.3
28+
29+
script:
30+
- travis_wait 30 ./scripts/ci.sh
31+
32+
cache:
33+
directories:
34+
- "$HOME/.sbt/1.0"
35+
- "$HOME/.sbt/boot/scala*"
36+
- "$HOME/.sbt/cache"
37+
- "$HOME/.sbt/launchers"
38+
- "$HOME/.ivy2"
39+
- "$HOME/.coursier"
40+
41+
before_cache:
42+
- du -h -d 1 $HOME/.ivy2/
43+
- du -h -d 2 $HOME/.sbt/
44+
- du -h -d 4 $HOME/.coursier/
45+
- find $HOME/.sbt -name "*.lock" -type f -delete
46+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
47+
- find $HOME/.coursier/cache -name "*.lock" -type f -delete

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,65 @@
22

33
Common libraries for Exasol IMPORT and EXPORT user-defined functions in Scala
44
programming language.
5+
6+
## Dependencies
7+
8+
### Runtime Dependencies
9+
10+
| Dependency | Purpose | License |
11+
|---------------------------------------------|-----------------------------------------------------------------|--------------------|
12+
| [Exasol Script API][exasol-script-api-link] | Accessing Exasol IMPORT / EXPORT API | MIT License |
13+
| [Apache Avro][apache-avro-link] | Integration support for Avro format | Apache License 2.0 |
14+
| [Scala Logging Library][scala-logging-link] | Scala logging library wrapping SLF4J | Apache License 2.0 |
15+
16+
### Test Dependencies
17+
18+
| Dependency | Purpose | License |
19+
|---------------------------------------------|-----------------------------------------------------------------|--------------------|
20+
| [Scalatest][scalatest-link] | Testing tool for Scala and Java developers | Apache License 2.0 |
21+
| [Scalatest Plus][scalatestplus-link] | Integration support between Scalatest and Mockito | Apache License 2.0 |
22+
| [Mockito Core][mockitocore-link] | Mocking framework for unit tests | MIT License |
23+
24+
### Compiler Plugin Dependencies
25+
26+
These plugins help with project development.
27+
28+
| Plugin Name | Purpose | License |
29+
|---------------------------------------------|-----------------------------------------------------------------|----------------------|
30+
| [SBT Coursier][sbt-coursier-link] | Pure Scala artifact fetching | Apache License 2.0 |
31+
| [SBT Wartremover][sbt-wartremover-link] | Flexible Scala code linting tool | Apache License 2.0 |
32+
| [SBT Wartremover Contrib][sbt-wcontrib-link]| Community managed additional warts for wartremover | Apache License 2.0 |
33+
| [SBT Assembly][sbt-assembly-link] | Create fat jars with all project dependencies | MIT License |
34+
| [SBT API Mappings][sbt-apimapping-link] | A plugin that fetches API mappings for common Scala libraries | Apache License 2.0 |
35+
| [SBT Scoverage][sbt-scoverage-link] | Integrates the scoverage code coverage library | Apache License 2.0 |
36+
| [SBT Coveralls][sbt-coveralls-link] | Uploads scala code coverage results to https://coveralls.io | Apache License 2.0 |
37+
| [SBT Updates][sbt-updates-link] | Checks Maven and Ivy repositories for dependency updates | BSD 3-Clause License |
38+
| [SBT Scalafmt][sbt-scalafmt-link] | A plugin for https://scalameta.org/scalafmt/ formatting | Apache License 2.0 |
39+
| [SBT Scalastyle][sbt-style-link] | A plugin for http://www.scalastyle.org/ Scala style checker | Apache License 2.0 |
40+
| [SBT Dependency Graph][sbt-depgraph-link] | A plugin for visualizing dependency graph of your project | Apache License 2.0 |
41+
| [SBT Explicit Dependencies][sbt-expdep-link]| Checks which direct libraries required to compile your code | Apache License 2.0 |
42+
| [SBT Sonatype][sbt-sonatype-link] | Sbt plugin for publishing Scala projects to the Maven central | Apache License 2.0 |
43+
| [SBT PGP][sbt-pgp-link] | PGP plugin for `sbt` | BSD 3-Clause License |
44+
| [SBT Git][sbt-git-link] | A plugin for Git integration, used to version the release jars | BSD 2-Clause License |
45+
46+
[apache-avro-link]: https://avro.apache.org/
47+
[scala-logging-link]: https://github.com/lightbend/scala-logging
48+
[exasol-script-api-link]: https://docs.exasol.com/database_concepts/udf_scripts.htm
49+
[scalatest-link]: http://www.scalatest.org/
50+
[scalatestplus-link]: https://github.com/scalatest/scalatestplus-mockito
51+
[mockitocore-link]: https://site.mockito.org/
52+
[sbt-coursier-link]: https://github.com/coursier/coursier
53+
[sbt-wartremover-link]: http://github.com/puffnfresh/wartremover
54+
[sbt-wcontrib-link]: http://github.com/wartremover/wartremover-contrib
55+
[sbt-assembly-link]: https://github.com/sbt/sbt-assembly
56+
[sbt-apimapping-link]: https://github.com/ThoughtWorksInc/sbt-api-mappings
57+
[sbt-scoverage-link]: http://github.com/scoverage/sbt-scoverage
58+
[sbt-coveralls-link]: https://github.com/scoverage/sbt-coveralls
59+
[sbt-updates-link]: http://github.com/rtimush/sbt-updates
60+
[sbt-scalafmt-link]: https://github.com/lucidsoftware/neo-sbt-scalafmt
61+
[sbt-style-link]: https://github.com/scalastyle/scalastyle-sbt-plugin
62+
[sbt-depgraph-link]: https://github.com/jrudolph/sbt-dependency-graph
63+
[sbt-sonatype-link]: https://github.com/xerial/sbt-sonatype
64+
[sbt-pgp-link]: https://github.com/xerial/sbt-sonatype
65+
[sbt-git-link]: https://github.com/sbt/sbt-git
66+
[sbt-expdep-link]: https://github.com/cb372/sbt-explicit-dependencies

build.sbt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import com.exasol.common.sbt.Dependencies
2+
import com.exasol.common.sbt.Settings
3+
4+
lazy val orgSettings = Seq(
5+
name := "import-export-udf-common-scala",
6+
description := "Common Import Export Libraries used in Exasol User Defined Functions",
7+
organization := "com.exasol",
8+
organizationHomepage := Some(url("http://www.exasol.com"))
9+
)
10+
11+
lazy val buildSettings = Seq(
12+
scalaVersion := "2.13.3",
13+
crossScalaVersions := Seq("2.12.12", "2.13.3")
14+
)
15+
16+
lazy val root =
17+
project
18+
.in(file("."))
19+
.settings(moduleName := "import-export-udf-common-scala")
20+
.settings(orgSettings)
21+
.settings(buildSettings)
22+
.settings(Settings.projectSettings(scalaVersion))
23+
.settings(
24+
resolvers ++= Dependencies.ExasolResolvers,
25+
libraryDependencies ++= Dependencies.AllDependencies
26+
)
27+
.enablePlugins(GitVersioning)
28+
29+
addCommandAlias("pluginUpdates", ";reload plugins;dependencyUpdates;reload return")

doc/changes/changelog.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Releases
22

33
* [v0.1.0](changes_0.1.0.md)
4-

project/Compilation.scala

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
package com.exasol.common.sbt
2+
3+
import sbt._
4+
import wartremover.Wart
5+
import wartremover.Warts
6+
7+
/** Compiler related settings (flags, warts, lints) */
8+
object Compilation {
9+
10+
def compilerFlagsFn(scalaVersion: String): Seq[String] =
11+
CrossVersion.partialVersion(scalaVersion) match {
12+
case Some((2, 13)) => CompilerFlags.filter(_ != "-Xfuture")
13+
case Some((2, 12)) => CompilerFlags ++ Scala12CompilerFlags
14+
case Some((2, 11)) => CompilerFlags
15+
case _ => CompilerFlags
16+
}
17+
18+
def consoleFlagsFn(scalaVersion: String): Seq[String] =
19+
compilerFlagsFn(scalaVersion).filterNot(
20+
Set(
21+
"-Xfatal-warnings",
22+
"-Ywarn-unused-import",
23+
"-Ywarn-unused:imports"
24+
)
25+
)
26+
27+
// format: off
28+
/** Compiler flags specific to Scala version 2.12.x */
29+
private val Scala12CompilerFlags: Seq[String] = Seq(
30+
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
31+
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
32+
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
33+
"-Xlint:unsound-match", // Pattern match may not be typesafe.
34+
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
35+
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
36+
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
37+
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
38+
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
39+
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
40+
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
41+
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
42+
"-Ywarn-unused:locals", // Warn if a local definition is unused.
43+
// "-Ywarn-unused:params", // Warn if a value parameter is unused.
44+
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
45+
"-Ywarn-unused:privates", // Warn if a private member is unused.
46+
"-Ypartial-unification" // Enable partial unification in type constructor inference
47+
)
48+
49+
/**
50+
* Compiler flags specific to Scala versions 2.10.x and 2.11.x
51+
*
52+
* From tpolecat, https://tpolecat.github.io/2017/04/25/scalac-flags.html
53+
*/
54+
private val CompilerFlags: Seq[String] = Seq(
55+
"-encoding", "utf-8", // Specify character encoding used by source files.
56+
"-deprecation", // Emit warning and location for usages of deprecated APIs.
57+
"-explaintypes", // Explain type errors in more detail.
58+
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
59+
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
60+
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
61+
"-language:higherKinds", // Allow higher-kinded types
62+
"-language:implicitConversions", // Allow definition of implicit functions called views
63+
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
64+
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
65+
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
66+
"-Xfuture", // Turn on future language features.
67+
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
68+
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
69+
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
70+
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
71+
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
72+
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
73+
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
74+
"-Xlint:option-implicit", // Option.apply used implicit view.
75+
"-Xlint:package-object-classes", // Class or object defined in package object.
76+
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
77+
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
78+
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
79+
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
80+
"-Ywarn-dead-code", // Warn when dead code is identified.
81+
"-Ywarn-numeric-widen", // Warn when numerics are widened.
82+
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
83+
)
84+
// format: on
85+
86+
val JavacCompilerFlags: Seq[String] = Seq(
87+
"-encoding",
88+
"UTF-8",
89+
"-deprecation",
90+
"-parameters",
91+
"-Xlint:all"
92+
)
93+
94+
private def contribWart(name: String) =
95+
Wart.custom(s"org.wartremover.contrib.warts.$name")
96+
97+
private val ExtraWartremoverFlags = Seq(
98+
contribWart("Apply"),
99+
contribWart("ExposedTuples"),
100+
contribWart("MissingOverride"),
101+
contribWart("NoNeedForMonad"),
102+
contribWart("OldTime"),
103+
contribWart("SealedCaseClass"),
104+
contribWart("SomeApply"),
105+
contribWart("SymbolicName"),
106+
contribWart("UnintendedLaziness"),
107+
contribWart("UnsafeInheritance")
108+
)
109+
110+
val WartremoverFlags: Seq[Wart] = ExtraWartremoverFlags ++ Warts.allBut(
111+
Wart.Any,
112+
Wart.AsInstanceOf,
113+
Wart.Equals,
114+
Wart.IsInstanceOf,
115+
Wart.Null,
116+
Wart.MutableDataStructures,
117+
Wart.Overloading,
118+
Wart.Throw,
119+
Wart.Var,
120+
Wart.While
121+
)
122+
123+
val WartremoverTestFlags: Seq[Wart] = ExtraWartremoverFlags ++ Warts.allBut(
124+
Wart.Any,
125+
Wart.IsInstanceOf,
126+
Wart.Overloading,
127+
Wart.NonUnitStatements,
128+
Wart.Null,
129+
Wart.Var
130+
)
131+
132+
}

0 commit comments

Comments
 (0)