Skip to content

Commit

Permalink
feat: add more lines to toml mathlib detection
Browse files Browse the repository at this point in the history
  • Loading branch information
austinletson committed May 11, 2024
1 parent c6c4189 commit 4579e86
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/detect_mathlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ echo "Trying to detect if project is downstream of Mathlib."

# define mathlib dependency patterns for lakefile.lean and lakefile.toml
dot_lean_pattern="require mathlib"
dot_toml_pattern="git = \"https://github.com/leanprover-community/mathlib4\""
dot_toml_pattern="\[\[require\]\]\nname = \"mathlib\"\ngit = \"https://github.com/leanprover-community/mathlib4"

# Check if the lakefile.lean file contains "require mathlib"
if grep -q "$dot_lean_pattern" lakefile.lean || grep -q "$dot_toml_pattern" lakefile.toml; then
# Check if lakefile.lean or lakefile.toml contain the mathlib dependency pattern
if grep -q "$dot_lean_pattern" lakefile.lean || grep -Pzq "$dot_toml_pattern" lakefile.toml; then
# Set the DETECTED_MATHLIB variable to true and send it to the GitHub action output to be used in later steps
echo "DETECTED_MATHLIB=true" >> "$GITHUB_OUTPUT"
echo "Project is downstream of Mathlib. Using Mathlib cache."
else
Expand Down

0 comments on commit 4579e86

Please sign in to comment.