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

Integrate websockets protocol support #119

Merged
merged 318 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
318 commits
Select commit Hold shift + click to select a range
3f6edc1
Remove unwanted test methods from TestUtils
Apr 3, 2023
bb58131
Add the versions of Kafka and Rabbitmq
Apr 3, 2023
c7e21f9
Add kafka and rabbitmq service not supporting test
Apr 4, 2023
13e015a
Add modulereference test for snowpeak.bal
Apr 4, 2023
69e1a5a
Add not supporting nullable dispatcherkey
Apr 4, 2023
18cc26f
Create responses for module references
Apr 4, 2023
ada76ff
Add extra improvements
Apr 4, 2023
79a084b
Add oneOfSchemas for responses
Apr 6, 2023
19d18ad
Add trim for port
Apr 6, 2023
d004a2d
Change the order of enums are printing
Apr 6, 2023
e23ff13
Change messageImpl class by overriding it
Apr 6, 2023
ddde540
Change import spaces of commandTest clas
Apr 6, 2023
d1ad24d
Create AsyncApi25MessageImpl class by overriding original AsyncApi25M…
Apr 6, 2023
df747c8
Change import order of the imports
Apr 6, 2023
33fed3d
Remove unwanted cache config files
Apr 6, 2023
bab8f2a
Add oneOf constant
Apr 6, 2023
623d617
Add createObjectNode function as a common function
Apr 6, 2023
994c035
Try to change gradle version into 7.1 again
Apr 6, 2023
26d9500
Change module-info.java files
Apr 6, 2023
e8be358
Add multiple responses and stream return test
Apr 6, 2023
3e503e4
Add many test cases and remove some according to functionalities
Apr 6, 2023
f4845aa
Add trim for fieldname and host name
Apr 6, 2023
42de7df
Add description for AsycnAPIInfotests
Apr 6, 2023
af4ae1f
Attach checkstyle for converUtilsTest
Apr 6, 2023
d5c6c4e
Add trim for defaultValue
Apr 6, 2023
ed02c6d
Add trim for functionName and paramName
Apr 6, 2023
53e4cae
Add description for AdditionalTests
Apr 6, 2023
a8841bd
Add trim for remoteReturnTypeString
Apr 6, 2023
1f88380
Add checkstyle format
Apr 6, 2023
470b699
Add class document to AsyncApi25MessageImpl
Apr 6, 2023
00d51e8
Add class document to AsyncApi25SchemaImpl
Apr 6, 2023
c249e0c
Change the order of the imports
Apr 7, 2023
f9ae067
Manage spotbugs error
Apr 7, 2023
5fa3485
Add module-ballerina-asyncapi
Apr 7, 2023
29ae529
Change module ballerina file
Apr 7, 2023
7058f15
Remove some unwanted comments
Apr 7, 2023
668c973
Revert "Add module-ballerina-asyncapi"
Apr 7, 2023
e5f77ad
Add module-ballerina asyncapi
Apr 8, 2023
3bb5850
Change asyncapi to asyncapi1
Apr 9, 2023
e592851
Add websubhub_service.bal
Apr 9, 2023
9b23ef2
Add module-ballerina-asyncapi module
Apr 9, 2023
e98df99
Create websubhub_service.bal
Apr 9, 2023
b79aa39
Try some changes for build.gradle file
Apr 9, 2023
bfc3e1f
Try adding functionalities froma asyncapi to ballerina
Apr 10, 2023
b16bfdb
Add gradle wrapper.jar
thushalya Apr 10, 2023
308d9d1
Add changes to push project into local central
Apr 11, 2023
b01c1ca
Delete unwanted output exception files
Apr 16, 2023
54c8be7
Remove asyncapi -cli version
Apr 16, 2023
12440a0
Comment openapi codes
Apr 16, 2023
71064c8
Add asyncapi suffix for file name
Apr 16, 2023
0895825
Change host name from ws://localhost to just localhost
Apr 16, 2023
2e0f11d
Remove multiple channel payloads
Apr 16, 2023
ae10cbf
Remove unwanted yaml files
Apr 16, 2023
dbf3f59
Add asyncapi suffix to file names
Apr 16, 2023
6a3f5e9
Add optional return test
Apr 16, 2023
c736c98
Check snowpeak_bal
Apr 16, 2023
2e299ff
Change asyncapi to asyncapi1
Apr 16, 2023
9ad146b
Add compilation errors
Apr 16, 2023
f327705
Change OAS to AAS
Apr 16, 2023
ed1b35f
Remove info checking since there is no asyncapi annotation
Apr 16, 2023
7ce9b24
Add additional changes
Apr 16, 2023
b095ea4
Add more module reference tests
Apr 16, 2023
f720a5d
Add more module reference files
Apr 16, 2023
9f35bca
Add optional error return bal file
Apr 17, 2023
475e9ac
Change arrayTypeResponse module reference test
Apr 17, 2023
189dc1d
Test 2.5.0 ballerina lang version
Apr 17, 2023
be4d5b8
Test 2.5.0 ballerina lang version
Apr 17, 2023
d23a2f5
Add license on top of every bal file
Apr 17, 2023
653b817
Add license on top of every bal file
Apr 17, 2023
e94dad8
Add x-response-type: server-streaming for inner payloads
Apr 17, 2023
4c068d0
Add readme file of the repository
Apr 17, 2023
254f198
Add license on top of each bal file
Apr 17, 2023
592bf19
Add code coverage report
Apr 17, 2023
4966ed9
Change path param dash constant name
Apr 17, 2023
5584e27
Add jacoco version
Apr 17, 2023
a46a63e
Comment ModuleReferenceTests just to check final build
Apr 17, 2023
3cba0c9
Resolve 2201.5.0 error in ModuleReferenceTests
Apr 18, 2023
c9332de
Change server streaming types cannot be union with simple rpc types i…
Apr 18, 2023
857b655
Add multiple types return with stream type showing an error test
Apr 18, 2023
2f80f23
Change x-optional in to x-required
Apr 18, 2023
739016e
Add multiple stream types return as a union type
Apr 18, 2023
4d438d1
Merge pull request #1 from thushalya/master
thushalya Apr 18, 2023
80bf959
Merge pull request #2 from thushalya/master
thushalya Apr 18, 2023
7f6c92f
Change module-info.java
Apr 18, 2023
5f3979f
Change UNION_STREAMING_SIMPLE_RPC_ERROR
Apr 18, 2023
4bed26a
Add checkstyle changes
Apr 18, 2023
83aa3d8
Merge pull request #3 from thushalya/ballerina-to-asyncapi
thushalya Apr 18, 2023
aa20cd9
Add Connection config
thushalya Apr 23, 2023
1f90322
Add auth,subProtocols,customHeaders field to ClientConfig record
thushalya Apr 23, 2023
66168e4
Add readTimeout writeTimeout secureSocket maxFrameSize fields to Clie…
thushalya Apr 24, 2023
6a7fed7
Add websocketCompressionEnabled,handShakeTimeout,cookies,pingPongHand…
thushalya Apr 24, 2023
c8dd5b4
Complete auth related implementation
thushalya Apr 24, 2023
a83f371
Create websocketClientConfigVariableNode
thushalya Apr 24, 2023
6701f02
Create init function
thushalya Apr 24, 2023
3bd1595
Add BallerinaClientGenerator
thushalya Apr 26, 2023
2ec3314
Add constants for asyncapi to ballerina
thushalya Apr 26, 2023
9b8e9c5
Add FunctionBodyGenerator.java
thushalya Apr 26, 2023
ac4aef5
Add FunctionReturnTypeGenerator
thushalya Apr 26, 2023
5102172
Add FunctionSignatureGenerator
thushalya Apr 26, 2023
e71e50a
Add BallerinaUtilGenerator.java to create utils
thushalya Apr 26, 2023
5314ad5
Add asyncapi client config file
thushalya Apr 26, 2023
9d254dd
Add AllOfRecordTypeGenerator.java
thushalya Apr 26, 2023
f5df450
Add AnyDataTypeGenerator.java
thushalya Apr 26, 2023
085e7ae
Add ArrayTypeGenerator
thushalya Apr 26, 2023
1ad4cca
Add CMD utils and Generator utils files
thushalya Apr 26, 2023
7505431
Add GeneratorMetaData and GenSrcFile java files
thushalya Apr 26, 2023
1eb880f
Add UnionTypeGenerator.java file
thushalya Apr 26, 2023
ae961c3
Add additionalProperties test files
thushalya Apr 26, 2023
78fad3a
Add util generators files and multiple test files
thushalya Apr 26, 2023
7124fc5
Add mutiple test files
thushalya Apr 26, 2023
74d5d50
Add mutiple test files
thushalya Apr 26, 2023
8e0a70b
Add request map method
thushalya Apr 27, 2023
58ed09a
Add BallerinaUtilGenerator to create util file
thushalya Apr 27, 2023
f048c43
Add Function Body generator to create the body of remote method
thushalya Apr 27, 2023
c8bf903
Add FunctionReturnTypeGenerator file to create return of the remote m…
thushalya Apr 27, 2023
3ab9c27
Add FunctionSignatureGenerator to create the signature of the remote…
thushalya Apr 27, 2023
a304f15
Try adding apicurio Rc-3 changes to the project
thushalya Apr 27, 2023
866bc1d
Add functionReturnTypeGenerator with handled various types of returns
thushalya Apr 27, 2023
629d9bf
Done adding function signature parameters
thushalya Apr 27, 2023
630c2fc
Add oneOf,Payload and $ref handling responses
thushalya Apr 27, 2023
b79093c
Add union type generator function
thushalya Apr 27, 2023
4fb9bec
Modify the errors in array type generators
thushalya Apr 27, 2023
a293e98
Add all of option for object schema
thushalya Apr 27, 2023
7cf55c8
Add record schema meta data
thushalya Apr 27, 2023
805e524
Modify errors in type generator
thushalya Apr 27, 2023
206e795
Add some functionalities into GeneratorUtils
thushalya Apr 27, 2023
8d4dd82
Comment unwanted constraints in types generator
thushalya Apr 27, 2023
50d19ef
Remove complex url from functionBody generator since it is not necessary
thushalya Apr 27, 2023
3c2b7b4
Change toString into textValue
thushalya Apr 30, 2023
24845ad
Print reference name
thushalya Apr 30, 2023
c7a2bf0
Add path parameter generation function
thushalya May 1, 2023
9770b3e
Add Query parameter generation function
thushalya May 1, 2023
102a59a
Add header parameter generation function
thushalya May 2, 2023
70cccca
Add a comment to change jsonNode into rc-2 version of apicurio model
thushalya May 2, 2023
5b2e95c
Set nullable true to false, check the code
thushalya May 2, 2023
4b599c7
Change testing file
thushalya May 2, 2023
8d88455
Try changing apicurio model to rc-2 for second time
thushalya May 2, 2023
2822b37
Change additionalProperties valus into {} inside a Payload
thushalya May 6, 2023
df7f985
Introduce a new BalBooleanSchema class to avoid printing boolean:true…
thushalya May 6, 2023
7db0021
Change addtionalProperties:{} into addtionalProperties:true in a schema
thushalya May 6, 2023
ea54986
Use JsonIgnore to avoid schema:true when using setItems
thushalya May 6, 2023
5dd7e70
Introduce additionalProperties:true into responses as well
thushalya May 6, 2023
a1f224e
Add type reference for createComponentSchema
thushalya May 6, 2023
016ae4f
Remove constraint for components={} and channels={}
thushalya May 6, 2023
1892300
Add components section
thushalya May 6, 2023
24cde90
Merge pull request #5 from thushalya/ballerina-to-asyncapi
thushalya May 6, 2023
76a7f5e
Merge pull request #6 from thushalya/master
thushalya May 6, 2023
931d1ff
Change array.getItems() into array.getItems.asSchema() and getAdditio…
thushalya May 6, 2023
d502554
Do check style resolve
thushalya May 11, 2023
8fc3668
Do check style resolve
thushalya May 11, 2023
389df0e
Add JsonDeserialize for schemaSchemaListUnion and BooleanSchemaUnion
thushalya May 11, 2023
cfa934a
Add Query parameter take using iterating
thushalya May 11, 2023
2603be1
Check double quotes in ballerina to asyncapi
thushalya May 11, 2023
279bb87
Add globalQueue and pipes field as final keywords
thushalya May 12, 2023
77bf224
Add startInterMediator function
thushalya May 12, 2023
d99d1f3
Add while body statements
thushalya May 12, 2023
5729c8f
Change task1 to generate union stream due to the graphql over websocket
thushalya May 21, 2023
b7e3c14
Add support to inplace record types inside a record
thushalya May 21, 2023
a4f2441
Add support for union types in a stream
thushalya May 21, 2023
b1a476a
Add graphql over websocket yaml file
thushalya May 21, 2023
52c19c4
Change id field into a string
thushalya May 22, 2023
18f8de9
Create types.bal and client.bal overally 90%
thushalya May 24, 2023
0378f33
Uncomment utils.bal file
thushalya May 24, 2023
f3aa149
Add utils.bal file
thushalya May 27, 2023
7c8e4a7
Change structure supporting multiplexing with multiple id pipes
thushalya May 29, 2023
175a794
Change id to type in else block
thushalya May 29, 2023
959fe28
Add UUID import
thushalya May 29, 2023
d41bc57
Update test files
thushalya May 31, 2023
0e74737
Add comments
thushalya May 31, 2023
9053343
Add x-dispatcherKey as an extension bud didn't check tests, cause the…
thushalya May 31, 2023
69277e0
Change code structure and add doc comments for workers
thushalya May 31, 2023
24c4521
Add doc comments for remote functions
thushalya Jun 1, 2023
ce4163e
Add correct check style format
thushalya Jun 1, 2023
1105600
Moved to a proper folder
thushalya Jun 2, 2023
5150671
Add isolated keyword successfully
thushalya Jun 2, 2023
dec00b4
Move files to a proper folder
thushalya Jun 2, 2023
85a5e8d
Add pathParam, queryParam, headerParams documentation
thushalya Jun 2, 2023
eb88c10
Add QueryParam and HeaderParam tests
thushalya Jun 4, 2023
269c83c
Add StreamResponse tests
thushalya Jun 4, 2023
2dc23fe
Add Util generator tests, Invalid responses tests, Remote function tests
thushalya Jun 4, 2023
2486f83
Add Kraken websocket asyncapi specification successfully
thushalya Jun 4, 2023
c2bfbdc
Build second task successfully
thushalya Jun 5, 2023
56c3eb5
Add x-dispatcherKey to each file
thushalya Jun 5, 2023
cf2062c
Remove get valid name for extractReferenceType
thushalya Jun 5, 2023
5400a09
Generate graphqloverwebsocket successfully
thushalya Jun 5, 2023
8a8f898
Merge pull request #7 from thushalya/ballerina-to-asyncapi
thushalya Jun 5, 2023
0ef3d60
Add multiple stream generators capability and subscribe messages showing
thushalya Jun 6, 2023
e776e69
BUILD Successfully with all test case passed
thushalya Jun 6, 2023
957d0a5
Add dispatcherStreamId_present test files
thushalya Jun 10, 2023
952d62d
Add after nullable test cases
thushalya Jun 15, 2023
083465d
Add map type, primitive type, reference type tests
thushalya Jun 15, 2023
d0c343a
Add schema tests and Build successful
thushalya Jun 15, 2023
5674590
Add --withtest files testings
thushalya Jun 18, 2023
cf03d6f
Add changes with connection close of the websocket
thushalya Jun 24, 2023
b161b0d
Add proper comments
thushalya Jun 29, 2023
f9e031d
Add and remove proper comments
thushalya Jun 30, 2023
85faa77
Add and remove proper comments
thushalya Jun 30, 2023
f3fded3
Merge pull request #8 from thushalya/asyncapi-to-ballerina_2_new_client
thushalya Jun 30, 2023
cebc4fc
Remove integration tests since it is not necessary yet
thushalya Jun 30, 2023
62b0939
Merge pull request #9 from thushalya/asyncapi-to-ballerina_2_new_client
thushalya Jun 30, 2023
24275c6
Upgrade gradle version and fix failing tests
hasathcharu May 27, 2024
ea387ec
Assert Java 17 compatibility and fix spotbugs errors
hasathcharu May 28, 2024
ff136d8
Upgrade apicurio version
hasathcharu May 29, 2024
106d19b
Upgrade java 17 in gradle and upgrade to Ballerina Swan Lake U9
hasathcharu May 29, 2024
2b06a39
Rollback jackson version to fix failing tests
hasathcharu May 30, 2024
3b4581a
Fix checkstyle version conflicts
hasathcharu May 30, 2024
038dd5b
Add public no arg constructor to CLI
hasathcharu May 30, 2024
8648ff0
Fix a minor bug and disable failing tests
hasathcharu May 31, 2024
691f62f
Clean up gradle scripts
hasathcharu Jun 4, 2024
a4b75e7
Move websockets content to another folder
hasathcharu Jun 5, 2024
569b488
Merge branch 'temp_branch' into websockets
hasathcharu Jun 5, 2024
4512a8f
Upgrade apicurio version and other dependencies
hasathcharu Jun 6, 2024
f0fb79d
Integrate websockets protocol compatibility
hasathcharu Jun 10, 2024
da85c72
Make minor improvements
hasathcharu Jun 10, 2024
3abc3e3
Upgrade ballerina lang and stdlib versions
hasathcharu Jun 10, 2024
c24b43c
Make cli throw unsupported error messages for http
hasathcharu Jun 11, 2024
2b0acd9
Fix missing lock statements in the generated client
hasathcharu Jun 12, 2024
34eacfb
Fix minor issues
hasathcharu Jun 17, 2024
0274721
Revamp client generation when `dispatcherStreamId` is null
hasathcharu Jun 17, 2024
0558954
Fix failing test cases
hasathcharu Jun 19, 2024
dc1e6ef
Refactor client generation for when `dispatcherStreamId` is not null
hasathcharu Jun 20, 2024
0a7ee6d
Refactor util.bal file generation
hasathcharu Jun 20, 2024
eb4834b
Remove unused import
hasathcharu Jun 20, 2024
cdad3f3
Remove empty lines
hasathcharu Jun 20, 2024
5471902
Make suggested changes
hasathcharu Jun 24, 2024
9aa9c56
Make suggested changes
hasathcharu Jun 24, 2024
4aefd90
Refactor client generation to optimally remove closed pipes from the …
hasathcharu Jun 24, 2024
64683a4
Make suggested changes
hasathcharu Jun 25, 2024
13bb7a3
Refactor the code
Bhashinee Jun 25, 2024
44163c9
Merge branch 'websockets' of https://github.com/hasathcharu/asyncapi-…
Bhashinee Jun 25, 2024
fb2307e
Refactor client generation function
hasathcharu Jun 25, 2024
efa0a74
Refactor client generation function
hasathcharu Jun 25, 2024
6150e81
Merge branch 'Bhashinee-WebSocketAsync' into websockets
hasathcharu Jun 25, 2024
72dabb8
Refactor code and make suggested changes
hasathcharu Jun 25, 2024
193cbd5
Refactor code to make the code cleaner
hasathcharu Jun 25, 2024
b7a6461
Fix unmapped payload issue
hasathcharu Jun 26, 2024
492512b
Improve handling of CLI options
hasathcharu Jun 26, 2024
b789790
Update license header in test cases
hasathcharu Jun 26, 2024
ca56cb8
Clean up test cases
hasathcharu Jun 26, 2024
8af009d
Remove unused test cases and update README.ms
hasathcharu Jun 27, 2024
344b674
Make suggested changes
hasathcharu Jun 27, 2024
cd4d11a
Add specification
hasathcharu Jun 27, 2024
e206db1
Add experimental warning
hasathcharu Jun 27, 2024
8d2104e
Remove doc comments and sleep
hasathcharu Jun 27, 2024
1e517ac
Remove unused functions
Bhashinee Jun 28, 2024
4aeb5b2
Change error handling behavior in client
hasathcharu Jun 28, 2024
8265a7e
Make suggested changes to the specification
hasathcharu Jun 28, 2024
3b6e76c
Merge pull request #2 from Bhashinee/WebSocketAsync
hasathcharu Jun 28, 2024
3788e3b
Add example chat application
hasathcharu Jul 1, 2024
605bffe
Address review suggessions
hasathcharu Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.gradle
/build/
/native.handler/target
target
/native.handler/java-wrapper/build
/native.handler/build
/asyncapi-cli/build
Expand Down
66 changes: 62 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Asyncapi
This repository is the code base for the ballerina async-api tool
# Ballerina - AsyncAPI Tools
[![Build](https://github.com/ballerina-platform/asyncapi-tools/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/asyncapi-tools/actions/workflows/build-timestamped-master.yml)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/asyncapi-tools.svg)](https://github.com/ballerina-platform/asyncapi-tools/commits/master)
[![GitHub issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/asyncpi-tools.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-library/labels/module%2Fasyncapi-tools)

# Architecture of the repository
![architecture](asyncapi-cli/src/main/resources/architecture.jpg?raw=true)
The AsyncAPI Specification is a specification, which creates an event driven architecture based contract for APIs
detailing all of its resources and channels in both human and machine-readable format for easy development, discovery,
and integration. AsyncAPI tools currently s the following capabilities.

1. Generate Ballerina client code from a given AsyncAPI contract with `http` and `ws` protocols.
2. Export the AsyncAPI definition of a Ballerina service using the `ws` protocol.
3. The asyncapi command in Ballerina is used for AsyncAPI to Ballerina and Ballerina to AsyncAPI code generations.

The `asyncapi` command in Ballerina is used for AsyncAPI to Ballerina and Ballerina to AsyncAPI code generations.

## Building from the Source

### Setting Up the Prerequisites

1. OpenJDK 17 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution)

>**Info:** You can also use [Oracle JDK](https://www.oracle.com/java/technologies/javase-downloads.html). Set the JAVA_HOME environment variable to the pathname of the directory into which you installed JDK.

2. Export GitHub Personal access token with read package permissions as follows,
```
export packageUser=<Username>
export packagePAT=<Personal access token>
```

### Building the Source

Execute the commands below to build from the source.

1. To build the library:

./gradlew clean build

2. To run the integration tests:

./gradlew clean test

3. To build the module without the tests:

./gradlew clean build -x test

4. To publish to maven local:

./gradlew clean build publishToMavenLocal

## Contributing to Ballerina

As an open-source project, Ballerina welcomes contributions from the community.

For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md).

## Code of Conduct

All contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct).

## Useful Links

* Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
150 changes: 144 additions & 6 deletions asyncapi-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,176 @@ apply plugin: "checkstyle"

description = "Ballerina - AsyncAPI Tooling - AsyncAPI to Ballerina"

def ballerinaDist = "$project.buildDir/jballerina-tools-${ballerinaLangVersion}"
def runtimePath = "${project.rootDir}/target/ballerina-distribution"

tasks.register("jBallerinaPack")
tasks.register("unpackStdLibs")
tasks.register("copyStdlibs")

configurations.all {
resolutionStrategy.preferProjectModules()
}

configurations {
ballerinaStdLibs
balTools
}

dependencies {
checkstyle project(':checkstyle')
checkstyle "com.puppycrawl.tools:checkstyle:${puppycrawlCheckstyleVersion}"

implementation 'io.apicurio:apicurio-data-models:1.1.15'
implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
implementation "io.apicurio:apicurio-data-models:${apiCurioVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonDataformatYamlVersion}"
implementation 'commons-io:commons-io:2.11.0'
implementation "commons-io:commons-io:${commonsIoVersion}"
implementation "org.ballerinalang:ballerina-lang:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-parser:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-cli:${ballerinaLangVersion}"
implementation "org.ballerinalang:formatter-core:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-tools-api:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-runtime:${ballerinaLangVersion}"
implementation "io.ballerina.stdlib:http-native:${stdlibHttpVersion}"
implementation "org.ballerinalang:language-server-commons:${ballerinaLangVersion}"
implementation "info.picocli:picocli:4.0.1"
implementation "info.picocli:picocli:${picocliVersion}"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation "org.testng:testng:${testngVersion}"

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

/* Standard libraries */
ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIoVersion}"
ballerinaStdLibs "io.ballerina.stdlib:http-ballerina:${stdlibHttpVersion}"
ballerinaStdLibs "io.ballerina.stdlib:log-ballerina:${stdlibLogVersion}"
ballerinaStdLibs "io.ballerina.stdlib:os-ballerina:${stdlibOsVersion}"
ballerinaStdLibs "io.ballerina.stdlib:mime-ballerina:${stdlibMimeVersion}"
ballerinaStdLibs "io.ballerina.stdlib:regex-ballerina:${stdlibRegexVersion}"
ballerinaStdLibs "io.ballerina.stdlib:crypto-ballerina:${stdlibCryptoVersion}"
ballerinaStdLibs "io.ballerina.stdlib:auth-ballerina:${stdlibAuthVersion}"
ballerinaStdLibs "io.ballerina.stdlib:time-ballerina:${stdlibTimeVersion}"
ballerinaStdLibs "io.ballerina.stdlib:cache-ballerina:${stdlibCacheVersion}"
ballerinaStdLibs "io.ballerina.stdlib:task-ballerina:${stdlibTaskVersion}"
ballerinaStdLibs "io.ballerina.stdlib:file-ballerina:${stdlibFileVersion}"
ballerinaStdLibs "io.ballerina.stdlib:jwt-ballerina:${stdlibJwtVersion}"
ballerinaStdLibs "io.ballerina.stdlib:oauth2-ballerina:${stdlibOAuth2Version}"
ballerinaStdLibs "io.ballerina.stdlib:uuid-ballerina:${stdlibUuidVersion}"
ballerinaStdLibs "io.ballerina.stdlib:url-ballerina:${stdlibUrlVersion}"
ballerinaStdLibs "io.ballerina.stdlib:xmldata-ballerina:${stdlibXmldataVersion}"
ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}"
ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}"
ballerinaStdLibs "io.ballerina.stdlib:kafka-ballerina:${stdlibKafkaVersion}"
ballerinaStdLibs "io.ballerina.stdlib:rabbitmq-ballerina:${stdlibRabbitMqVersion}"
ballerinaStdLibs "io.ballerina.stdlib:websocket-ballerina:${stdlibWebsocketVersion}"
ballerinaStdLibs "io.ballerina.stdlib:constraint-ballerina:${stdlibConstraintVersion}"
}

clean {
delete "$project.projectDir/build"
delete "$project.rootDir/target"
}

jBallerinaPack {
doLast {
configurations.balTools.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}")
}
copy {
from(project.zipTree(artifact.getFile())) {
eachFile { fcd ->
fcd.relativePath = new RelativePath(!fcd.file.isDirectory(), fcd.relativePath.segments.drop(1))
}
includeEmptyDirs = false
}
into runtimePath
}
}
}
outputs.dir ballerinaDist
}

unpackStdLibs() {
dependsOn(jBallerinaPack)
doLast {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip")
}
}
}
}

copyStdlibs() {
dependsOn(unpackStdLibs)
/* Standard Libraries */
doLast {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def artifactExtractedPath = "${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip"
copy {
into ballerinaDist
into("repo/bala") {
from "${artifactExtractedPath}/bala"
}
into("repo/cache") {
from "${artifactExtractedPath}/cache"
}
}
copy {
into runtimePath
into("repo/bala") {
from "${artifactExtractedPath}/bala"
}
into("repo/cache") {
from "${artifactExtractedPath}/cache"
}
}
}
def asyncapiCliJar = "${project.rootDir}/asyncapi-cli/build/libs/asyncapi-cli-${project.version}.jar"
copy {
into ballerinaDist
into("bre/lib") {
from "${asyncapiCliJar}"
}
}
copy {
into runtimePath
into("bre/lib") {
from "${asyncapiCliJar}"
}
}
}
}

test {
dependsOn(copyStdlibs)
systemProperty "ballerina.home", ballerinaDist
systemProperty "ballerina.offline.flag", "true"
useTestNG() {
suites "src/test/resources/testng.xml"
}
testLogging.showStandardStreams = true
testLogging {
events "PASSED", "FAILED", "SKIPPED"
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}

checkstyle {
toolVersion '10.12.0'
toolVersion "${puppycrawlCheckstyleVersion}"
configFile rootProject.file("config/checkstyle/build/checkstyle.xml")
configProperties = ["suppressionFile" : file("${rootDir}/config/checkstyle/build/suppressions.xml")]
}
Expand All @@ -74,7 +211,7 @@ jar {
shadowJar {
configurations = [project.configurations.runtimeClasspath]
dependencies {
include(dependency('io.apicurio:apicurio-data-models:1.1.15'))
include(dependency("io.apicurio:apicurio-data-models:${apiCurioVersion}"))
exclude('META-INF/*.SF')
exclude('META-INF/*.DSA')
exclude('META-INF/*.RSA')
Expand All @@ -90,3 +227,4 @@ compileJava {
}
}

build.dependsOn("copyStdlibs")
Loading