Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tasks in Gradle build files #2

Merged
merged 12 commits into from
Apr 5, 2024
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
# These are Windows script files and should use crlf
*.bat text eol=crlf

# Ensure all Java files use LF.
*.java eol=lf
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ballerina Avro Module

[![Build](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-timestamped-master.yml)](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-timestamped-master.yml)
[![Build](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-timestamped-master.yml)
[![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-avro/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-avro)
[![Trivy](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/trivy-scan.yml)
[![GraalVM Check](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-with-bal-test-graalvm.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerina-avro/actions/workflows/build-with-bal-test-graalvm.yml)
Expand All @@ -12,7 +12,7 @@ Avro is an open-source data serialization system that enables efficient binary s

The Ballerina Avro module provides the capability to efficiently serialize and deserialize data using Avro schemas.

### Schema
## Schema

`Schema` is will take the Avro schema in string format. And will return an error if the schema is not a valid Avro schema. The client can be used to serialize and deserilize data and the data should be in the correct format.

Expand All @@ -22,12 +22,12 @@ A `Schema` can be defined using the string value of an Avro schema as shown belo
avro:Schema schema = check new(string `{"type": "int", "name" : "intValue", "namespace": "data" }`);
```

### APIs associated with Avro
## APIs associated with Avro

- **toAvro**: Serializes the given data according to the Avro format.
- **fromAvro**: Deserializes the given Avro encoded message to the given data type.

#### `toAvro`
### `toAvro`

Serializes the given data according to the Avro format.

Expand All @@ -40,7 +40,7 @@ public function main() returns error? {
}
```

#### `fromAvro`
### `fromAvro`

Deserializes the given Avro encoded message to the given data type.

Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ observabilityIncluded = true
graalvmCompatible = true

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
groupId = "io.ballerina.lib"
artifactId = "avro-native"
version = "0.1.0"
path = "../native/build/libs/avro-native-0.1.0-SNAPSHOT.jar"
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.0"
distribution-version = "2201.8.6"

[[package]]
org = "ballerina"
Expand All @@ -23,7 +23,7 @@ modules = [
[[package]]
org = "ballerina"
name = "io"
version = "1.4.1"
version = "1.6.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
3 changes: 1 addition & 2 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ configurations {
}

dependencies {

jbalTools("org.ballerinalang:jballerina-tools:${ballerinaLangVersion}") {
transitive = false
}
externalJars(group: 'org.apache.avro', name: 'avro', version: '1.11.3') {
externalJars(group: 'org.apache.avro', name: 'avro', version: "${avroVersion}") {
transitive = false
}
externalJars(group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: "${jacksonVersion}") {
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ observabilityIncluded = true
graalvmCompatible = true

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
groupId = "io.ballerina.lib"
artifactId = "avro-native"
version = "@toml.version@"
path = "../native/build/libs/avro-native-@project.version@.jar"
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to define the ballerinaStdlibs configuration for the subprojects here.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ subprojects {
jbalTools ("org.ballerinalang:jballerina-tools:${ballerinaLangVersion}") {
transitive = false
}
ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIoVersion}"
}
}

Expand Down
17 changes: 10 additions & 7 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ def ballerinaDist = "${project.rootDir}/target/ballerina-runtime"
def examples = ["order-processing-system"]
def graalvmFlag = ""

dependencies {
implementation group: 'org.ballerinalang', name: 'ballerina-lang', version: "${ballerinaLangVersion}"
}

clean {
tasks.register('clean') {
examples.forEach { example ->
delete "${projectDir}/${example}/target"
delete "${projectDir}/${example}/Dependencies.toml"
Expand Down Expand Up @@ -85,7 +81,14 @@ task buildExamples {
}
}

task build {
dependsOn buildExamples

}

task test {
dependsOn testExamples
}

buildExamples.dependsOn ":avro-ballerina:build"
testExamples.dependsOn ":avro-ballerina:build"
test.dependsOn testExamples
build.dependsOn buildExamples
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.caching=true
group=io.ballerina.lib
version=0.1.0-SNAPSHOT
ballerinaLangVersion=2201.8.0
ballerinaLangVersion=2201.8.6

checkstylePluginVersion=10.12.0
spotbugsPluginVersion=5.0.14
Expand All @@ -10,9 +10,10 @@ checkstyleToolVersion=7.8.2
shadowJarPluginVersion=8.1.1
downloadPluginVersion=5.4.0
releasePluginVersion=2.8.0
ballerinaGradlePluginVersion=2.2.4
ballerinaGradlePluginVersion=2.0.1

# Dependencies
stdlibIoVersion=1.6.0
avroVersion=1.11.3
avroJacksonVersion=1.8.2
jacksonVersion=2.17.0
Loading