Skip to content

Commit

Permalink
Remove Scala Dependencies (#905)
Browse files Browse the repository at this point in the history
Remove minimally used Scala Dependencies from Brooklin code to avoid cross-scala versions builds.
  • Loading branch information
shrinandthakkar committed Apr 21, 2022
1 parent f6c7e76 commit a34bbdd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 44 deletions.
44 changes: 22 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ project(':datastream-utils') {
compile project(':datastream-common')
compile "com.101tec:zkclient:$zkclientVersion"
compile "com.google.guava:guava:$guavaVersion"
testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-kafka")
testCompile project(":datastream-testcommon")
}
}

Expand All @@ -172,7 +172,7 @@ project(':datastream-file-connector') {
compile project(':datastream-common')
compile project(':datastream-utils')
testCompile project(':datastream-server')
testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-testcommon")
testCompile "org.mockito:mockito-core:$mockitoVersion"
}
}
Expand All @@ -188,7 +188,7 @@ project(':datastream-directory') {
}
}

project(":datastream-kafka_$scalaSuffix") {
project(":datastream-kafka") {
dependencies {
compile "com.linkedin.kafka:kafka_$scalaSuffix:$kafkaVersion"
compile "commons-httpclient:commons-httpclient:$commonsHttpClientVersion"
Expand All @@ -197,7 +197,7 @@ project(":datastream-kafka_$scalaSuffix") {
compile project(':datastream-server-api')
compile project(':datastream-utils')

testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-testcommon")
testCompile "org.mockito:mockito-core:$mockitoVersion"

tasks.create(name: "copyDependentLibs", type: Copy) {
Expand All @@ -216,31 +216,31 @@ project(':datastream-kafka-factory-impl') {
dependencies {
compile project(':datastream-kafka-connector')

testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-kafka")
}
}

project(':datastream-kafka-connector') {
dependencies {
compile project(':datastream-server-api')
compile project(':datastream-common')
compile project(":datastream-kafka_$scalaSuffix")
compile project(":datastream-kafka")
compile "org.apache.httpcomponents:httpclient:$apacheHttpClientVersion"
compile "commons-validator:commons-validator:$commonsValidatorVersion"
compile "org.apache.commons:commons-lang3:$commonslang3Version"
compile "javax.xml.bind:jaxb-api:2.3.1"

testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-kafka")
testCompile project(":datastream-testcommon")
testCompile project(':datastream-kafka-factory-impl')
testCompile "org.mockito:mockito-core:$mockitoVersion"
}
}

project(":datastream-testcommon_$scalaSuffix") {
project(":datastream-testcommon") {
dependencies {
compile project(':datastream-server-api')
compile project(":datastream-kafka_$scalaSuffix")
compile project(":datastream-kafka")
compile project(':datastream-common')
compile project(':datastream-utils')
compile project(':datastream-server')
Expand All @@ -261,7 +261,7 @@ project(':datastream-tools') {
compile project(':datastream-common')
compile project(':datastream-client')
compile project(':datastream-server')
compile project(":datastream-testcommon_$scalaSuffix")
compile project(":datastream-testcommon")
compile "commons-cli:commons-cli:$commonsCliVersion"
}

Expand All @@ -284,12 +284,12 @@ project(':datastream-tools') {
from(project(':datastream-file-connector').configurations.runtime) { into("libs/") }
from(project(':datastream-directory').jar) { into("libs/") }
from(project(':datastream-directory').configurations.runtime) { into("libs/") }
from(project(":datastream-testcommon_$scalaSuffix").jar) { into("libs/") }
from(project(":datastream-testcommon_$scalaSuffix").configurations.runtime) { into("libs/") }
from(project(":datastream-testcommon").jar) { into("libs/") }
from(project(":datastream-testcommon").configurations.runtime) { into("libs/") }
from(project(':datastream-common').jar) { into("libs/") }
from(project(':datastream-common').configurations.runtime) { into("libs/") }
from(project(":datastream-kafka_$scalaSuffix").jar) { into("libs/") }
from(project(":datastream-kafka_$scalaSuffix").configurations.runtime) { into("libs/") }
from(project(":datastream-kafka").jar) { into("libs/") }
from(project(":datastream-kafka").configurations.runtime) { into("libs/") }
from(project(':datastream-kafka-connector').jar) { into("libs/") }
from(project(':datastream-kafka-connector').configurations.runtime) { into("libs/") }
duplicatesStrategy 'exclude'
Expand All @@ -308,8 +308,8 @@ project(':datastream-client') {
compile project(':datastream-common')
compile project(':datastream-utils')

testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-testcommon")
testCompile project(":datastream-kafka")
testCompile project(':datastream-server')
testCompile "org.mockito:mockito-core:$mockitoVersion"
}
Expand All @@ -328,10 +328,10 @@ project(':datastream-server') {
compile project(':datastream-utils')
compile project(':datastream-client')

testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-kafka")
testCompile "com.linkedin.kafka:kafka_$scalaSuffix:$kafkaVersion"
testCompile project(':datastream-client')
testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-testcommon")
testCompile "org.mockito:mockito-core:$mockitoVersion"
}

Expand Down Expand Up @@ -364,11 +364,11 @@ project(':datastream-server-restli') {
compile project(':datastream-server')
compile project(':datastream-common')

testCompile project(":datastream-kafka_$scalaSuffix")
testCompile project(":datastream-kafka")
testCompile "com.linkedin.kafka:kafka_$scalaSuffix:$kafkaVersion"
testCompile project(':datastream-client')
testCompile project(':datastream-file-connector')
testCompile project(":datastream-testcommon_$scalaSuffix")
testCompile project(":datastream-testcommon")
testCompile "org.mockito:mockito-core:$mockitoVersion"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.apache.kafka.common.utils.Time;

import kafka.server.KafkaConfig;
import kafka.server.KafkaServer;
import kafka.server.KafkaServerStartable;

import com.linkedin.datastream.common.FileUtils;
import com.linkedin.datastream.common.NetworkUtils;
Expand All @@ -33,7 +33,7 @@ public class EmbeddedKafkaCluster {

private final String _brokers;

private final List<KafkaServer> _brokerList;
private final List<KafkaServerStartable> _brokerList;
private final List<File> _logDirs;

/**
Expand Down Expand Up @@ -115,16 +115,15 @@ public void startup() {
properties.setProperty("log.cleaner.enable", Boolean.FALSE.toString()); //to save memory
properties.setProperty("offsets.topic.num.partitions", "1");

KafkaServer broker = startBroker(properties);
KafkaServerStartable broker = startBroker(properties);

_brokerList.add(broker);
_logDirs.add(logDir);
}
}

private KafkaServer startBroker(Properties props) {
KafkaServer server = new KafkaServer(KafkaConfig.fromProps(props), new EmbeddedSystemTime(),
scala.Option.apply(""), scala.collection.JavaConversions.asScalaBuffer(Collections.emptyList()));
private KafkaServerStartable startBroker(Properties props) {
KafkaServerStartable server = new KafkaServerStartable(KafkaConfig.fromProps(props));
server.startup();
return server;
}
Expand Down Expand Up @@ -156,7 +155,7 @@ public String getZkConnection() {
* Shut down the Kafka cluster
*/
public void shutdown() {
for (KafkaServer broker : _brokerList) {
for (KafkaServerStartable broker : _brokerList) {
try {
broker.shutdown();
} catch (Exception e) {
Expand Down
17 changes: 2 additions & 15 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,5 @@ include 'datastream-server-api'
include 'datastream-server-restli'
include 'datastream-tools'
include 'datastream-utils'

def scalaModules = [
'datastream-kafka',
'datastream-testcommon'
] as HashSet

scalaModules.each {
include it
}

rootProject.children.each {
if (scalaModules.contains(it.name)) {
it.name = it.name + "_" + scalaSuffix
}
}
include 'datastream-testcommon'
include 'datastream-kafka'

0 comments on commit a34bbdd

Please sign in to comment.