SlideShare a Scribd company logo
1 of 21
Download to read offline
Managing Dependencies
Sameera Jayasoma
Ballerina
● An open-source programming language for the cloud that
makes it easier to use, combine, and create network services
● Batteries included: libraries, package manager/dependency
manager, build system, test system, documentation system,
IDE support
● Should be easy for programmers familiar with C-style
languages
Managing dependencies in Ballerina
● bal: a build system and package manager for Ballerina
● Working with Ballerina packages
● Automatic version updates
● Compatible version ranges
bal
● A multipurpose tool used for:
○ building Ballerina programs
■ bal build, bal run, bal test commands
○ package management
■ bal new/bal init, bal build, bal pull, bal push commands
○ managing Ballerina platform updates
■ bal dist pull, bal dist use, bal dist update commands
Ballerina package manager
● Provides a mechanism to organize, version, build and share Ballerina
source code
● Fetches correct versions of all dependencies (direct and transitive) of
a Ballerina program
● Keeps the dependencies up to date
● Provides a way to achieve repeatable builds
Ballerina source file (.bal)
→ cat hello_world.bal
import ballerina/io;
public function main() {
io:println("Hello, World!");
}
→ bal run hello_world.bal
Compiling source
hello_world.bal
Running executable
Hello, World!
→ bal build hello_world.bal
Compiling source
hello_world.bal
Generating executable
hello_world.jar
→ bal run hello_world.jar
Hello, World!
Ballerina module
● A Ballerina program is a combination of modules
● Composed of one or more .bal files
● A namespace that isolate module-level identifiers from other modules
to achieves encapsulation, modularity and code reuse
● The external view of a module is made up of public identifiers
defines in the source files
● May depend of other modules
Ballerina module...
Ballerina package
● Allows one or more modules to be combined, versioned, and
distributed as a single entity
● Two formats: source and distribution
● Source format stores the package’s content in a hierarchical
filesystem
● Distribution format stores the content in an archive file with .bala
extension
Ballerina package...
Ballerina package...
Package repository
● Stores packages by organizing them into a three-level hierarchy:
○ organization,
○ package name,
○ version
● organization is a way of grouping packages that belong to single
person, team or organization
● Package names can be hierarchical: ballerinax/aws.s3
● Package versions follow SemVer
● Ballerina central is the default package repository
Where should I specify package versions?
● Hold that thought!
Working with packages
● Time for a quick demo!
Automatic version updates
● Build command automatically pull and use new versions of
package dependencies
○ Does not happen for every build.
○ Every 24 hours in Swan Lake Beta3
● Notifies the user by updating the Dependencies.toml file
● A necessary evil required to keep dependencies up to date
● Makes builds non-deterministic
● Sensible version range locks to minimize the impact
Locking modes
● Soft lock
○ Locks to major versions of dependencies
● Medium lock
○ Locks to major versions of dependencies
○ Locks to minor versions (if possible) of dependencies
● Hard lock
○ Locks to exact major.minor.patch versions of dependencies
Default locking mode
● The build command uses the medium locking mode as the default
● For every dependency, update to the latest patch version
● When different dependencies require different minor versions of
another dependency, take the least minor version needed to satisfy
the all requirements
○ Package A requires 1.2.3 version of package C
○ Package B requires 1.4.3 version of package C
○ The latest versions of C in Ballerina central are 1.5.1 and 2.1.0
○ Medium locking mode picks 1.4.3
Compatible version ranges
● Follows SemVer compatibility ranges when comparing versions
● Similar to the compatible ranges defined in Rust
● Versions are considered compatible if their left-most non-zero
major/minor/patch component is the same
○ 1.2.3 and 1.5.0 are compatible, but 1.2.3 and 2.0.0 are not compatible
○ 0.8.0 and 0.8.10 are compatible, but 0.8.00 and 0.9.0 are not compatible
○ 0.0.1 and 0.0.2 are not compatible
● Pre-release versions of the same major.minor.patch version are
compatible
○ 1.2.0-alpha and 1.2.0-beta are compatible
Sticky builds
● Automatic version updating is a handy tool, but it can be turned off
● Useful in situations that requires repeatable builds
○ i.e. uses the exact dependencies used in a previous build
○ Dependencies.toml captures dependencies resolved during the previous
compilation
● The bal build --sticky option attempts to stick to the
dependency versions available in the dependencies.toml
○ If the files doesn’t exist, this option is ignored
offline builds
● The bal build --offline option attempts to proceed without
accessing the network
● Attempts to use the previously downloaded dependencies, fail
otherwise
● Downloaded dependencies are stored in local repository caches
Thank you

More Related Content

What's hot

Desarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDesarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDan Ardelean
 
Dependency management in Xcode 11
Dependency management in Xcode 11Dependency management in Xcode 11
Dependency management in Xcode 11Boris Bielik
 
Getting Started With Subversion
Getting Started With SubversionGetting Started With Subversion
Getting Started With SubversionJordan Hatch
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With SubversionSamnang Chhun
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practicesabackstrom
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with SubversionGuy K. Kloss
 
Using Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory SolutionsUsing Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory SolutionsPerforce
 
Implementing portlets using Web Scripts
Implementing portlets using Web ScriptsImplementing portlets using Web Scripts
Implementing portlets using Web ScriptsPiergiorgio Lucidi
 
Pipecut - slides from presentation at MeetBSD California 2014
Pipecut - slides from presentation at MeetBSD California 2014Pipecut - slides from presentation at MeetBSD California 2014
Pipecut - slides from presentation at MeetBSD California 2014david_w_maxwell
 
Five Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsFive Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsPerforce
 
Alfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankAlfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankPiergiorgio Lucidi
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN PresentationMatthew Fabb
 
QBASIC
QBASICQBASIC
QBASICnivi88
 
Nguyễn Vũ Hưng: Subversion best practices
Nguyễn Vũ Hưng: Subversion best practicesNguyễn Vũ Hưng: Subversion best practices
Nguyễn Vũ Hưng: Subversion best practicesVu Hung Nguyen
 
PHP Deployment With SVN
PHP Deployment With SVNPHP Deployment With SVN
PHP Deployment With SVNLorna Mitchell
 
Fixing Docker networking - Milos Gajdos at #DOXLON
Fixing Docker networking - Milos Gajdos at #DOXLONFixing Docker networking - Milos Gajdos at #DOXLON
Fixing Docker networking - Milos Gajdos at #DOXLONOutlyer
 

What's hot (20)

Desarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDesarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .net
 
Dependency management in Xcode 11
Dependency management in Xcode 11Dependency management in Xcode 11
Dependency management in Xcode 11
 
Getting Started With Subversion
Getting Started With SubversionGetting Started With Subversion
Getting Started With Subversion
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practices
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with Subversion
 
Using Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory SolutionsUsing Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory Solutions
 
Implementing portlets using Web Scripts
Implementing portlets using Web ScriptsImplementing portlets using Web Scripts
Implementing portlets using Web Scripts
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
Pipecut - slides from presentation at MeetBSD California 2014
Pipecut - slides from presentation at MeetBSD California 2014Pipecut - slides from presentation at MeetBSD California 2014
Pipecut - slides from presentation at MeetBSD California 2014
 
Five Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsFive Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce Streams
 
Ruby in mule
Ruby in muleRuby in mule
Ruby in mule
 
Composer talk by Maxim Romanovsky
Composer talk by Maxim RomanovskyComposer talk by Maxim Romanovsky
Composer talk by Maxim Romanovsky
 
Alfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankAlfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European Bank
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN Presentation
 
QBASIC
QBASICQBASIC
QBASIC
 
LLVM Compiler
LLVM CompilerLLVM Compiler
LLVM Compiler
 
Nguyễn Vũ Hưng: Subversion best practices
Nguyễn Vũ Hưng: Subversion best practicesNguyễn Vũ Hưng: Subversion best practices
Nguyễn Vũ Hưng: Subversion best practices
 
PHP Deployment With SVN
PHP Deployment With SVNPHP Deployment With SVN
PHP Deployment With SVN
 
Fixing Docker networking - Milos Gajdos at #DOXLON
Fixing Docker networking - Milos Gajdos at #DOXLONFixing Docker networking - Milos Gajdos at #DOXLON
Fixing Docker networking - Milos Gajdos at #DOXLON
 

Similar to Managing dependencies in ballerina

Nh php may 2014 - composer
Nh php   may 2014 - composerNh php   may 2014 - composer
Nh php may 2014 - composerDavid Weingart
 
Beginning with Composer - Dependency manager in php
Beginning with Composer  - Dependency manager in php Beginning with Composer  - Dependency manager in php
Beginning with Composer - Dependency manager in php Yogesh Salvi
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best PracticesAbid Malik
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best PracticesAbid Malik
 
Composer Best Practices.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdfAbid Malik
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right wayChristian Varela
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kiteChristian Opitz
 
Composer yourself: a reintroduction to composer
Composer yourself:  a reintroduction to composerComposer yourself:  a reintroduction to composer
Composer yourself: a reintroduction to composerEric Poe
 
"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename Horn"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename HornFlávio Moringa
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdfAbid Malik
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupaldrubb
 
Subversion
SubversionSubversion
Subversionrchakra
 
Vagrant workshop 2015
Vagrant workshop 2015Vagrant workshop 2015
Vagrant workshop 2015Haifa Ftirich
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the AutotoolsScott Garman
 
Installing Software, Part 3: Command Line
Installing Software, Part 3: Command LineInstalling Software, Part 3: Command Line
Installing Software, Part 3: Command LineKevin OBrien
 

Similar to Managing dependencies in ballerina (20)

Nh php may 2014 - composer
Nh php   may 2014 - composerNh php   may 2014 - composer
Nh php may 2014 - composer
 
Beginning with Composer - Dependency manager in php
Beginning with Composer  - Dependency manager in php Beginning with Composer  - Dependency manager in php
Beginning with Composer - Dependency manager in php
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
Composer Best Practices.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdf
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right way
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kite
 
Composer yourself: a reintroduction to composer
Composer yourself:  a reintroduction to composerComposer yourself:  a reintroduction to composer
Composer yourself: a reintroduction to composer
 
"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename Horn"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename Horn
 
Composer
ComposerComposer
Composer
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
Subversion
SubversionSubversion
Subversion
 
Vagrant workshop 2015
Vagrant workshop 2015Vagrant workshop 2015
Vagrant workshop 2015
 
Svn tutorial
Svn tutorialSvn tutorial
Svn tutorial
 
Kafka aws
Kafka awsKafka aws
Kafka aws
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the Autotools
 
Installing Software, Part 3: Command Line
Installing Software, Part 3: Command LineInstalling Software, Part 3: Command Line
Installing Software, Part 3: Command Line
 
Dependency Management
Dependency ManagementDependency Management
Dependency Management
 

More from Ballerinalang

Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021Ballerinalang
 
[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated Queries[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated QueriesBallerinalang
 
[Community Call] Ballerina Swan Lake HTTP Module Changes
[Community Call]  Ballerina Swan Lake HTTP Module Changes[Community Call]  Ballerina Swan Lake HTTP Module Changes
[Community Call] Ballerina Swan Lake HTTP Module ChangesBallerinalang
 
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...Ballerinalang
 
[GID Live] Automatic Microservices Observability with Ballerina
[GID Live] Automatic Microservices Observability with Ballerina[GID Live] Automatic Microservices Observability with Ballerina
[GID Live] Automatic Microservices Observability with BallerinaBallerinalang
 
[GID Live] Open-Source Cloud-Native Programming Language
[GID Live] Open-Source Cloud-Native Programming Language[GID Live] Open-Source Cloud-Native Programming Language
[GID Live] Open-Source Cloud-Native Programming LanguageBallerinalang
 
[Ballerina Community Call] Services and Network Communication Updates in Swan...
[Ballerina Community Call] Services and Network Communication Updates in Swan...[Ballerina Community Call] Services and Network Communication Updates in Swan...
[Ballerina Community Call] Services and Network Communication Updates in Swan...Ballerinalang
 
[Ballerina Community Call] Java Interoperability
[Ballerina Community Call] Java Interoperability[Ballerina Community Call] Java Interoperability
[Ballerina Community Call] Java InteroperabilityBallerinalang
 
[Ballerina Community Call] Data Access in Ballerina
[Ballerina Community Call] Data Access in Ballerina[Ballerina Community Call] Data Access in Ballerina
[Ballerina Community Call] Data Access in BallerinaBallerinalang
 
Code to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of InfrastructureCode to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of InfrastructureBallerinalang
 
[Cloud DC Meetup] Cloud Native Development with Ballerina
[Cloud DC Meetup] Cloud Native Development with Ballerina[Cloud DC Meetup] Cloud Native Development with Ballerina
[Cloud DC Meetup] Cloud Native Development with BallerinaBallerinalang
 
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...Ballerinalang
 
[DevOps Pro Europe 2020] From Code to Cloud
[DevOps Pro Europe 2020] From Code to Cloud[DevOps Pro Europe 2020] From Code to Cloud
[DevOps Pro Europe 2020] From Code to CloudBallerinalang
 
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
[DeveloperWeek 2020] Conquering Network Distributed Applications Using BallerinaBallerinalang
 
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...Ballerinalang
 
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...Ballerinalang
 
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...Ballerinalang
 
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
[ApacheCon NA 2019] Re-inventing Middleware in a Programming LanguageBallerinalang
 
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...Ballerinalang
 
[Java Colombo Meetup] The better java for Java microservices developers
[Java Colombo Meetup] The better java for Java microservices developers[Java Colombo Meetup] The better java for Java microservices developers
[Java Colombo Meetup] The better java for Java microservices developersBallerinalang
 

More from Ballerinalang (20)

Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
 
[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated Queries[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated Queries
 
[Community Call] Ballerina Swan Lake HTTP Module Changes
[Community Call]  Ballerina Swan Lake HTTP Module Changes[Community Call]  Ballerina Swan Lake HTTP Module Changes
[Community Call] Ballerina Swan Lake HTTP Module Changes
 
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
 
[GID Live] Automatic Microservices Observability with Ballerina
[GID Live] Automatic Microservices Observability with Ballerina[GID Live] Automatic Microservices Observability with Ballerina
[GID Live] Automatic Microservices Observability with Ballerina
 
[GID Live] Open-Source Cloud-Native Programming Language
[GID Live] Open-Source Cloud-Native Programming Language[GID Live] Open-Source Cloud-Native Programming Language
[GID Live] Open-Source Cloud-Native Programming Language
 
[Ballerina Community Call] Services and Network Communication Updates in Swan...
[Ballerina Community Call] Services and Network Communication Updates in Swan...[Ballerina Community Call] Services and Network Communication Updates in Swan...
[Ballerina Community Call] Services and Network Communication Updates in Swan...
 
[Ballerina Community Call] Java Interoperability
[Ballerina Community Call] Java Interoperability[Ballerina Community Call] Java Interoperability
[Ballerina Community Call] Java Interoperability
 
[Ballerina Community Call] Data Access in Ballerina
[Ballerina Community Call] Data Access in Ballerina[Ballerina Community Call] Data Access in Ballerina
[Ballerina Community Call] Data Access in Ballerina
 
Code to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of InfrastructureCode to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of Infrastructure
 
[Cloud DC Meetup] Cloud Native Development with Ballerina
[Cloud DC Meetup] Cloud Native Development with Ballerina[Cloud DC Meetup] Cloud Native Development with Ballerina
[Cloud DC Meetup] Cloud Native Development with Ballerina
 
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
 
[DevOps Pro Europe 2020] From Code to Cloud
[DevOps Pro Europe 2020] From Code to Cloud[DevOps Pro Europe 2020] From Code to Cloud
[DevOps Pro Europe 2020] From Code to Cloud
 
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
 
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
 
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
 
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
 
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
 
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
 
[Java Colombo Meetup] The better java for Java microservices developers
[Java Colombo Meetup] The better java for Java microservices developers[Java Colombo Meetup] The better java for Java microservices developers
[Java Colombo Meetup] The better java for Java microservices developers
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 

Recently uploaded (20)

Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 

Managing dependencies in ballerina

  • 2. Ballerina ● An open-source programming language for the cloud that makes it easier to use, combine, and create network services ● Batteries included: libraries, package manager/dependency manager, build system, test system, documentation system, IDE support ● Should be easy for programmers familiar with C-style languages
  • 3. Managing dependencies in Ballerina ● bal: a build system and package manager for Ballerina ● Working with Ballerina packages ● Automatic version updates ● Compatible version ranges
  • 4. bal ● A multipurpose tool used for: ○ building Ballerina programs ■ bal build, bal run, bal test commands ○ package management ■ bal new/bal init, bal build, bal pull, bal push commands ○ managing Ballerina platform updates ■ bal dist pull, bal dist use, bal dist update commands
  • 5. Ballerina package manager ● Provides a mechanism to organize, version, build and share Ballerina source code ● Fetches correct versions of all dependencies (direct and transitive) of a Ballerina program ● Keeps the dependencies up to date ● Provides a way to achieve repeatable builds
  • 6. Ballerina source file (.bal) → cat hello_world.bal import ballerina/io; public function main() { io:println("Hello, World!"); } → bal run hello_world.bal Compiling source hello_world.bal Running executable Hello, World! → bal build hello_world.bal Compiling source hello_world.bal Generating executable hello_world.jar → bal run hello_world.jar Hello, World!
  • 7. Ballerina module ● A Ballerina program is a combination of modules ● Composed of one or more .bal files ● A namespace that isolate module-level identifiers from other modules to achieves encapsulation, modularity and code reuse ● The external view of a module is made up of public identifiers defines in the source files ● May depend of other modules
  • 9. Ballerina package ● Allows one or more modules to be combined, versioned, and distributed as a single entity ● Two formats: source and distribution ● Source format stores the package’s content in a hierarchical filesystem ● Distribution format stores the content in an archive file with .bala extension
  • 12. Package repository ● Stores packages by organizing them into a three-level hierarchy: ○ organization, ○ package name, ○ version ● organization is a way of grouping packages that belong to single person, team or organization ● Package names can be hierarchical: ballerinax/aws.s3 ● Package versions follow SemVer ● Ballerina central is the default package repository
  • 13. Where should I specify package versions? ● Hold that thought!
  • 14. Working with packages ● Time for a quick demo!
  • 15. Automatic version updates ● Build command automatically pull and use new versions of package dependencies ○ Does not happen for every build. ○ Every 24 hours in Swan Lake Beta3 ● Notifies the user by updating the Dependencies.toml file ● A necessary evil required to keep dependencies up to date ● Makes builds non-deterministic ● Sensible version range locks to minimize the impact
  • 16. Locking modes ● Soft lock ○ Locks to major versions of dependencies ● Medium lock ○ Locks to major versions of dependencies ○ Locks to minor versions (if possible) of dependencies ● Hard lock ○ Locks to exact major.minor.patch versions of dependencies
  • 17. Default locking mode ● The build command uses the medium locking mode as the default ● For every dependency, update to the latest patch version ● When different dependencies require different minor versions of another dependency, take the least minor version needed to satisfy the all requirements ○ Package A requires 1.2.3 version of package C ○ Package B requires 1.4.3 version of package C ○ The latest versions of C in Ballerina central are 1.5.1 and 2.1.0 ○ Medium locking mode picks 1.4.3
  • 18. Compatible version ranges ● Follows SemVer compatibility ranges when comparing versions ● Similar to the compatible ranges defined in Rust ● Versions are considered compatible if their left-most non-zero major/minor/patch component is the same ○ 1.2.3 and 1.5.0 are compatible, but 1.2.3 and 2.0.0 are not compatible ○ 0.8.0 and 0.8.10 are compatible, but 0.8.00 and 0.9.0 are not compatible ○ 0.0.1 and 0.0.2 are not compatible ● Pre-release versions of the same major.minor.patch version are compatible ○ 1.2.0-alpha and 1.2.0-beta are compatible
  • 19. Sticky builds ● Automatic version updating is a handy tool, but it can be turned off ● Useful in situations that requires repeatable builds ○ i.e. uses the exact dependencies used in a previous build ○ Dependencies.toml captures dependencies resolved during the previous compilation ● The bal build --sticky option attempts to stick to the dependency versions available in the dependencies.toml ○ If the files doesn’t exist, this option is ignored
  • 20. offline builds ● The bal build --offline option attempts to proceed without accessing the network ● Attempts to use the previously downloaded dependencies, fail otherwise ● Downloaded dependencies are stored in local repository caches