Skip to content

Commit d2a96b0

Browse files
committed
Add custom Copilot instructions
1 parent 221ae4f commit d2a96b0

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

.github/copilot-instructions.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Copilot Instructions for MSAL iOS/macOS
2+
3+
This repository contains the Microsoft Authentication Library (MSAL) for iOS and macOS. It is an Objective-C and Swift SDK that enables applications to authenticate users with Microsoft Entra ID (formerly Azure AD), Microsoft accounts, and Azure AD B2C.
4+
5+
## High Level Details
6+
7+
- **Type**: iOS/macOS SDK (Framework)
8+
- **Languages**: Objective-C (Core), Swift (Native Auth, Tests)
9+
- **Platforms**: iOS 16+, macOS 11+, visionOS
10+
- **Build System**: Xcode (xcodebuild) wrapped by Python scripts
11+
- **Dependencies**: `IdentityCore` (Git Submodule), `xcpretty` (optional, for unit test logs)
12+
13+
## Code Style
14+
15+
**CRITICAL**: Always adhere to the code style guidelines defined in `.clinerules/04-Code-style-guidelines.md`.
16+
- Use 4-space indentation.
17+
- Opening braces MUST be on a NEW line.
18+
- Do NOT group imports.
19+
- Check return values, not error variables.
20+
21+
## Build and Validation Instructions
22+
23+
The repository uses a Python script `build.py` to manage build and test operations.
24+
25+
### Prerequisites
26+
1. **Submodules**: Ensure submodules are initialized.
27+
```bash
28+
git submodule update --init --recursive
29+
```
30+
2. **Xcode**: Requires Xcode 15+ (CI uses Xcode 16.2).
31+
3. **Tools**: `xcpretty` (optional but recommended for readable logs), `swiftlint` (for native auth).
32+
33+
### Build Commands
34+
35+
**Build all targets:**
36+
```bash
37+
./build.py
38+
```
39+
40+
**Build specific target (e.g., iOS Framework):**
41+
```bash
42+
./build.py --target iosFramework
43+
```
44+
*Available targets*: `iosFramework`, `macFramework`, `visionOSFramework`, `iosTestApp`, `sampleIosApp`, `sampleIosAppSwift`.
45+
46+
### Test Commands
47+
48+
**Run Unit Tests (iOS):**
49+
```bash
50+
./build.py --target iosFramework --operations test
51+
```
52+
53+
**Run Unit Tests (macOS):**
54+
```bash
55+
./build.py --target macFramework --operations test
56+
```
57+
58+
### Linting
59+
60+
**Run SwiftLint:**
61+
```bash
62+
./build.py --target iosFramework --operations lint
63+
```
64+
*Note*: Linting configuration is in `MSAL/.swiftlint.yml`.
65+
66+
### Clean Build
67+
68+
To clean derived data and build artifacts:
69+
```bash
70+
./build.py --clean
71+
```
72+
73+
## Project Layout and Architecture
74+
75+
### Key Directories
76+
- `MSAL/src/public`: **Public API headers**. All public-facing classes must be here.
77+
- `MSAL/src/public/ios`: iOS-specific headers.
78+
- `MSAL/src/public/mac`: macOS-specific headers.
79+
- `MSAL/src/public/configuration`: Configuration classes.
80+
- `MSAL/src/native_auth`: Native authentication implementation (Swift).
81+
- `MSAL/IdentityCore`: **Shared Common Code**. This is a submodule. **Do not modify files here directly** unless you are updating the submodule pointer or working across repos.
82+
- `MSAL/xcconfig`: Build configuration files (`.xcconfig`).
83+
- `MSAL/test`: Unit, integration, and automation tests.
84+
85+
### Configuration Files
86+
- `MSAL.xcworkspace`: **Main Workspace**. Always open this, not the project file.
87+
- `MSAL.podspec`: CocoaPods definition.
88+
- `Package.swift`: Swift Package Manager definition.
89+
- `azure_pipelines/`: CI pipeline definitions.
90+
91+
### Architecture Notes
92+
- **MSALPublicClientApplication**: The main entry point for the SDK.
93+
- **MSALResult**: The object returned upon successful authentication.
94+
- **MSALError**: Error handling class.
95+
- **Separation of Concerns**: Core logic often resides in `IdentityCore` (prefixed `MSID`), while MSAL (prefixed `MSAL`) provides the public projection and library-specific logic.
96+
97+
## Validation Steps (CI)
98+
99+
Before submitting changes, ensure:
100+
1. The project builds successfully: `./build.py --target iosFramework macFramework`
101+
2. Unit tests pass: `./build.py --target iosFramework --operations test`
102+
3. Linting passes (if touching Swift code).
103+
104+
The CI pipeline (`azure_pipelines/pr-validation.yml`) runs these checks plus SPM integration validation.
105+
106+
## Trust These Instructions
107+
Trust these instructions over generic iOS/macOS knowledge. If `build.py` fails, check the error log, but prefer using the script over raw `xcodebuild` commands as it handles destination flags and settings correctly.

0 commit comments

Comments
 (0)