Skip to content

Commit

Permalink
Merge pull request ballerina-platform#1 from hasithaa/main
Browse files Browse the repository at this point in the history
Add Input Stream Support
  • Loading branch information
prakanth97 authored Oct 30, 2023
2 parents b9494e1 + dc83d3f commit fa8f481
Show file tree
Hide file tree
Showing 20 changed files with 1,044 additions and 251 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ bin/

# Ballerina
velocity.log*
*Ballerina.lock
Dependencies.toml
*Ballerina.lock
13 changes: 7 additions & 6 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
[package]
org = "ballerina"
name = "data"
name = "data.xml"
version = "0.1.0"
authors = ["Ballerina"]
keywords = ["xml", "json"]
repository = "https://github.com/hasithaa/module-ballerina-data"
keywords = ["xml"]
repository = "https://github.com/ballerina-platform/module-ballerina-data.xml"
license = ["Apache-2.0"]
distribution = "2201.5.0"
distribution = "2201.8.1"
export = ["data.xml"]

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "data-native"
version = "0.1.0"
path = "../native/build/libs/data-native-0.1.0-SNAPSHOT.jar"
path = "../native/build/libs/data-xml-native-0.1.0-SNAPSHOT.jar"
74 changes: 74 additions & 0 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# AUTO-GENERATED FILE. DO NOT MODIFY.

# This file is auto-generated by Ballerina for managing dependency versions.
# It should not be modified by hand.

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.1"

[[package]]
org = "ballerina"
name = "data.xml"
version = "0.1.0"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "test"}
]
modules = [
{org = "ballerina", packageName = "data.xml", moduleName = "data.xml"}
]

[[package]]
org = "ballerina"
name = "io"
version = "1.5.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
]
modules = [
{org = "ballerina", packageName = "io", moduleName = "io"}
]

[[package]]
org = "ballerina"
name = "jballerina.java"
version = "0.0.0"
modules = [
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.error"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.value"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "test"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.error"}
]
modules = [
{org = "ballerina", packageName = "test", moduleName = "test"}
]

29 changes: 24 additions & 5 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ buildscript {
}
}

description = 'Ballerina - Data Ballerina Generator'
description = 'Ballerina - Data XML Module'

def packageName = "data"
def packageName = "data-xml"
def packageOrg = "ballerina"

def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml")
def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml")

def stripBallerinaExtensionVersion(String extVersion) {
if (extVersion.matches(project.ext.timestampedVersionRegex)) {
def splitVersion = extVersion.split('-')
def splitVersion = extVersion.split('-');
if (splitVersion.length > 3) {
def strippedValues = splitVersion[0..-4]
return strippedValues.join('-')
Expand All @@ -62,6 +63,10 @@ ballerina {
langVersion = ballerinaLangVersion
}

configurations {
externalJars
}

task updateTomlFiles {
doLast {
def newConfig = ballerinaTomlFilePlaceHolder.text.replace("@project.version@", project.version)
Expand All @@ -71,7 +76,16 @@ task updateTomlFiles {
}

task commitTomlFiles {

doLast {
project.exec {
ignoreExitValue true
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the native jar versions\" Ballerina.toml Dependencies.toml"
} else {
commandLine 'sh', '-c', "git commit -m '[Automated] Update the native jar versions' Ballerina.toml Dependencies.toml"
}
}
}
}

publishing {
Expand All @@ -93,9 +107,14 @@ publishing {
}
}

updateTomlFiles.dependsOn unpackJballerinaTools
task deleteDependencyTomlFiles {
if (project.hasProperty("deleteDependencies")) {
delete "${project.projectDir}/Dependencies.toml"
}
}

build.dependsOn "generatePomFileForMavenPublication"
build.dependsOn ":${packageName}-native:build"
build.dependsOn deleteDependencyTomlFiles

test.dependsOn ":${packageName}-native:build"
Empty file removed ballerina/tests/.keep
Empty file.
42 changes: 42 additions & 0 deletions ballerina/tests/resources/default_namespaced_invoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<invoice>
<products xmlns="http://www.example.com/products">
<product id="1" name="Product 1" xmlns="http://www.example.com/products">
<description xmlns="http://www.example.com/products">This is the description for
Product 1.
</description>
<price currency="USD" xmlns="http://www.example.com/products">57.70</price>
<category xmlns="http://www.example.com/products">Home and Garden</category>
</product>
<product id="2" name="Product 2" xmlns="http://www.example.com/products">
<description xmlns="http://www.example.com/products">This is the description for
Product 2.
</description>
<price currency="LKR" xmlns="http://www.example.com/products">6312.36</price>
<category xmlns="http://www.example.com/products">Books</category>
</product>
</products>
<customers xmlns="http://www.example.com/customer">
<customer id="C001" xmlns="http://www.example.com/customer">
<name xmlns="http://www.example.com/customer">John Doe</name>
<email xmlns="http://www.example.com/customer">[email protected]</email>
<phone xmlns="http://www.example.com/customer">569-5052</phone>
<address xmlns="http://www.example.com/customer">
<street xmlns="http://www.example.com/customer">MZ738SI4DV St.</street>
<city xmlns="http://www.example.com/customer">Newport</city>
<state xmlns="http://www.example.com/customer">NY</state>
<zip xmlns="http://www.example.com/customer">19140</zip>
</address>
</customer>
<customer id="C002" xmlns="http://www.example.com/customer">
<name xmlns="http://www.example.com/customer">Jane Doe</name>
<email xmlns="http://www.example.com/customer">[email protected]</email>
<phone xmlns="http://www.example.com/customer">674-2864</phone>
<address xmlns="http://www.example.com/customer">
<street xmlns="http://www.example.com/customer">ZI0TGK3BKG St.</street>
<city xmlns="http://www.example.com/customer">Otherville</city>
<state xmlns="http://www.example.com/customer">CA</state>
<zip xmlns="http://www.example.com/customer">77855</zip>
</address>
</customer>
</customers>
</invoice>
38 changes: 38 additions & 0 deletions ballerina/tests/resources/namespaced_invoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<invoice xmlns:prod="http://www.example.com/products" xmlns:cust="http://www.example.com/customer">
<prod:products>
<prod:product id="1" name="Product 1">
<prod:description>This is the description for Product 1.</prod:description>
<prod:price currency="USD">57.70</prod:price>
<prod:category>Home and Garden</prod:category>
</prod:product>
<prod:product id="2" name="Product 2">
<prod:description>This is the description for Product 2.</prod:description>
<prod:price currency="LKR">6312.36</prod:price>
<prod:category>Books</prod:category>
</prod:product>
</prod:products>
<cust:customers>
<cust:customer id="C001">
<cust:name>John Doe</cust:name>
<cust:email>[email protected]</cust:email>
<cust:phone>569-5052</cust:phone>
<cust:address>
<cust:street>MZ738SI4DV St.</cust:street>
<cust:city>Newport</cust:city>
<cust:state>NY</cust:state>
<cust:zip>19140</cust:zip>
</cust:address>
</cust:customer>
<cust:customer id="C002">
<cust:name>Jane Doe</cust:name>
<cust:email>[email protected]</cust:email>
<cust:phone>674-2864</cust:phone>
<cust:address>
<cust:street>ZI0TGK3BKG St.</cust:street>
<cust:city>Otherville</cust:city>
<cust:state>CA</cust:state>
<cust:zip>77855</cust:zip>
</cust:address>
</cust:customer>
</cust:customers>
</invoice>
Loading

0 comments on commit fa8f481

Please sign in to comment.