Skip to content

Commit

Permalink
Merge pull request #2 from prakanth97/fix_io_issue
Browse files Browse the repository at this point in the history
Fix workflow failures
  • Loading branch information
hasithaa authored Dec 22, 2023
2 parents 3b61aaf + e7a9b64 commit 95655a5
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ensure all Java files use LF.
*.java eol=lf
4 changes: 0 additions & 4 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ jobs:
lang_tag: ${{ inputs.lang_tag }}
lang_version: ${{ inputs.lang_version }}
native_image_options: '-J-Xmx7G ${{ inputs.native_image_options }}'
additional_ubuntu_build_flags: '-x :graphql-compiler-plugin-tests:test'
# TODO : Enable after fixing this issue : https://github.com/ballerina-platform/ballerina-lang/issues/38882
# additional_windows_build_flags: '-x :graphql-compiler-plugin-tests:test'
additional_windows_build_flags: '-x test'
3 changes: 2 additions & 1 deletion ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ task deleteDependencyTomlFiles {
}


updateTomlFiles.dependsOn unpackStdLibs
updateTomlFiles.dependsOn copyStdlibs

build.dependsOn "generatePomFileForMavenPublication"
build.dependsOn ":${packageName}-native:build"
build.dependsOn ":${packageName}-compiler-plugin:build"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/init.bal
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ isolated function init() {
}

isolated function setModule() = @java:Method {
'class: "io.ballerina.stdlib.data.utils.ModuleUtils"
'class: "io.ballerina.stdlib.data.xmldata.utils.ModuleUtils"
} external;
8 changes: 2 additions & 6 deletions ballerina/tests/resources/default_namespaced_invoice.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<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>
<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>
<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>
Expand Down
16 changes: 4 additions & 12 deletions ballerina/tests/stream_default_namspace_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ function testDefaultNamespaceInvoiceFull() returns error? {
test:assertEquals(invoice.products.product[0].length(), 5, "Product 1 field count mismatched");
test:assertEquals(invoice.products.product[0].id, 1);
test:assertEquals(invoice.products.product[0].name, "Product 1");
test:assertEquals(invoice.products.product[0].description, string `This is the description for
Product 1.
`);
test:assertEquals(invoice.products.product[0].description, "This is the description for Product 1.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[0].price.\#content, 57.70d);
test:assertEquals(invoice.products.product[0].price.currency, "USD");
Expand All @@ -139,9 +137,7 @@ function testDefaultNamespaceInvoiceFull() returns error? {
test:assertEquals(invoice.products.product[1].length(), 5, "Product 2 field count mismatched");
test:assertEquals(invoice.products.product[1].id, 2);
test:assertEquals(invoice.products.product[1].name, "Product 2");
test:assertEquals(invoice.products.product[1].description, string `This is the description for
Product 2.
`);
test:assertEquals(invoice.products.product[1].description, "This is the description for Product 2.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[1].price.\#content, 6312.36d);
test:assertEquals(invoice.products.product[1].price.currency, "LKR");
Expand Down Expand Up @@ -228,9 +224,7 @@ function testDefaultNamespaceInvoiceFullPlain() returns error? {
test:assertEquals(invoice.products.product[0].length(), 5, "Product 1 field count mismatched");
test:assertEquals(invoice.products.product[0].id, 1);
test:assertEquals(invoice.products.product[0].name, "Product 1");
test:assertEquals(invoice.products.product[0].description, string `This is the description for
Product 1.
`);
test:assertEquals(invoice.products.product[0].description, "This is the description for Product 1.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[0].price.\#content, 57.70d);
test:assertEquals(invoice.products.product[0].price.currency, "USD");
Expand All @@ -239,9 +233,7 @@ function testDefaultNamespaceInvoiceFullPlain() returns error? {
test:assertEquals(invoice.products.product[1].length(), 5, "Product 2 field count mismatched");
test:assertEquals(invoice.products.product[1].id, 2);
test:assertEquals(invoice.products.product[1].name, "Product 2");
test:assertEquals(invoice.products.product[1].description, string `This is the description for
Product 2.
`);
test:assertEquals(invoice.products.product[1].description, "This is the description for Product 2.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[1].price.\#content, 6312.36d);
test:assertEquals(invoice.products.product[1].price.currency, "LKR");
Expand Down
8 changes: 2 additions & 6 deletions ballerina/tests/stream_namespace_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ function testNamespaceInvoiceFullPlain() returns error? {
test:assertEquals(invoice.products.product[0].length(), 5, "Product 1 field count mismatched");
test:assertEquals(invoice.products.product[0].id, 1);
test:assertEquals(invoice.products.product[0].name, "Product 1");
test:assertEquals(invoice.products.product[0].description, string `This is the description for
Product 1.
`);
test:assertEquals(invoice.products.product[0].description, "This is the description for Product 1.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[0].price.\#content, 57.70d);
test:assertEquals(invoice.products.product[0].price.currency, "USD");
Expand All @@ -210,9 +208,7 @@ function testNamespaceInvoiceFullPlain() returns error? {
test:assertEquals(invoice.products.product[1].length(), 5, "Product 2 field count mismatched");
test:assertEquals(invoice.products.product[1].id, 2);
test:assertEquals(invoice.products.product[1].name, "Product 2");
test:assertEquals(invoice.products.product[1].description, string `This is the description for
Product 2.
`);
test:assertEquals(invoice.products.product[1].description, "This is the description for Product 2.");
test:assertEquals(invoice.products.product[0].price.length(), 2, "Price 1 price field count mismatched");
test:assertEquals(invoice.products.product[1].price.\#content, 6312.36d);
test:assertEquals(invoice.products.product[1].price.currency, "LKR");
Expand Down
6 changes: 3 additions & 3 deletions ballerina/xml_api.bal
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public type Error distinct error;
# + t - Target type to be used for filtering in the projection
# + return - On success, returns the given target type value, else returns an `xmldata:Error`
public isolated function fromXmlWithType(xml v, Options options = {}, typedesc<record {}> t = <>)
returns t|Error = @java:Method {'class: "io.ballerina.stdlib.data.xml.Native"} external;
returns t|Error = @java:Method {'class: "io.ballerina.stdlib.data.xmldata.xml.Native"} external;

# Converts XML string, byte[] or byte-stream to record type with projection
#
Expand All @@ -81,7 +81,7 @@ public isolated function fromXmlWithType(xml v, Options options = {}, typedesc<r
# + t - Target type to be used for filtering in the projection
# + return - On success, returns the given target type value, else returns an `xmldata:Error`
public isolated function fromXmlStringWithType(string|byte[]|stream<byte[], error?> s, Options options = {}, typedesc<record {}> t = <>)
returns t|Error = @java:Method {'class: "io.ballerina.stdlib.data.xml.Native"} external;
returns t|Error = @java:Method {'class: "io.ballerina.stdlib.data.xmldata.xml.Native"} external;


# Converts a `Map` or `Record` representation to its XML representation.
Expand Down Expand Up @@ -120,7 +120,7 @@ isolated function convertMapXml(map<xml>|map<xml[]> mapValue) returns xml {
}

isolated function getModifiedRecord(map<anydata> mapValue, typedesc<(map<anydata>|json)> inputType)
returns json|record{}|Error = @java:Method {'class: "io.ballerina.stdlib.data.utils.DataUtils"} external;
returns json|record{}|Error = @java:Method {'class: "io.ballerina.stdlib.data.xmldata.utils.DataUtils"} external;

# Provides configurations for converting JSON to XML.
#
Expand Down
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,11 @@ subprojects {

configurations {
ballerinaStdLibs
jbalTools
}

dependencies {
jbalTools ("org.ballerinalang:jballerina-tools:${ballerinaLangVersion}") {
transitive = false
}

/* Standard libraries */
ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIOVersion}"
ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIoVersion}"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ githubJohnrengelmanShadowVersion=8.1.1
underCouchDownloadVersion=4.0.4
researchgateReleaseVersion=2.8.0
ballerinaGradlePluginVersion=2.0.1
stdlibIOVersion=1.6.0
stdlibIoVersion=1.6.0
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data;
package io.ballerina.stdlib.data.xmldata;

import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.TypeTags;
Expand All @@ -28,8 +28,8 @@
import io.ballerina.runtime.api.values.BError;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.api.values.BTypedesc;
import io.ballerina.stdlib.data.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.utils.DiagnosticLog;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticLog;

import java.util.Comparator;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.utils;
package io.ballerina.stdlib.data.xmldata.utils;

import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.creators.TypeCreator;
Expand All @@ -25,7 +25,7 @@
import io.ballerina.runtime.api.utils.StringUtils;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.api.values.BXmlItem;
import io.ballerina.stdlib.data.xml.QualifiedName;
import io.ballerina.stdlib.data.xmldata.xml.QualifiedName;

/**
* Constants used in Ballerina XmlData library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.utils;
package io.ballerina.stdlib.data.xmldata.utils;

import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.TypeTags;
Expand All @@ -36,8 +36,8 @@
import io.ballerina.runtime.api.values.BMap;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.api.values.BTypedesc;
import io.ballerina.stdlib.data.FromString;
import io.ballerina.stdlib.data.xml.QualifiedName;
import io.ballerina.stdlib.data.xmldata.FromString;
import io.ballerina.stdlib.data.xmldata.xml.QualifiedName;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.utils;
package io.ballerina.stdlib.data.xmldata.utils;

/**
* Represents a diagnostic error code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.utils;
package io.ballerina.stdlib.data.xmldata.utils;

import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.utils.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.utils;
package io.ballerina.stdlib.data.xmldata.utils;

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.Module;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.xml;
package io.ballerina.stdlib.data.xmldata.xml;

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.async.Callback;
Expand All @@ -28,8 +28,8 @@
import io.ballerina.runtime.api.values.BMap;
import io.ballerina.runtime.api.values.BObject;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.stdlib.data.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.utils.DiagnosticLog;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticLog;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.xml;
package io.ballerina.stdlib.data.xmldata.xml;

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.Future;
Expand All @@ -30,8 +30,8 @@
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.api.values.BTypedesc;
import io.ballerina.runtime.api.values.BXml;
import io.ballerina.stdlib.data.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.utils.DiagnosticLog;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticLog;

import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.xml;
package io.ballerina.stdlib.data.xmldata.xml;

/**
* Represents a qualified name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.xml;
package io.ballerina.stdlib.data.xmldata.xml;

import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.TypeTags;
Expand All @@ -34,11 +34,11 @@
import io.ballerina.runtime.api.values.BError;
import io.ballerina.runtime.api.values.BMap;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.stdlib.data.FromString;
import io.ballerina.stdlib.data.utils.Constants;
import io.ballerina.stdlib.data.utils.DataUtils;
import io.ballerina.stdlib.data.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.utils.DiagnosticLog;
import io.ballerina.stdlib.data.xmldata.FromString;
import io.ballerina.stdlib.data.xmldata.utils.Constants;
import io.ballerina.stdlib.data.xmldata.utils.DataUtils;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticLog;

import java.io.Reader;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

package io.ballerina.stdlib.data.xml;
package io.ballerina.stdlib.data.xmldata.xml;

import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.TypeTags;
Expand All @@ -37,11 +37,11 @@
import io.ballerina.runtime.api.values.BXml;
import io.ballerina.runtime.api.values.BXmlItem;
import io.ballerina.runtime.api.values.BXmlSequence;
import io.ballerina.stdlib.data.utils.Constants;
import io.ballerina.stdlib.data.utils.DataUtils;
import io.ballerina.stdlib.data.utils.DataUtils.XmlAnalyzerData;
import io.ballerina.stdlib.data.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.utils.DiagnosticLog;
import io.ballerina.stdlib.data.xmldata.utils.Constants;
import io.ballerina.stdlib.data.xmldata.utils.DataUtils;
import io.ballerina.stdlib.data.xmldata.utils.DataUtils.XmlAnalyzerData;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticErrorCode;
import io.ballerina.stdlib.data.xmldata.utils.DiagnosticLog;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
2 changes: 1 addition & 1 deletion native/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
requires java.xml;
requires junit;
requires org.apache.commons.lang3;
exports io.ballerina.stdlib.data.xml;
exports io.ballerina.stdlib.data.xmldata.xml;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bundles":[{
"name":"error",
"locales":[""]
}]
}

0 comments on commit 95655a5

Please sign in to comment.