* This is change in behavior, we catch the clojure.core/read-string
exception and we print it to stderr. The difference is that we
let the process continue (e.g. `lein repl` starts) and the previous
behavior was to die (due to the throwing the exception)
* We could mimic the previous behavior by exiting (System/exit 1) on
this exception.
Using clojure.edn/read-string results in nil instead of an exception
user=> (edn/read-string "")
nil
user=> (read-string "")
RuntimeException EOF while reading clojure.lang.Util.runtimeException (Util.java:221)
This addresses the problems seen in #1900 and #1901. It doesn't fix
them because they can't be fixed without breaking other things,
(https://github.com/technomancy/grenchman/issues/34) but at least it
lets people know what is going on and suggests a workaround.
In case network is down while fetching dependencies and we get
NoRouteToHostException exception, fallback to `:offline? true`
behaviour.
Fixes#2054 issue.
When generating a profile scope string for the target path, any subset
of active profiles that matches a composite profile are replaced with
the composite.
For example, the profiles [:base :system :user :provided :dev :foo]
would be represented as "default+foo", because the :default profile is a
composite of [:base :system :user :provided :dev].
This version addresses two Java 9 related issues:
* 0.2.4 would fail under Java 9 if AOT'd
* the latest Java 9 build (9-ea+148) broke dynapath's reflection to make
URLClassLoader modifiable
This switches the default repo url (for resolving artifacts, not
deploying) to point to the CDN-fronted repo. Note that this repo won't
work with Java 6 - users of 6 will need to manually override the default
url to point to the old one (https://clojars.org/repo).
Prior to this commit, profiles with `^:replace` on the dependencies
list would never end up having their dependencies vector normalized
so that it would have `nil` placeholders for the versions of
dependencies that were inheriting their version from `:managed-dependencies`.
This commit normalizes the dependencies vector of a profile during
initialization, to make sure that it will always be normalized.
Since pomegranate mentions that it likes vectors as inputs to its
functions, this commit changes the normalization function to use
`into` instead of `concat`, to make sure that we get a vector instead
of a sequence.
Prior to this commit, if you wanted to use modifiers such as
`:exclusions` or `:classifier` for a dependency whose version you
were managing with `:managed-dependencies`, you would need to
explicitly pass a `nil` as the version string in the dependency
tuple. This commit adds some logic to coerce the vectors before
they are processed, so that if the version string is simply
omitted instead of being set to `nil`, the `nil` will be implicitly
inserted and things will continue to work as before.
This provides a slightly nicer and more intuitive UX for the
managed-dependencies feature.
In certain cases (e.g. reading a project.clj file out of a jar,
rather than from a file on disk) it is useful for the `read`
and `read-raw` functions to support being passed a `Reader` object,
rather than a File or path.
This commit modifies the `read-raw` function to support being
passed a Reader. It also modifies the `defproject` macro to
avoid the assumption that `*file*` will always have a non-nil
value, because that assumption causes an NPE in the case where
a Reader is the source of the project definition.
This commit adds some additional dependencies to the test project
file for managed dependencies, and significantly increases the
coverage of the tests.
This commit deprecates the `resolve-dependencies` function in
favor of `resolve-managed-dependencies`. It also conditionally adds
the `:managed-dependencies` key to the execution of the deprecated
function, in hopes of improving backward compatibility for cases
where people are still calling the deprecated version.
It also cleans up a few docstring "TODO"s and adds real docstrings.
This commit provides initial support for `managed-dependencies`,
where dependency version numbers may be specified in a separate
section called `managed-dependencies`, and those version numbers
will be used for any deps in the main `dependencies` section
that do not explicitly specify a version number.
This is a precursor to being able to specify a "parent" project
that could be used to consolidate version numbers of common
dependencies across a large number of libraries.
This includes three changes:
* Exclude the dynapath that comes in from bultitude and pomegranate, and
depend directly on a newer version that operates properly under Java 9
* Ensure we have a modifiable classloader before asking pomegranate to
modify it. Before Java 9, the AppClassLoader was a URLClassLoader, and
therefore modifiable. This is no longer the case with Java 9.
* Remove duplicated classpath init code from `eval-in :leiningen`, and
replace it with a call to `project/init-lein-classpath`. This required
making the latter function public.
These changes allow some lein functionality to work under Java 9 - there
is a Java 9 issue with data.xml that needs to be fixed before lein's
tests can all pass (http://dev.clojure.org/jira/browse/DXML-32).
Instead of using String.split then recombining arguments to repair broken
quoted arguments, this parser now finds entire arguments using regex matching.
This is more robust, handling extra whitespace (and non-space whitespace)
correctly, while also correctly matching quotations in argument strings and
preserving internal spaces.
This commit refactors a few things from the `jar` and
`javac` tasks in order to ensure that the "whitelisted"
settings from the user profile (`:local-repo`, `:mirrors`,
etc.) are honored when the `jar` task launches `javac`.
It also adds a test to validate the new behavior.
Passing in the project map as a parameter to eval-in-subprocess causes
havoc, as it has references to the functions reduce-dep-step and
reduce-repo-step in its metadata.
Changes to a native dependency that is not cleaned up will be warned
about to the user. In addition, when a dependency changes, only the
dependencies that actually changed will be checked for native
dependencies, speeding up restart time significantly when you change a
single dependency in a big project.
This fixes the issue with reflection warnings in #2045, but
unfortunately breaks backwards compatibility with 1.1.0. So the lowest
version of Clojure Leiningen now supports is 1.2.0.
Ensures `-XX:-OmitStackTraceInFastThrow` is always included by default
regardless of user's LEIN_JVM_OPTS. This setting can be overridden in
other profiles by the user.
Aliases are higher order, but also attempts to keep track of tasks via
:arglists metadata. The :arglists update function assumed all tasks
would start with a project arg. However, this isn't necessary: A task
may e.g. have the form [& args] and destructure the project arg inside
the function. This caused lein to incorrectly assume that appending more
arguments to the tasks was an error. (The only tasks I know of right now
that does this is mine, so I should probably take the hint)
I also decided to clean up the drop-partial-args function a bit to make
it more readable.
When we expand composite profiles, we may end up with multiple identical
profiles in the resulting list. However, we should only merge a profile
at most once. To fix this, we dedupe the list and retain the _last_
profile mentioned. We retain the last instead of the first as this
prioritises the last profile merges, which is somewhat important for
tasks like repl, uberjar, and to some extent `with-profile +foo`.
It might be interesting to see if we can get away from this in 3.0.0,
for example by saying that
(= (merge-profiles project [:a]) (merge-profiles project [:a :a])).
Fixes#1824 and fixes#2001.
This isn't a perfect solution to error messages, as GPG bypasses the
stdin and sends data directly to the terminal. As such, things from
"stdin" is printed immediately, whereas stderr is printed through the
JVM. As a consequence, it's almost always the case that the stdin lines
are printed before the stderr lines, even though GPG usually sends them
in the opposite order. But it should give you a better indication when
something bad has happened.
Issue #1904 may accidentally be solved as well, as we now have a
shutdown hook on GPG.
If a directory on the classpath does not exist when the JVM is started,
it's ignored even if it is subsequently created. This commit ensures
that source, resource and test paths exist as part of the prep work for
eval-in-project.
Exactly like `sh` except that it requires a failure message and if the
command exits with a non-0 code, it use the failure message to throw an
Exception.
Added unit tests as well.
Upgrade/downgrade are "primitive" tasks that must be implemented in the
shell script for bootstrapping reasons. We have a dummy task just for
the purposes of having somewhere to hang a docstring; this commit adds
the alias for downgrade.
Fixes#1947
Bumping HttpWagon from 2.4 to 2.6 caused old methods in HttpWagon to
disappear, and along with it all the old Apache Http stuff we depended
on. This caused additional CA certificates provided in :certificates to
make Lein just fall on the floor and die.
This bumps HttpWagon to 2.9 and refactors Apache Http usage to
non-deprecated usage for the version we depend on.
Clojure 1.7.0 will add support for reader conditionals:
http://dev.clojure.org/display/design/Reader+Conditionals
This patch adds reader conditional support to leiningen, in particular for
compilation (including aot and stale files) and testing.