Cloud customer?
Start for Free >
Upgrade in MyJFrog >
What's New in Cloud >







Overview

From JFrog Artifactory 7.31.10, the Pub repository is supported for the Dart programming language, which contains reusable libraries & packages for Flutter, Angular Dart, and general Dart programs. This gives you full control of your deployment and resolving of Pub packages. Pub downloads your Dart package's dependencies, compiles your packages, makes distributable packages, and uploads them to pub.dev, the Dart community’s package registry. You can contribute to this book on GitHub.

About Dart Programming Language

Dart is an Open Source, client-side programming language developed by Google, which is designed for client development, such as web and mobile apps. Dart is an object-oriented, class-based, garbage-collected language with a C-style syntax, and can also be used to build server and desktop applications.

Flutter is an Open-Source UI SDK also developed by Google. It allows the development of iOS/Android apps and uses Dart as its programming language. 

Pub repositories in Artifactory offer the following benefits:

  • Secure and private local Pub repositories with fine-grained access control

  • The ability to serve as a proxy for remote Pub resources and to cache downloaded Pub packages to keep you independent of the network and the remote resource

  • Metadata calculation of the Pub packages hosted in the Artifactory local repositories

  • Version management: Archiving older versions of the packages uploaded to local repositories

  • Source and binary management

Supported Pub Version

Artifactory supports Pub version 2.15.0-268.8.beta and above.

Page Contents




Pub Repository Structure

The Pub repository structure is as follows.

|-.pub/<packageName>.json
|----<packagName>/<packageName>-<version>.tar.gz

Note the following:

  • The index of the packages will be populated under the .pub , each package has his own json file that index the package versions.
  • The binary of the library is populated under the package folder with a convention of the package name and the package version , for example: pedentic/pedantic-1.9.1.tar.gz.

Deployment Structure

All deployment of Pub packages into Artifactory must be under the <PACKAGE_NAME>/<PACKAGE_NAME>-<VERSION>.tar.gz structure. 

If packages are not deployed under this structure, they will not be included in any index file.



Setting up a Pub Repository

You can set up the following repository types:

Follow the steps according to each repository type below. A Pub package (tar.gz) is deployed to a local PUB repository, and resolved using all repository types.

You can download packages from a local, remote, or virtual Pub repository.

Setting up a Local Repository

Local repositories enable you to deploy pub (tar.gz) packages. Artifactory calculates the metadata for all packages and indexes them to allow users to download these packages through the Pub client. 
To create a Pub local repository, navigate to the Administration module, go to Repositories | Repositories | Local New Local Repository and select Pub as the Package Type.

Setting up a Remote Repository

Remote repositories enable you to proxy and cache Pub packages.

To specify that a Remote Repository supports Pub packages, you need to set its Package Type to Pub when it is created. 

Setting up a Virtual Repository

A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.

This allows you to access both locally hosted Pub packages and remote proxied Pub repositories from a single URL defined for the Virtual repository.

To define a virtual Pub repository, do the following:

  1. Create a Virtual Repository, and set the Package Type to Pub.
  2. Select the underlying local and remote Pub repositories to include in the Basic settings tab.



Pub SemVer 2.0 Package Support

Artifactory requires applying SemVer 2.0 rules for Pub repositories, which means you can now use pre-release numbers with dot notation or add metadata to the version, for example: MyApp.3.0.0-build.60MyApp.1.0+git.52406.

Artifactory serves the requests for downloading packages using SemVer 2.0 rules. For example, if the latest version for a certain package is in a SemVer 2.0 convention, Artifactory will return it to the client. NuGet packages with the SemVer 2.0 convention are served from local, remote, and virtual repositories and for both Pub API v2, and v3 feeds.


Configuring the Pub Client to Work with Artifactory

To use Artifactory with your Pub client, you will first need to set Artifactory as a Pub repository, and then to resolve and deploy the relevant Dart/ Flutter package.

Prerequisite

You will need to generate an authentication token. For more information, see Access Token Authorization Headers.

Step 1: Add Artifactory to your /etc/pub/repositories File 

  1. Navigate to Application Module | Artifactory | Artifacts
  2. Select the desired repository.
  3. Select Set Me Up.
  4. In the Configure tab, add the repository to your client using the following command and run it. 

    HTTPS-Mode Only

    Pub authentication to Artifactory is supported only through HTTPS-Only mode.

Step 2: Deploy Dart/ Flutter Packages

To deploy a Dart/ Flutter package into an Artifactory repository, use the following cURL with the relevant path parameters:

cURL

curl  -u<USERNAME>:<PASSWORD> -T <file>.tar.gz "https://localhost:8080/artifactory/dart-pub-local/<>/<PACKAGE_NAME>/<FILE>/<VERSION>.tar.gz"

Deploying a Package Using the UI 

Indexing Dart/Flutter Packages

For your files to be indexed properly, it is very important to ensure that all deployment of Dart/ Flutter packages into Artifactory occurs under the <REPOSITORY>/<PACKAGE_NAME/ <FILE> <VERSION> structure. Packages deployed anywhere else will not be indexed. 

To deploy a Dart/ Flutter package to Artifactory, do the following:

  1. Navigate to Artifactory | Artifacts | Deploy
  2. Select your Pub repository as the Target Repository.
  3. In the Target Path, specify the relative path in the target repository.


Step 3: Resolve and Deploy Dart/ Flutter Packages

To resolve Dart packages:

  1. In the Application module, navigate to Artifactory | Artifacts
  2. In the Artifact Tree Browser, select a Pub repository and click Set Me Up.

Viewing Individual Pub Package Information

Artifactory lets you view selected metadata of a Pub package directly from the UI.

In the Artifact Repository Browser, select your local Pub repository and scroll down to find and select the package you want to inspect.

The metadata is displayed in the Pub Info tab, or viewed in the Packages view.



Re-indexing a Pub Repository

You can trigger an asynchronous re-indexing of a local Pub repository either through the UI or using the REST API.
In the Artifact Tree Browser, select your Pub repository, right-click and select Recalculate Index from the list (requires Admin privileges).

To re-index a Pub repository through the REST API, see Calculate Pub Repository Metadata.


REST API Support

The Artifactory REST API enables the recalculation of the repository index, as described in Calculate Pub Repository Metadata

  • No labels
Copyright © 2023 JFrog Ltd.