Skip to content

Commit

Permalink
Merge pull request #188 from Chuhaa/2201.0.0
Browse files Browse the repository at this point in the history
Remove runtime dependency from native dependency jar
  • Loading branch information
LakshanSS authored Mar 9, 2022
2 parents 382a9a2 + 0391926 commit 604ac76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 16 additions & 1 deletion mongodb-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ plugins {
id "com.github.johnrengelman.shadow"
}

configurations {
dist {
transitive true
}
}

repositories {
mavenCentral()

Expand All @@ -19,9 +25,18 @@ dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
compile group: 'org.ballerinalang', name: 'ballerina-lang', version: project.ballerinaLangVersion
compile (group: 'org.ballerinalang', name: 'ballerina-runtime', version: project.ballerinaLangVersion) {
transitive = false
transitive = true
}
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.8.2'
dist group: 'org.mongodb', name: 'mongo-java-driver', version: '3.8.2'
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn configurations.dist
from { configurations.dist.collect { it.isDirectory() ? it : zipTree(it) } } {
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
}

build.dependsOn(shadowJar)
2 changes: 1 addition & 1 deletion mongodb/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ icon = "icon.png"
repository = "https://github.com/ballerina-platform/module-ballerinax-mongodb"

[[platform.java11.dependency]]
path = "../mongodb-native/build/libs/mongodb-native-3.2.1-all.jar"
path = "../mongodb-native/build/libs/mongodb-native-3.2.1.jar"
groupId = "org.ballerinalang"
artifactId = "mongodb-native"
version = "3.2.1"
5 changes: 2 additions & 3 deletions mongodb/iterator.bal
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class ResultIterator {
if (self.isClosed) {
return closedStreamInvocationError();
}
Error? closeErrorIgnored = ();
if (self.err is Error) {
return self.err;
} else {
Expand All @@ -42,10 +41,10 @@ public class ResultIterator {
return streamRecord;
} else if (result is Error) {
self.err = result;
closeErrorIgnored = self.close();
check self.close();
return self.err;
} else {
closeErrorIgnored = self.close();
check self.close();
return result;
}
}
Expand Down

0 comments on commit 604ac76

Please sign in to comment.