Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE-5196]: Added cocoapods nexus faq #780

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
47 changes: 47 additions & 0 deletions docs/workflows/android-specific-workflow-steps/android-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,50 @@ If adding two **Android Build** steps makes the build process too lengthy, you c
4. **Convert AAB to APK:** This step will convert the generated AAB into an APK.

These steps will ensure that both an AAB and an APK are generated during your build process.


### How do I manage Android dependencies with artifactory repository manager?

Integrating an Artifactory repository manager into your Android build process is a robust approach to centralizing dependency management, improving build reliability, and ensuring reproducibility. Below, we’ll demonstrate this process using [**Nexus Repository Manager**](https://www.sonatype.com/products/sonatype-nexus-repository) as an example in conjunction with the Appcircle **Android Build** workflow step.

#### 1. Set up Nexus repository

- Ensure your Nexus Repository Manager is properly installed and configured. For hosted installations, follow the [official Nexus documentation](https://help.sonatype.com/repomanager3) to set up your Maven or Gradle repositories.
- Create a hosted Maven repository (or any repository format compatible with your project). Name the repository, for example, `android-repo`.

#### 2. Integrate Nexus into the Android project

In your Android project’s build.gradle (or settings.gradle if using Gradle Version Catalog), configure Nexus as a repository.
Example of deploying a dependency with Gradle:

```gradle
repositories {
maven {
url 'https://your-nexus-url/repository/android-repo/'
}
}
```

If the URL requires authentication for access, you can configure it as shown below:

```gradle
repositories {
maven {
url 'https://your-nexus-url/repository/android-repo/'
credentials {
username = "your-username"
password = "your-password"
}
}
}
```

To update your Gradle distribution URL with a Nexus repository, modify your `gradle-wrapper.properties` file and replace the `distributionUrl` value with the Nexus repository URL. Below is an example:

```gradle
distributionUrl=https://your-nexus-url/repository/gradle-distributions/gradle-8.8-bin.zip
```

#### 3. Run the build workflow

Trigger your build through Appcircle. The workflow will fetch dependencies from the Nexus repository as configured and compile the project with them. Logs will show dependency resolution status to confirm successful integration with Nexus.
68 changes: 68 additions & 0 deletions docs/workflows/ios-specific-workflow-steps/cocoapods-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,71 @@ Remember, if the project extension is not **.xcworkpace**, the pod install step
To access the source code of this component, please use the following link:

https://github.com/appcircleio/appcircle-cocoapods-component

---

## FAQ

### How do I manage iOS dependencies with artifactory repository manager?

Integrating an Artifactory repository manager into your iOS build process is a robust approach to centralizing dependency management, improving build reliability, and ensuring reproducibility. Below, we’ll demonstrate this process using **Nexus Repository Manager** as an example in conjunction with the Appcircle **CocoaPods Install** workflow step. Please ensure your Nexus Repository Manager is properly installed and configured. For more information, please visit the [official Nexus documentation](https://help.sonatype.com/repomanager3).

:::caution Authentication Requirements

If you are using this kind of artifactory and need to authorize the repository it contains, you can do this with the [**Authenticate with Netrc**](/workflows/common-workflow-steps/authenticate-with-netrc) step or by using a [**Custom Script**](/workflows/common-workflow-steps/custom-script) and adding the credentials to the `.gitcredentials` file.

:::

For more information about Nexus integration with CocoaPods, please visit the [Nexus CocoaPods documentations](https://help.sonatype.com/en/cocoapods-repositories.html).

#### Example 1: How can I fetch the all dependencies from Nexus with CocoaPods?

In the **CocoaPods Install** step, in order to pull dependencies from Nexus or another artifactory, you need to make some changes in the `Pods` file. For this, the `source url` value of the `Pods` file in the project must be replaced with the relevant artifactory. A short example is shown in the following bash script.

```bash

platform :ios, '13.0'
source 'https://nexus.example.com/repository/cocoapods-specs.git'
target 'MyApp' do

use_frameworks!

pod 'AFNetworking', '~> 4.0'
pod 'Alamofire', '~> 5.4'

end

.
.
. #Other Pod file codes

```

#### Example 2: How can I fetch the all dependencies from different repositories?

If you want to fetch a dependency from a source other than this artifactory, you can set up your `Pod` file as shown below. This `Pod` file will pull any pods that are explicitly referenced from the specified URL, while all other dependencies will be retrieved directly from the default `source URL`.

```bash

platform :ios, '13.0'
source 'https://nexus.example.com/repository/cocoapods-specs.git'
target 'MyApp' do

use_frameworks!

pod 'AFNetworking', '~> 4.0'
pod 'Alamofire', '~> 5.4'
pod 'MyPrivatePod', :git => 'https://git.mycompany.com/MyPrivatePod.git', :branch => 'main'

end

.
.
. #Other Pod file codes

```

After these changes;

- Trigger your build through Appcircle. The workflow will fetch dependencies from the Nexus repository as configured and compile the project with them.
- Logs will show dependency resolution status to confirm successful integration with Nexus.