Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0cdc1a6
Handle targets with same name but in different projects
bmxav Sep 17, 2024
dbe4b44
Merge pull request #78 from veracode/project-specific-targets
bmxav Sep 26, 2024
c088f08
Ignore test bundles when generating bitcode
bmxav Sep 26, 2024
874e98a
Update build.yml
davdres Apr 2, 2025
6e7a8a6
Update build.yml
davdres Apr 2, 2025
31602e8
Update build.yml
davdres Apr 2, 2025
a175ddc
Merge pull request #79 from veracode/ignore-test-bundles
bmxav Sep 26, 2024
09075b8
Update build.yml
davdres Apr 2, 2025
17aec35
Issue #81 log unrequired targets instead of failing.
davdres Mar 11, 2025
3341d77
Issue #81 log PIF location & missing commands.
davdres Mar 19, 2025
310c00d
Issue #81 PIF workspace sort
davdres Mar 27, 2025
e65d74c
Issue #81 resolve lint error.
davdres Mar 27, 2025
8ce1496
Issue #81 Update version; add some logging
davdres Apr 1, 2025
013c07f
Update PIF/Sources/PIFSupport/PIF.swift
davdres Apr 2, 2025
1508b5c
Update PIF/Sources/PIFSupport/PIFSupport.swift
davdres Apr 2, 2025
020fef6
Issue #81 Address linter & review issues.
davdres Apr 2, 2025
0b1812c
Issue #81 Test unwrap of optional pif cache location.
davdres Apr 2, 2025
dde9586
Issue 81 add running of tests to the build pipeline
davdres Apr 2, 2025
1bc6b8b
Merge pull request #83 from veracode/unknown-targets
davdres Apr 3, 2025
6f8f588
ENG-55520: On sourceTree decode error, log & continue (#88)
davdres Apr 17, 2025
c41046b
SENG-9588 remove development release (#90)
davdres Apr 23, 2025
fd8abb5
SSAST-10500 Warn if multiple builds in xcode log (#91)
davdres Apr 24, 2025
d7fb8ef
SSAST-10519 Add option to capture debug data (#92)
davdres Jun 2, 2025
51cb602
SSAST-10900 Update help for debug data capture. (#93)
davdres Jul 31, 2025
3cee1fd
Merge branch 'main' into release/0.5.4
davdres Sep 15, 2025
27b3f87
SSAST-11687 fix type fixing merge conflicts
davdres Sep 15, 2025
300617f
SSAST-11687 fix swiftlint error-no error locally
davdres Sep 15, 2025
5ca920d
Update build.yml
davdres Sep 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2.0' # Specify the desired Xcode version
xcode-version: '16.4.0' # Specify the desired Xcode version

- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output/
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.swiftpm
Expand Down
19 changes: 3 additions & 16 deletions Documentation/releasing_an_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,26 @@ When you have an update for `gen-ir`, there's a couple things that need to happe

As mentioned in the [Branching Model](branching_model.md), features should be merged into the `develop` branch. You should never merge a feature directly to `main`.

To release a new version of `gen-ir`, create a release branch and open a merge request from the release branch (see the [Branching Model](branching_model.md)) to `main` at the commit point you're wanting to release and to `develop`. Allow any automated check, peer reviews, and - when approved - merge the request.
To release a new version of `gen-ir`, create a release branch and open a merge request from the release branch (see the [Branching Model](branching_model.md)) to `main`. Allow any automated check, peer reviews, and - when approved - merge the request. Release version descriptions mm.nn.pp stand for a 2 digit major version, 2 digit minor version, and 2 digit patch version. For example, `0.3.11` is a valid version.

Then, on your local machine:

- Change to `main` and pull the changes
- `git checkout main && git pull`
- Create the new tag for the release:
- `git tag -a 1.0.0 -m "Gen IR version: 1.0.0`
- `git push --tags`
- Change to `develop` and pull the changes
- `git checkout develop && git pull`
- Recreate the new `develop` tag for the release:
- `git tag -d develop && git push --delete origin develop`
- `git tag -a develop -m "Gen IR Develop version: <commit hash>`
- `git tag -a mm.nn.pp -m "Gen IR version: mm.nn.pp"`
- `git push --tags`

Then, in the GitHub UI:

- Go to the [Releases](https://github.com/veracode/gen-ir/releases) page
- Click `Draft a new release`
- Set the title to the version name
- From the drop down list, choose your newly created tag
- From the drop down list, choose your newly created tag from the main branch
- Click the `Generate release notes` button to create a change log
- Ensure `Set as the latest release` is checked
- Click the `Publish` button

- Click `Draft a new release`
- Set the title to `develop`
- From the drop down list, choose your newly created `develop` tag
- Click the `Generate release notes` button to create a change log
- Ensure `Set as pre-release` is checked
- Click the `Publish` button

A release has been made, congratulations. However there's additional steps for distributing the release via `brew`.

## Distributing a release
Expand Down
8 changes: 0 additions & 8 deletions PIF/.gitignore

This file was deleted.

12 changes: 6 additions & 6 deletions Sources/DependencyGraph/DependencyGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DependencyGraph<Value: NodeValue> {
/// - Returns: the chain of nodes, starting with the 'bottom' of the dependency subgraph
public func chain(for value: Value) -> [Node] {
guard let node = findNode(for: value) else {
logger.debug("Couldn't find node for value: \(value.valueName)")
GenIRLogger.logger.debug("Couldn't find node for value: \(value.valueName)")
return []
}

Expand All @@ -49,26 +49,26 @@ public class DependencyGraph<Value: NodeValue> {
/// - Parameter node: the node whose children to search through
/// - Returns: an array of nodes ordered by a depth-first search approach
private func depthFirstSearch(startingAt node: Node) -> [Node] {
logger.debug("----\nSearching for: \(node.value.valueName)")
GenIRLogger.logger.debug("----\nSearching for: \(node.value.valueName)")
var visited = Set<Node>()
var chain = [Node]()

/// Visits node dependencies and adds them to the chain from the bottom up
/// - Parameter node: the node to search through
func depthFirst(node: Node) {
logger.debug("inserting node: \(node.value.valueName)")
GenIRLogger.logger.debug("inserting node: \(node.value.valueName)")
visited.insert(node)

for edge in node.edges where edge.relationship == .dependency {
if visited.insert(edge.to).inserted {
logger.debug("edge to: \(edge.to)")
GenIRLogger.logger.debug("edge to: \(edge.to)")
depthFirst(node: edge.to)
} else {
logger.debug("edge already in visited: \(visited)")
GenIRLogger.logger.debug("edge already in visited: \(visited)")
}
}

logger.debug("appending to chain: \(node.value.valueName)")
GenIRLogger.logger.debug("appending to chain: \(node.value.valueName)")
chain.append(node)
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/DependencyGraph/DependencyGraphBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class DependencyGraphBuilder<Provider: DependencyProviding, Value: NodeVa
return existingNode
}

logger.debug("Adding value: \(value.valueName) to graph")
GenIRLogger.logger.debug("Adding value: \(value.valueName) to graph")

let dependencies = provider.dependencies(for: value)
let node = graph.addNode(for: value)
Expand Down
10 changes: 5 additions & 5 deletions Sources/GenIR/BuildCacheManipulator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ struct BuildCacheManipulator {
}
.reduce(into: [String: URL]()) { $0[$1.lastPathComponent] = $1 }

logger.debug("symlinks to update: \(symlinksToUpdate)")
logger.debug("existing frameworks: \(existingFrameworks)")
GenIRLogger.logger.debug("symlinks to update: \(symlinksToUpdate)")
GenIRLogger.logger.debug("existing frameworks: \(existingFrameworks)")

try symlinksToUpdate.forEach { name, path in
guard let buildProductPath = existingFrameworks[name] else {
logger.error("Couldn't lookup \(name) in existing frameworks: \(existingFrameworks.keys)")
GenIRLogger.logger.error("Couldn't lookup \(name) in existing frameworks: \(existingFrameworks.keys)")
return
}

Expand Down Expand Up @@ -147,7 +147,7 @@ struct BuildCacheManipulator {
}

// Uh oh, there shouldn't be more than one folder here - was a clean performed?
logger.warning(
GenIRLogger.logger.warning(
"Expected one folder at path: \(path), but got \(folders.count): \(folders). Attempting to select a Debug or Veracode configuration folder"
)

Expand All @@ -161,7 +161,7 @@ struct BuildCacheManipulator {
}

if filtered.count > 1 {
logger.error(
GenIRLogger.logger.error(
"""
Found more than one possible folders matching 'debug' or 'veracode' configurations: \(filtered). Please ensure you build from a clean state.
"""
Expand Down
24 changes: 12 additions & 12 deletions Sources/GenIR/CompilerCommandRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ struct CompilerCommandRunner {
let totalCommands = commands
.map { $0.value.count }
.reduce(0, +)
logger.info("Total commands to run: \(totalCommands)")
GenIRLogger.logger.info("Total commands to run: \(totalCommands)")

var totalModulesRun = 0

for target in targets {
// Continue to the next target if no commands are found for the current target
guard let targetCommands = commands[TargetKey(projectName: target.projectName, targetName: target.name)] else {
logger.debug("No commands found for target: \(target.name) in project: \(target.projectName)")
GenIRLogger.logger.debug("No commands found for target: \(target.name) in project: \(target.projectName)")
continue
}

logger.info("Operating on target: \(target.name). Total modules processed: \(totalModulesRun)")
GenIRLogger.logger.info("Operating on target: \(target.name). Total modules processed: \(totalModulesRun)")

totalModulesRun += try run(commands: targetCommands, for: target.productName, at: output)
}

let uniqueModules = Set(try fileManager.files(at: output, withSuffix: ".bc")).count
logger.info("Finished compiling all targets. Unique modules: \(uniqueModules)")
GenIRLogger.logger.info("Finished compiling all targets. Unique modules: \(uniqueModules)")
}

/// Runs all commands for a given target
Expand All @@ -85,12 +85,12 @@ struct CompilerCommandRunner {
let targetDirectory = directory.appendingPathComponent(name)

try fileManager.createDirectory(at: targetDirectory, withIntermediateDirectories: true)
logger.debug("Created target directory: \(targetDirectory)")
GenIRLogger.logger.debug("Created target directory: \(targetDirectory)")

var targetModulesRun = 0

for (index, command) in commands.enumerated() {
logger.info(
GenIRLogger.logger.info(
"""
\(dryRun ? "Dry run of" : "Running") command (\(command.compiler.rawValue)) \(index + 1) of \(commands.count). \
Target modules processed: \(targetModulesRun)
Expand All @@ -106,7 +106,7 @@ struct CompilerCommandRunner {
do {
result = try Process.runShell(executable, arguments: arguments, runInDirectory: directory)
} catch {
logger.error(
GenIRLogger.logger.error(
"""
Couldn't create process for executable: \(executable) with arguments: \(arguments.joined(separator: " ")). \
This is likely a bug in parsing the build log. Please raise it as an issue.
Expand All @@ -122,7 +122,7 @@ struct CompilerCommandRunner {
continue
}
}
logger.error(
GenIRLogger.logger.error(
"""
Command finished:
- code: \(result.code)
Expand All @@ -141,7 +141,7 @@ struct CompilerCommandRunner {
switch command.compiler {
case .swiftc:
guard let outputFileMap = try getOutputFileMap(from: arguments) else {
logger.error("Failed to find OutputFileMap for command \(command.command) ")
GenIRLogger.logger.error("Failed to find OutputFileMap for command \(command.command) ")
break
}

Expand All @@ -151,7 +151,7 @@ struct CompilerCommandRunner {
}

if clangAdditionalModules == 0 && swiftAdditionalModules == 0 {
logger.error(
GenIRLogger.logger.error(
"""
No modules were produced from compiler, potential failure. Results: \n\n \
executable: \(executable)\n\n \
Expand Down Expand Up @@ -290,8 +290,8 @@ extension CompilerCommandRunner {
let path = arguments[index + 1].fileURL

guard fileManager.fileExists(atPath: path.filePath) else {
logger.error("Found an OutputFileMap, but it doesn't exist on disk? Please report this issue.")
logger.debug("OutputFileMap path: \(path)")
GenIRLogger.logger.error("Found an OutputFileMap, but it doesn't exist on disk? Please report this issue.")
GenIRLogger.logger.debug("OutputFileMap path: \(path)")
return nil
}

Expand Down
Loading