Merge pull request #200 from gren-lang/refuse-to-compile-transient-local-deps

Refuse to compile a dependency with local dependencies.
This commit is contained in:
Robin Heggelund Hansen 2023-03-13 21:00:40 +01:00 committed by GitHub
commit a1edf1fcaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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
@ -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 "