Skip to content

Commit 60cfd93

Browse files
committed
Testing Gradle build (may migrate from Maven)
1 parent b700e54 commit 60cfd93

File tree

28 files changed

+2776
-1232
lines changed

28 files changed

+2776
-1232
lines changed

.codecov.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
coverage:
2+
precision: 2
3+
round: down
4+
range: "70...100"
5+
6+
status:
7+
project:
8+
default: on
9+
patch:
10+
default: on
11+
changes:
12+
default: off
13+
14+
comment:
15+
layout: "header, reach, diff, flags, files, footer"
16+
behavior: default
17+
require_changes: no
18+
require_base: no
19+
require_head: yes

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
language: scala
22
scala:
3-
- 2.11.8
3+
- 2.12.3
44
jdk:
55
- oraclejdk8
66
install: true
7-
before_script:
8-
- mvn install -Dmaven.skip.tests -f qa-tools
9-
script:
10-
- mvn install -Dmaven.skip.tests
11-
- mvn org.scoverage:scoverage-maven-plugin:1.3.0:report
127
after_success:
13-
- mvn com.versioneye:versioneye-maven-plugin:3.11.1:update
8+
- gradlew versioneye-update
149
- bash <(curl -s https://codecov.io/bash)
1510
addons:
1611
code_climate:

build.gradle

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
id "org.standardout.versioneye" version "1.5.0"
3+
}
4+
5+
buildscript {
6+
repositories {
7+
jcenter()
8+
}
9+
}
10+
11+
12+
13+
14+
allprojects {
15+
apply plugin: 'maven'
16+
17+
group = 'ddo-calc'
18+
version = '0.1.0-alpha'
19+
repositories {
20+
jcenter()
21+
}
22+
}
23+
24+
25+
subprojects {
26+
apply plugin: 'java'
27+
sourceCompatibility = 1.8
28+
targetCompatibility = 1.8
29+
tasks.withType(JavaCompile) {
30+
options.encoding = 'UTF-8'
31+
}
32+
33+
34+
repositories {
35+
mavenLocal()
36+
37+
maven { url "http://repo.spring.io/libs-release-remote" }
38+
maven { url "https://oss.sonatype.org/content/repositories/releases" }
39+
maven { url "http://repo1.maven.org/maven2/" }
40+
}
41+
}
42+
43+
versioneye {
44+
includeSubProjects = true
45+
}

ddo-core/build.gradle

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
plugins {
2+
3+
id "scala"
4+
id "com.diffplug.gradle.spotless" version "3.10.0"
5+
id "com.github.maiflai.scalatest" version "0.19"
6+
id "org.scoverage" version "2.1.0"
7+
8+
}
9+
10+
sourceSets {
11+
test {
12+
scala {
13+
srcDirs('src/test/scala')
14+
exclude '**/*Spec.scala'
15+
exclude '**/*Helper*'
16+
exclude '**/*Builder*'
17+
include '**/*Test.scala'
18+
19+
}
20+
}
21+
acceptanceTest {
22+
scala {
23+
srcDir 'src/specs/scala'
24+
}
25+
resources {
26+
srcDirs( 'src/specs/resources','src/test/specs')
27+
}
28+
compileClasspath += sourceSets.main.runtimeClasspath
29+
compileClasspath += sourceSets.test.runtimeClasspath
30+
}
31+
}
32+
33+
34+
35+
task acceptanceTest(type: Test) {
36+
description = "Runs Acceptance Tests"
37+
testClassesDirs = sourceSets.acceptanceTest.output.classesDirs
38+
classpath += sourceSets.acceptanceTest.runtimeClasspath
39+
40+
}
41+
42+
acceptanceTest.mustRunAfter(test)
43+
acceptanceTest.testLogging.showStandardStreams = true // display test output on console
44+
acceptanceTest.systemProperties['concordion.output.dir'] = "$reporting.baseDir/spec" // write output to build/reports/spec
45+
46+
task allTests {
47+
dependsOn tasks.withType(Test)
48+
}
49+
50+
configure(acceptanceTest) {
51+
group = 'verification'
52+
description = 'Runs Acceptance Testing'
53+
}
54+
55+
56+
description = 'Core DDO Objects'
57+
dependencies {
58+
compile group: 'org.scala-lang', name: 'scala-library', version:'2.12.3'
59+
compile group: 'com.beachape', name: 'enumeratum_2.12', version:'1.5.10'
60+
compile group: 'com.typesafe', name: 'config', version:'1.3.2'
61+
compile group: 'com.github.kxbmap', name: 'configs_2.12', version:'0.4.4'
62+
compile group: 'com.wix', name: 'accord-core_2.12', version:'0.7.1'
63+
compile group: 'com.typesafe.scala-logging', name: 'scala-logging_2.12', version:'3.7.2'
64+
compile group: 'ch.qos.logback', name: 'logback-classic', version:'1.2.3'
65+
compile group: 'org.jetbrains', name: 'annotations', version:'15.0'
66+
testCompile group: 'org.scalatest', name: 'scalatest_2.12', version:'3.0.0'
67+
testRuntime 'org.pegdown:pegdown:1.4.2'
68+
testCompile group: 'org.mockito', name: 'mockito-all', version:'2.0.2-beta'
69+
testCompile group: 'junit', name: 'junit', version:'4.12'
70+
testCompile group: 'org.concordion', name: 'concordion', version:'2.1.1'
71+
testCompile group: 'org.concordion', name: 'concordion-embed-extension', version:'1.1.2'
72+
testCompile group: 'org.concordion', name: 'concordion-collapse-output-extension', version:'1.0.0'
73+
testCompile group: 'com.wix', name: 'accord-scalatest_2.12', version:'0.7.1'
74+
testCompile group: 'de.neuland-bfi', name: 'jade4j', version:'1.2.7'
75+
testCompile group: 'net.ruippeixotog', name: 'scala-scraper_2.12', version:'1.2.0'
76+
// https://mvnrepository.com/artifact/org.scoverage/scalac-scoverage-plugin
77+
// provided group: 'org.scoverage', name: 'scalac-scoverage-plugin_2.12', version: '1.4.0-M2'
78+
79+
scoverage 'org.scoverage:scalac-scoverage-plugin_2.12:1.4.0-M2', 'org.scoverage:scalac-scoverage-runtime_2.12:1.4.0-M2'
80+
compile group: 'com.geirsson', name: 'scalafmt-core_2.11', version: '1.1.0'
81+
82+
}
83+
84+
spotless {
85+
scala {
86+
target '**/scala/*.scala'
87+
// exclude '**/.worksheet/*'
88+
scalafmt()
89+
// optional: you can specify a specific version or config file
90+
// scalafmt('0.5.1').configFile('scalafmt.conf')
91+
}
92+
}

ddo-core/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
<name>Core DDO Objects</name>
1919
<description>Basic traits and classes</description>
2020
<properties>
21-
<specs.code.dir>src/specs/scala</specs.code.dir>
22-
<specs.resource.dir>src/specs/resources</specs.resource.dir>
23-
<specs.dir>src/test/specs</specs.dir>
21+
2422
</properties>
2523
<dependencies>
2624
<!-- Scala -->

ddo-core/src/main/scala/org/aos/ddo/model/attribute/Attribute.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object Attribute extends Enum[Attribute] with SearchPrefix {
4949
override def searchPrefixSource: String = "Attribute"
5050
}
5151

52-
trait Strength extends Attribute {
52+
protected trait Strength extends Attribute {
5353
override val abbr: String = "STR"
5454

5555
def toFullWord: String = "Strength"

ddo-core/src/main/scala/org/aos/ddo/support/package.scala

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ package org.aos.ddo
1717

1818
import com.typesafe.config.ConfigFactory
1919
import com.typesafe.scalalogging.LazyLogging
20-
import com.wix.accord.Descriptions.Description
2120
import com.wix.accord.Violation
2221

23-
import scala.collection.immutable
2422
import scala.language.postfixOps
2523
import scala.util.Random
2624
import scala.util.control.Exception.catching
@@ -59,7 +57,7 @@ package object support extends LazyLogging {
5957
*/
6058
object StringUtils {
6159

62-
def path = "org.aos.ddo.support"
60+
private val path = "org.aos.ddo.support"
6361

6462
implicit lazy val config: com.typesafe.config.Config = {
6563
val cfg = ConfigFactory.load
@@ -88,10 +86,19 @@ package object support extends LazyLogging {
8886
}
8987

9088
implicit class StringImprovements(val s: String) {
89+
/**
90+
* Converts a String to an Optional Int.
91+
* @return Some(Int) upon successful conversion or None for a failed attempt.
92+
*/
9193
def toIntOpt: Option[Int] =
9294
catching(classOf[NumberFormatException]) opt s.toInt
9395
}
9496

97+
/**
98+
* Mostly String manipulation utility methods.
99+
* Most methods are fluent if possible.
100+
* @param s source string
101+
*/
95102
implicit class Extensions(val s: String) {
96103
def lowerCaseNoise: String = {
97104
val noise = config.getStringList("org.aos.ddo.support.noiseWords")
@@ -145,11 +152,19 @@ package object support extends LazyLogging {
145152
s.trim.filterAlphaNumeric
146153
}
147154

155+
/**
156+
* Filters out non alphanumeric values.
157+
* @return alphanumeric values.
158+
*/
148159
def filterAlphaNumeric: String =
149160
s.toCharArray.filter { x =>
150161
x.isLetterOrDigit
151162
}.mkString
152163

164+
/**
165+
* Randomizes the case of the source string.
166+
* @return source string with randomized upper and lower case characters.
167+
*/
153168
def randomCase: String = {
154169
val r = new Random
155170
s.toCharArray
@@ -208,7 +223,7 @@ package object support extends LazyLogging {
208223
.mkString
209224

210225
/**
211-
* Generate a random alphabnumeric string of length n
226+
* Generate a random alphanumeric string of length n
212227
*/
213228
def randomAlphanumericString(n: Int): String =
214229
randomString({
@@ -224,13 +239,11 @@ package object support extends LazyLogging {
224239
*/
225240
object Validation {
226241

227-
import StringUtils.LineSep
228-
229242
// scalastyle:off import.group
230243
/**
231244
* Extracts violation description and message text
232245
*
233-
* @param v Volations
246+
* @param v Violations
234247
* @return Printable list of violations.
235248
* @deprecated
236249
*/

ddo-core/src/main/scala/org/aos/ddo/support/requisite/Requirement.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object Requirement extends Enum[Requirement] {
5151
/** @param id the required race
5252
* @param level the minimum character level.
5353
* @example
54-
* ReqRace("Drow",6) would represent a level 6 or greater player of the drow race.
54+
* ReqRace("Drow",6) would represent a level 6 or greater player of the Drow race.
5555
*/
5656
case class ReqRace(id: String, level: Int) extends Requirement {
5757
override def prefix: Option[String] = Some(Race.searchPrefixSource)

0 commit comments

Comments
 (0)