Skip to content

Commit

Permalink
Classpaths for junit (classic) (#2670)
Browse files Browse the repository at this point in the history
Incremental step towards making #2671 possible.
  • Loading branch information
devinrsmith authored Jul 22, 2022
1 parent a313725 commit 6d88cce
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 29 deletions.
5 changes: 1 addition & 4 deletions Base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ dependencies {

compile 'io.deephaven:hash:0.1.0'

testCompile 'junit:junit:4.13.2'
testCompile 'org.jmock:jmock-junit4:2.12.0'
testCompile 'org.jmock:jmock-imposters:2.12.0'

Classpaths.inheritJUnitClassic(project, true, 'testCompile')
}

sourceSets {
Expand Down
4 changes: 1 addition & 3 deletions Configuration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ plugins {

dependencies {
compile project(':Base'), project(':DataStructures'), project(':IO'), project(':log-factory'), depCommonsLang3
testCompile 'junit:junit:4.13.2'
testCompile 'org.jmock:jmock-junit4:2.12.0'
testCompile 'org.jmock:jmock-imposters:2.12.0'
Classpaths.inheritJUnitClassic(project, true, 'testCompile')

Classpaths.inheritAutoService(project)

Expand Down
2 changes: 1 addition & 1 deletion Container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ plugins {
}

dependencies {
testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}
18 changes: 18 additions & 0 deletions buildSrc/src/main/groovy/Classpaths.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ class Classpaths {
static final String JUNIT_NAME = 'junit-bom'
static final String JUNIT_VERSION = '5.7.2'

static final String JUNIT_CLASSIC_GROUP = 'junit'
static final String JUNIT_CLASSIC_NAME = 'junit'
static final String JUNIT_CLASSIC_VERSION = '4.13.2'

static final String JMOCK_GROUP = 'org.jmock'
static final String JMOCK_JUNIT_NAME = 'jmock-junit4'
static final String JMOCK_IMPORSTERS_NAME = 'jmock-imposters'
static final String JMOCK_VERSION = '2.12.0'

static final String ASSERTJ_GROUP = 'org.assertj'
static final String ASSERTJ_NAME = 'assertj-core'
static final String ASSERTJ_VERSION = '3.19.0'
Expand Down Expand Up @@ -211,6 +220,15 @@ class Classpaths {
p.getDependencies().add('compileOnly', p.project(':util-immutables'))
}

static void inheritJUnitClassic(Project p, boolean includeJMock = false, String configName = JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME) {
Configuration config = p.configurations.getByName(configName)
addDependency(config, JUNIT_CLASSIC_GROUP, JUNIT_CLASSIC_NAME, JUNIT_CLASSIC_VERSION)
if (includeJMock) {
addDependency(config, JMOCK_GROUP, JMOCK_JUNIT_NAME, JMOCK_VERSION)
addDependency(config, JMOCK_GROUP, JMOCK_IMPORSTERS_NAME, JMOCK_VERSION)
}
}

static void inheritJUnitPlatform(Project p, String configName = JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME) {
Configuration config = p.configurations.getByName(configName)
addDependency(config, p.getDependencies().platform(JUNIT_GROUP + ":" + JUNIT_NAME + ":" + JUNIT_VERSION))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ dependencies {
jama 'gov.nist.math.jama:gov.nist.math.jama:1.1.1'
mockrunner 'com.mockrunner:mockrunner-jdbc:1.0.4'
commonsCsv 'org.apache.commons:commons-csv:1.4'
junit 'junit:junit:4.13.2'
junit 'org.jmock:jmock-junit4:2.12.0'
junit 'org.jmock:jmock-imposters:2.12.0'

Classpaths.inheritJUnitClassic(project, true, 'junit')

// Now, all the various fish libs we depend on, with inherited dependencies matching
// the actual dependencies used in fishlib... if we were strongly coupled, we could skip
Expand Down
2 changes: 1 addition & 1 deletion codegen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ description 'Codegen: Code generation utilities'

dependencies {
implementation 'org.freemarker:freemarker:2.3.31'
testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}
2 changes: 1 addition & 1 deletion engine/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}

spotless {
Expand Down
2 changes: 1 addition & 1 deletion engine/chunk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description 'Engine Chunks: Array-like data structures for dense, efficient data
dependencies {
api project(':Util')

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
2 changes: 1 addition & 1 deletion engine/rowset/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
5 changes: 3 additions & 2 deletions engine/table/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ dependencies {
project(':Base'),
project(':BenchmarkSupport'),
project(':extensions-csv'),
project(':extensions-parquet-table'),
'junit:junit:4.13.2'
project(':extensions-parquet-table')

Classpaths.inheritJUnitClassic(project)

Classpaths.inheritJUnitPlatform(project)
Classpaths.inheritAssertJ(project)
Expand Down
2 changes: 1 addition & 1 deletion engine/tuple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
project(':Util'),
project(':engine-time')

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}

spotless {
Expand Down
2 changes: 1 addition & 1 deletion engine/updategraph/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
2 changes: 1 addition & 1 deletion engine/vector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
api project(':Util'),
project(':qst')

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}

spotless {
Expand Down
5 changes: 3 additions & 2 deletions extensions/csv/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ dependencies {
Classpaths.inheritAssertJ(project)

testImplementation TestTools.projectDependency(project, 'engine-table'),
TestTools.projectDependency(project, 'engine-base'),
'junit:junit:4.13.2'
TestTools.projectDependency(project, 'engine-base')

Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
4 changes: 2 additions & 2 deletions extensions/kafka/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dependencies {

Classpaths.inheritImmutables(project)

testImplementation TestTools.projectDependency(project, 'engine-table'),
'junit:junit:4.13.2'
testImplementation TestTools.projectDependency(project, 'engine-table')
Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
2 changes: 1 addition & 1 deletion extensions/parquet/base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {

implementation project(':Util')

testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
}

spotless {
Expand Down
4 changes: 2 additions & 2 deletions extensions/parquet/table/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ dependencies {

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation TestTools.projectDependency(project, 'engine-table'),
'junit:junit:4.13.2'
testImplementation TestTools.projectDependency(project, 'engine-table')
Classpaths.inheritJUnitClassic(project)

testRuntimeOnly project(':log-to-slf4j'),
project(path: ':configs'),
Expand Down
2 changes: 1 addition & 1 deletion java-client/session/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
testImplementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project)
testImplementation 'io.grpc:grpc-testing'

Classpaths.inheritAssertJ(project)
Expand Down
2 changes: 1 addition & 1 deletion server/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ dependencies {
Classpaths.inheritDagger(project)

// Classpaths.inheritJUnitPlatform(project, 'api')
implementation 'junit:junit:4.13.2'
Classpaths.inheritJUnitClassic(project, false, 'implementation')

}

0 comments on commit 6d88cce

Please sign in to comment.