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 containsreusable libraries & packages forFlutter,Angular Dart, and general Dart programs. This givesyou 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 topub.dev, the Dart community’s package registry. You can contribute to this book onGitHub.

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 abilityto serve as a proxy forremote 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 version2.15.0-268.8.betaand above.

Page Contents




Pub Repository Structure

The Pub repository structure is as follows.

|-.pub/.json |----/-.tar.gz

Note the following:

  • 包将被填充的索引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/-.tar.gzstructure.

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



Setting up a Pub Repository

Youcan set up the following repository types:

Follow the steps according to each repository type below. APub 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 themto allow users to download these packages through the Pub client.
To create a Pub local repository, navigate to theAdministrationmodule, go toRepositories|Repositories|Local|New Local Repositoryand selectPubas thePackage 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 itsPackage TypetoPubwhen 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 aVirtual Repository, and set thePackage TypetoPub.
  2. Select the underlying local and remote Pub repositories to include in theBasicsettingstab.



Pub SemVer 2.0 Package Support

Artifactory requires applyingSemVer 2.0 rulesfor 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.60,MyApp.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 thento resolve and deploy the relevantDart/ Flutterpackage.

Prerequisite

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

Step 1: Add Artifactory to your/etc/pub/repositoriesFile

  1. Navigate toApplication Module | Artifactory | Artifacts.
  2. Select the desired repository.
  3. SelectSet Me Up.
  4. In theConfiguretab, 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.

步骤2:部署飞镖/颤振ckages

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

cURL

Deploying a Package Using the UI

Indexing Dart/Flutter Packages

For your files to be indexed properly, it is very important to ensure thatalldeployment of Dart/ Flutter packages into Artifactory occurs under the/ structure. Packages deployed anywhere else will not be indexed.

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

  1. Navigate toArtifactory | Artifacts | Deploy.
  2. Select your Pub repository as theTarget Repository.
  3. In theTarget 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 toArtifactory | Artifacts.
  2. In the Artifact Tree Browser, select a Pub repository and clickSet Me Up.

Viewing Individual Pub Package Information

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

In theArtifact 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 thePub Infotab, or viewed in thePackagesview.



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 theArtifact Tree Browser, select your Pub repository, right-click and selectRecalculate Indexfrom the list (requires Admin privileges).

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


REST API Support

The Artifactory REST API enablesthe recalculation of the repository index, as described inCalculate Pub Repository Metadata

  • No labels
Copyright © 2023 JFrog Ltd.