Skip to content

Commit

Permalink
fix: only add dependency when unresolved (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
luispadron authored Nov 15, 2023
1 parent 9a405f0 commit b2dca3f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions bzlmod/workspace/Sources/MyExecutable/MyExecutable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ import Logging
import MyLibrary
import RegexBuilder

// Because we build on macos/linux this needs to be conditionally imported to test an edge case
#if canImport(os)
import os
#endif

@main
struct MyExecutable: AsyncParsableCommand {
struct Plugin { }
mutating func run() async throws {
let output = "Hello, \(World().name)!"
let logger = Logger(label: "com.example.BestExampleApp.main")
logger.info("\(output)")

#if canImport(os)
os_log("This is a debug message.", log: OSLog.default, type: .debug)
#endif
}
}
11 changes: 9 additions & 2 deletions gazelle/internal/swift/dependency_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,15 @@ func (di *DependencyIndex) ResolveModulesToProducts(
}
sort.Sort(sort.Reverse(psrs))
selectedPsr := psrs[0]
selectedPiks = append(selectedPiks, selectedPsr.pik)
modulesToResolve = modulesToResolve.Difference(selectedPsr.intersect)

if selectedPsr.intersectCnt > 0 {
// We found a product that contains at least one of the modules that we are trying to
// resolve. Add it to the list of selected products and remove the modules that it
// contains from the list of modules that we are trying to resolve.
selectedPiks = append(selectedPiks, selectedPsr.pik)
modulesToResolve = modulesToResolve.Difference(selectedPsr.intersect)
}

potentialPikSet.Remove(selectedPsr.pik)
}

Expand Down

0 comments on commit b2dca3f

Please sign in to comment.