Skip to content

Commit

Permalink
Merge pull request #200 from gren-lang/refuse-to-compile-transient-lo…
Browse files Browse the repository at this point in the history
…cal-deps

Refuse to compile a dependency with local dependencies.
  • Loading branch information
robinheghan authored Mar 13, 2023
2 parents b8c2fec + 3e19bb3 commit a1edf1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
13 changes: 9 additions & 4 deletions builder/src/Deps/Solver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ addVersion reportKey (Goals rootPlatform pending solved) name source =
if C.goodGren gren
then
if Platform.compatible rootPlatform platform
then do
depsConstraintSources <- Map.traverseWithKey resolveToConstraintSource deps
newPending <- foldM (addConstraint name solved) pending (Map.toList depsConstraintSources)
return (Goals rootPlatform newPending (Map.insert name source solved))
then
if any PossibleFilePath.is deps
then
solverError $
Exit.SolverTransientLocalDep name
else do
depsConstraintSources <- Map.traverseWithKey resolveToConstraintSource deps
newPending <- foldM (addConstraint name solved) pending (Map.toList depsConstraintSources)
return (Goals rootPlatform newPending (Map.insert name source solved))
else
solverError $
Exit.SolverIncompatiblePlatforms name rootPlatform platform
Expand Down
12 changes: 12 additions & 0 deletions builder/src/Reporting/Exit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ data Solver
| SolverBadLocalDepExpectedPkg FilePath Pkg.Name
| SolverBadLocalDepInvalidGrenJson FilePath Pkg.Name
| SolverLocalDepNotFound FilePath Pkg.Name
| SolverTransientLocalDep Pkg.Name
| SolverBadGitOperationUnversionedPkg Pkg.Name Git.Error
| SolverBadGitOperationVersionedPkg Pkg.Name V.Version Git.Error
| SolverIncompatibleSolvedVersion Pkg.Name Pkg.Name C.Constraint V.Version
Expand Down Expand Up @@ -1086,6 +1087,17 @@ toSolverReport problem =
[ D.reflow
"Verify that the path is correct."
]
SolverTransientLocalDep pkgName ->
Help.report
"PROBLEM SOLVING PACKAGE CONSTRAINTS"
Nothing
( Pkg.toChars pkgName
++ " has defined one or more local dependencies."
)
[ D.reflow
"Dependencies are not allowed to define their own local dependencies. Contact the package \
\author to resolve this issue."
]
SolverBadGitOperationUnversionedPkg pkg gitError ->
toGitErrorReport "PROBLEM SOLVING PACKAGE CONSTRAINTS" gitError $
"I need the gren.json of "
Expand Down

0 comments on commit a1edf1f

Please sign in to comment.