Skip to content

Commit

Permalink
Merge pull request #50 from azinneera/dependency-toml
Browse files Browse the repository at this point in the history
Add Dependencies.toml
  • Loading branch information
madhukaw authored Jan 22, 2021
2 parents b870821 + 0cb07e3 commit 9bebf29
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
15 changes: 0 additions & 15 deletions log-integration-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ org = "ballerina"
name = "integration_tests"
version = "@toml.version@"

[[dependency]]
org = "ballerina"
name = "io"
version = "@stdlib.io.version@"

[[dependency]]
org = "ballerina"
name = "regex"
version = "@stdlib.regex.version@"

[[dependency]]
org = "ballerina"
name = "os"
version = "@stdlib.os.version@"

[[platform.java11.dependency]]
path = "../log-native/build/libs/log-native-@project.version@.jar"
groupId = "ballerina"
Expand Down
14 changes: 14 additions & 0 deletions log-integration-tests/Dependencies.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[dependency]]
org = "ballerina"
name = "io"
version = "@stdlib.io.version@"

[[dependency]]
org = "ballerina"
name = "regex"
version = "@stdlib.regex.version@"

[[dependency]]
org = "ballerina"
name = "os"
version = "@stdlib.os.version@"
9 changes: 9 additions & 0 deletions log-integration-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ task copyStdlibs(type: Copy) {
}

def ballerinaConfigFile = new File("$project.projectDir/Ballerina.toml")
def ballerinaDependencyFile = new File("$project.projectDir/Dependencies.toml")
def tomlVersion = project.version.split("-")[0]
def originalConfig = ballerinaConfigFile.text
def configTOMLFile = new File("$project.projectDir/tests/Config.toml")
def initialTOMLcontent = configTOMLFile.text
def originalDependencyConfig = ballerinaDependencyFile.text

task updateTomlVerions {
doLast {
Expand All @@ -103,13 +105,20 @@ task updateTomlVerions {
newConfig = newConfig.replace("@stdlib.regex.version@", stdlibDependentRegexVersion)
newConfig = newConfig.replace("@stdlib.os.version@", stdlibDependentOsVersion)
ballerinaConfigFile.text = newConfig

def newDependencyConfig = ballerinaDependencyFile.text.replace("@toml.version@", tomlVersion)
newDependencyConfig = newDependencyConfig.replace("@stdlib.io.version@", stdlibDependentIoVersion)
newDependencyConfig = newDependencyConfig.replace("@stdlib.regex.version@", stdlibDependentRegexVersion)
newDependencyConfig = newDependencyConfig.replace("@stdlib.os.version@", stdlibDependentOsVersion)
ballerinaDependencyFile.text = newDependencyConfig
}
}

task revertTomlFile {
doLast {
ballerinaConfigFile.text = originalConfig
configTOMLFile.text = initialTOMLcontent
ballerinaDependencyFile.text = originalDependencyConfig
}
}

Expand Down

0 comments on commit 9bebf29

Please sign in to comment.