SlideShare a Scribd company logo
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

PPTX
SVN Best Practices
PPT
SVN Usage & Best Practices
PPTX
Composer
PDF
Subversion Best Practices
PPT
SVN Tool Information : Best Practices
PPT
Subversion Overview
PPTX
SVN Basics
PDF
Introduction to Subversion
SVN Best Practices
SVN Usage & Best Practices
Composer
Subversion Best Practices
SVN Tool Information : Best Practices
Subversion Overview
SVN Basics
Introduction to Subversion

What's hot (20)

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

Similar to Managing dependencies in ballerina (20)

PPTX
Nh php may 2014 - composer
PDF
Beginning with Composer - Dependency manager in php
PDF
Composer Best Practices
PDF
Composer Best Practices.pdf
PDF
Composer Best Practices
PDF
Dependency management with Composer
DOCX
"The Power of Composer"
PDF
Create a PHP Library the right way
PDF
Development and deployment with composer and kite
PDF
Composer yourself: a reintroduction to composer
ODP
"MagicBox" 16 - Codename Horn
PPTX
Composer
PDF
Magento Docker Setup.pdf
PDF
Composer & Drupal
PPT
Subversion
PDF
Vagrant workshop 2015
PDF
Svn tutorial
ODP
Kafka aws
PDF
Don't Fear the Autotools
PDF
Installing Software, Part 3: Command Line
Nh php may 2014 - composer
Beginning with Composer - Dependency manager in php
Composer Best Practices
Composer Best Practices.pdf
Composer Best Practices
Dependency management with Composer
"The Power of Composer"
Create a PHP Library the right way
Development and deployment with composer and kite
Composer yourself: a reintroduction to composer
"MagicBox" 16 - Codename Horn
Composer
Magento Docker Setup.pdf
Composer & Drupal
Subversion
Vagrant workshop 2015
Svn tutorial
Kafka aws
Don't Fear the Autotools
Installing Software, Part 3: Command Line
Ad

More from Ballerinalang (20)

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

Recently uploaded (20)

PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
Cybersecurity: Protecting the Digital World
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Cost to Outsource Software Development in 2025
PPTX
Computer Software and OS of computer science of grade 11.pptx
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
assetexplorer- product-overview - presentation
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
Wondershare Recoverit Full Crack New Version (Latest 2025)
Why Generative AI is the Future of Content, Code & Creativity?
Monitoring Stack: Grafana, Loki & Promtail
Patient Appointment Booking in Odoo with online payment
Complete Guide to Website Development in Malaysia for SMEs
Cybersecurity: Protecting the Digital World
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
iTop VPN Crack Latest Version Full Key 2025
DNT Brochure 2025 – ISV Solutions @ D365
Advanced SystemCare Ultimate Crack + Portable (2025)
Cost to Outsource Software Development in 2025
Computer Software and OS of computer science of grade 11.pptx
How to Use SharePoint as an ISO-Compliant Document Management System
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Topaz Photo AI Crack New Download (Latest 2025)
Tech Workshop Escape Room Tech Workshop
assetexplorer- product-overview - presentation
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Weekly report ppt - harsh dattuprasad patel.pptx

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