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





Overview

From JFrog Artifactory version 7.41.4, Artifactory provides full support for managing Swift packages.Aggregating multiple Swift registries under a virtual repository Artifactory provides access to all your Swift packages through a single URL for both upload and download.

Swift Version Support

Artifactory supports Swift version 5.7 and above.

Did you know?

Swiftis a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.

TheSwift Package Manager:A tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Swift repository(Catalog):https://swiftpackageregistry.com/is a catalog of Git repositories, each containing a Swift package. The Swift package manager is an open-source project for managing the distribution of source code, aimed at making it easy to share code and reuse others’ code. The tool compiles and links Swift packages, managing dependencies, versioning, and supporting flexible distribution and collaboration models. For more information, seeSwift Package Manager.

As a fully-fledged Swift registry on top of its capabilities foradvanced artifact management, Artifactory's support forSwiftprovides:

  • Calculation of Metadata for Swift packages hosted in Artifactory's local repositories.
  • Access to remote registries throughRemote Repositorieswhich provide the usual proxy and caching functionality.
  • The ability to access multiple Swift registries from a single URL by aggregating them under aVirtual Repository. This overcomes the limitation of the Swift client which can only access a single registry at a time.
  • Compatibility with theSwift command line toolto deploy and remove packages and more.
  • Support for validating remote Swift repository metadata.
Page Contents


Swift Repository Structure

The Swift package structure is as follows.


├──Package.swift
├── README.md
├── Sources

│ └─ Hello
│ └── hello.swift
└── Tests

└─ HelloTests
└── helloTests.swift
└─ LinuxMain.swift


Deployment Structure

所有部署迅速包s into Artifactory can be deployed under the following structures:

Note that the packages have to be deployed according this structure, otherwise they will not be included in the index file.


Setting up a Swift Registry

Youcan set up the following repository types:

Follow the steps according to each repository type below.
You can download packages from a local, remote, or virtual Swift registry.

Setting up a Local Repository

Local repositories enable you to deploy Swift (.swift) packages. Artifactory calculates the metadata for all packages and indexes them to allow users to download these packages through the Swift client.

Prerequisite

Artifactory allows you to define any layout for your Swift registries. In order to upload packages according to your custom layout, you need to package your Swift files using the Swift source archive. This creates the.zipfile for your package which you can then upload to any path within your local Swift repository.

To create a Swift local repository:

  1. Navigate to theAdministrationmodule, go toRepositories|Repositories|Local|New Local Repository.
  2. SelectSwiftas thePackage Type.

Setting up a Remote Repository

A Remote Repository defined in Artifactory serves as a caching proxy for a registry managed at a remote URL. Artifacts (such as .zip files) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however, you can not manually deploy artifacts to a remote swift registry.

Remote Repositories enable you to proxy and cache Swift packages.

To define a remote repository to proxy a remote swift registry:

  1. In theAdministrationmodule, underRepositories|Repositories|Remote, clickNew Remote Repository.
  2. In the New Remote Repository page:
    1. Set the Package Type to Swift and the Repository Key value.
    2. Specify the URL to the remote registry in the URL field.
    3. ClickSave & Finish.

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 Swift packages and remote proxied Swift repositories from a single URL defined for the Virtual Repository.

定义一个虚拟迅速库,following:

  1. In theAdministrationmodule, underRepositories|Repositories|Virtual, clickNew Virtual Repository.
  2. In the New Virtual Repository dialog, set the Package Type toSwift.
  3. Select the underlying local and remote Swift registries to include in the Basic settings tab.
  4. ClickSave & Finishto create the repository.

Configuring the Swift Client to work Opposite Artifactory

To use Artifactory with your Swift CLI, you will need to generate an access token. Then you can proceed to resolve and deploy the relevant Swift package.

  1. Navigate toApplication Module | Artifactory | Artifacts.
  2. Select the desired repository.
  3. SelectSet Me Upand follow the instructions.

Searching for Swift Packages

You can search for Swift Packages, using theArtifact Package Search.


Re-Indexing a Swift Repository

You can trigger an asynchronous re-indexing of a local Swift repository either through the UI or using the REST API.

This will also reindex the git index and, as a result, will also index the remote repositories.

In theArtifact Tree Browser, select your Swift repository, right-click and selectRecalculate Indexfrom the list. Requires Admin privileges.

To reindex a Swift repository through the REST API refer to the following REST API.

Calculate a Swift Index

Description: Calculates a Swift index for the specified repository.

Notes: Requires Artifactory Pro.

Security: Requires a valid admin user.

Usage: POST /api/swift/{repoKey}/reindex

Produces: application/text

Since: 7.39.4

Sample Output:

POST /api/swift/swift-local/reindex

Reindexing of Swift repository swift-local was scheduled to run.

  • No labels
Copyright © 2022 JFrog Ltd.