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

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 .net
Dan Ardelean
 
Dependency management in Xcode 11
Dependency management in Xcode 11Dependency management in Xcode 11
Dependency management in Xcode 11
Boris Bielik
 
Getting Started With Subversion
Getting Started With SubversionGetting Started With Subversion
Getting Started With Subversion
Jordan Hatch
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
Samnang Chhun
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practices
abackstrom
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with Subversion
Guy 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 Solutions
Perforce
 
Implementing portlets using Web Scripts
Implementing portlets using Web ScriptsImplementing portlets using Web Scripts
Implementing portlets using Web Scripts
Piergiorgio Lucidi
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
Marco Pivetta
 
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
david_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 Streams
Perforce
 
Ruby in mule
Ruby in muleRuby in mule
Ruby in mule
Ramakrishna kapa
 
Composer talk by Maxim Romanovsky
Composer talk by Maxim RomanovskyComposer talk by Maxim Romanovsky
Composer talk by Maxim Romanovsky
php-user-group-minsk
 
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
Piergiorgio Lucidi
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN Presentation
Matthew Fabb
 
QBASIC
QBASICQBASIC
QBASIC
nivi88
 
LLVM Compiler
LLVM CompilerLLVM Compiler
LLVM Compiler
Chayan Pathak
 
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
Vu Hung Nguyen
 
PHP Deployment With SVN
PHP Deployment With SVNPHP Deployment With SVN
PHP Deployment With SVN
Lorna 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 #DOXLON
Outlyer
 

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 - composer
David 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.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdf
Abid Malik
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
Abid Malik
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
Abid Malik
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
Jason 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 way
Christian 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 kite
Christian Opitz
 
Composer yourself: a reintroduction to composer
Composer yourself:  a reintroduction to composerComposer yourself:  a reintroduction to composer
Composer yourself: a reintroduction to composer
Eric Poe
 
"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename Horn"MagicBox" 16 - Codename Horn
"MagicBox" 16 - Codename Horn
Flávio Moringa
 
Composer
ComposerComposer
Composer
Zaib Un Nisa
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
Abid Malik
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
drubb
 
Subversion
SubversionSubversion
Subversion
rchakra
 
Vagrant workshop 2015
Vagrant workshop 2015Vagrant workshop 2015
Vagrant workshop 2015
Haifa Ftirich
 
Svn tutorial
Svn tutorialSvn tutorial
Svn tutorial
Albertz Ace-Red
 
Kafka aws
Kafka awsKafka aws
Kafka aws
Ariel Moskovich
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the Autotools
Scott Garman
 
Installing Software, Part 3: Command Line
Installing Software, Part 3: Command LineInstalling Software, Part 3: Command Line
Installing Software, Part 3: Command Line
Kevin OBrien
 
Dependency Management
Dependency ManagementDependency Management
Dependency Management
Alena Holligan
 

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.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdf
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
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/2021
Ballerinalang
 
[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated Queries[Ballerina Community Call] Language Integrated Queries
[Ballerina Community Call] Language Integrated Queries
Ballerinalang
 
[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
Ballerinalang
 
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 Ballerina
Ballerinalang
 
[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
Ballerinalang
 
[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 Interoperability
Ballerinalang
 
[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
Ballerinalang
 
Code to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of InfrastructureCode to Kubernetes: Languages of Infrastructure
Code to Kubernetes: Languages of Infrastructure
Ballerinalang
 
[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
Ballerinalang
 
[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 Cloud
Ballerinalang
 
[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
Ballerinalang
 
[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 Language
Ballerinalang
 
[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 developers
Ballerinalang
 

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

GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 

Recently uploaded (20)

GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.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