You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+50-1Lines changed: 50 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -196,7 +196,7 @@ The Julia community uses [GitHub issues](https://github.com/JuliaLang/julia/issu
196
196
197
197
Note: These instructions are for adding to or improving functionality in the base library. Before getting started, it can be helpful to discuss the proposed changes or additions on the [Julia Discourse forum](https://discourse.julialang.org) or in a GitHub issue---it's possible your proposed change belongs in a package rather than the core language. Also, keep in mind that changing stuff in the base can potentially break a lot of things. Finally, because of the time required to build Julia, note that it's usually faster to develop your code in stand-alone files, get it working, and then migrate it into the base libraries.
198
198
199
-
Add new code to Julia's base libraries as follows:
199
+
Add new code to Julia's base libraries as follows (this is the "basic" approach; see a more efficient approach in the next section):
200
200
201
201
1. Edit the appropriate file in the `base/` directory, or add new files if necessary. Create tests for your functionality and add them to files in the `test/` directory. If you're editing C or Scheme code, most likely it lives in`src/` or one of its subdirectories, although some aspects of Julia's REPL initialization live in`ui/`.
202
202
@@ -218,6 +218,55 @@ or with the `runtests.jl` script, e.g. to run `test/bitarray.jl` and `test/math.
218
218
219
219
Make sure that [Travis](http://www.travis-ci.org) greenlights the pull request with a [`Good to merge` message](http://blog.travis-ci.com/2012-09-04-pull-requests-just-got-even-more-awesome).
220
220
221
+
#### Modifying base more efficiently with Revise.jl
222
+
223
+
[Revise](https://github.com/timholy/Revise.jl) is a package that
224
+
tracks changes in source files and automatically updates function
225
+
definitions in your running Julia session. Using it, you can make
226
+
extensive changes to Base without needing to rebuild in order to test
227
+
your changes.
228
+
229
+
Here is the standard procedure:
230
+
231
+
1. If you are planning changes to any types or macros, make those
232
+
changes, commit them, and build julia using`make`. (This is
233
+
necessary because `Revise` cannot handle changes to type
234
+
definitions or macros.) By making a git commit, you "shield" these
235
+
changes from the `git stash` procedure described below. Unless it's
236
+
required to get Julia to build, you do not have to add any
237
+
functionality based on the new types, just the type definitions
238
+
themselves.
239
+
240
+
2. Start a Julia REPL session. Then issue the following commands:
241
+
242
+
```julia
243
+
using Revise # if you aren't launching it in your .juliarc.jl
244
+
Revise.track(Base)
245
+
```
246
+
247
+
3. Edit files in`base/`, save your edits, and test the
248
+
functionality. Once you are satisfied that things work as desired,
249
+
make another commit and rebuild julia.
250
+
251
+
Should you for some reason need to quit and restart your REPL session
252
+
before finishing your changes, the procedure above will fail because
253
+
`Revise.track`
254
+
[cannot detect changes in source files that occurred after Julia was built](https://github.com/JuliaLang/julia/issues/23448)---it
255
+
will only detect changes to source files that occur after tracking is
256
+
initiated. Consequently, any changes made prior to
257
+
`Revise.track(Base)` will not be incorporated into your new REPL
258
+
session. You can work around this by temporarily reverting all source
259
+
files to their original state. From somewhere in the `julia`
260
+
directory, start your REPL session and do the following:
261
+
262
+
```julia
263
+
shell> git stash # ensure that the code in `base/` matches its state when you built julia
264
+
265
+
julia> Revise.track(Base) # Revise's source code cache is synchronized with what's running
266
+
267
+
shell> git stash pop # restore any in-progress changes (will now be tracked)
268
+
```
269
+
221
270
### Code Formatting Guidelines
222
271
223
272
#### General Formatting Guidelines for Julia code contributions
0 commit comments