Skip to content

Commit 44bafee

Browse files
authored
Merge pull request #34 from aminya/includer-in-entry
2 parents 2e9a85d + f565612 commit 44bafee

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/postprocess.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,25 @@ function postprocess()
1717
rm(artifact_path, recursive=true)
1818

1919
# Discard unrelated changes
20-
git_checkout_all(["src/precompile_includer.jl", r"precompile/.*precompile_.*\.jl"], pwd())
20+
package_entry_regex = r"src\/[A-Z][^\/]*\.jl"
21+
precompile_files_regex = r"precompile\/.*precompile_.*\.jl"
22+
git_checkout_all(["src/precompile_includer.jl", precompile_files_regex, package_entry_regex], pwd())
23+
24+
# ignore whitespace
25+
# last line of src/Package.jl needs to be kept!
26+
# https://stackoverflow.com/a/49899908/7910299
27+
try
28+
diff_file = tempname()
29+
run(pipeline(
30+
`git diff --ignore-space-change --ignore-all-space --ignore-blank-lines --ignore-cr-at-eol --ignore-space-at-eol`,
31+
diff_file,
32+
))
33+
run(`git stash`)
34+
run(`git apply --ignore-space-change --ignore-whitespace --whitespace=fix $diff_file`)
35+
catch
36+
@warn "The generated PR includes whitespace changes. Please commit the generated .gitattributes to prevent these changes"
37+
run(`git stash pop`)
38+
end
2139

2240
# Format precompile_includer.jl
2341
format_file(joinpath(pwd(), "src/precompile_includer.jl"))

0 commit comments

Comments
 (0)