Ordinarily I'd also check that the filename was not "-", or perhaps
get the absolute path, but in this case I know the filename. (Otherwise
this could result in a hung process as gpg waited for stdin.)
The dependencies for pomegranate were cleaned up as of pomegranate-0.0.8. We no longer need to exclude slf4j. (Hard to claim this is important; I just happened to notice that it was not needed.)
Fixes#978.
By adding an atom (to pop off used aliases to avoid recursive calls)
which contains :user :aliases from profiles, we can use those aliases
outside of project maps. Whenever looking up aliases, will check the
atom if we're not in a project.
Add support for profiles.d within the user's Leiningen home directory. All .clj
files within LEIN_HOME/profiles.d will be treated as maps merged into the
original profiles.clj (if existing).
Erroneous .clj file inside profiles.d emits an error message and will be treated
as nil.
A profile defined multiple times will error and "crash" the loading of profiles,
such that profiles return nil.
The errors will only be emitted once for user-friendliness.
This commit handles three major bugs with the current way of redirecting input
from Leiningen to a sub-process:
- The redirection is never stopped. This means that typing on the keyboard after
a sub-process has finished will crash the thread redirecting data from *in* to
the sub-process' input stream, as it is closed.
- The redirection is buffered. This means that data intended to a subsequent
sub-process may be sent to this sub-process instead.
- The redirection blocks instead of busy waits. For the output streams, this is
perfectly fine and the recommended approach to avoid wasting cycles. However,
this has some issues when done to an input stream: If the sub-process finishes
while the thread block waiting for a character, we will be unable to stop the
thread before a character has been read. The consequence is that a character
originally intended to the subsequent sub-process will be given to the
previous process.
These issues are solved by reading one byte at a time, busy wait on data and
gracefully exit when the sub-process has ended (through a mutable
variable/atom).
By treating the `:user` profile in `profile.clj` as the project map when one's
outside of a project, the default repositories among with any mentioned
repositories within the `:user` profile will be fetched without any issues. Also
works fine when `profile.clj` doesn't contain any `:user` profile or no
`profile.clj` exists.
An object with the metadata flag `:displace` set signals that, if a merge
conflict appears, this object is to be discarded. Likewise, `^:replace` signals
that this object should be kept in a merge conflict.
However, previous functionality only tested if the right element had the
`:replace` flag, or if the left element had the `:displace` flag. This commit
resolves this by checking whether the left element has a `:replace` flag and the
right element has a `:displace` flag, and handles accordingly to the semantics
explained in the previous paragraph.
Whenever two elements where both has the `:displace` flag is merged, the
leftmost is picked, and their metadata is merged. Likewise for the `:replace`
flag. The elements will not lose their `:displace` and `:replace` flags, as they
have not really been preferred over another element.
The `nil?` tests have been placed at the top to reflect that nil is the lack of
a value, not a value itself. As such, elements will not be "preferred" or
"discarded" over nil/nothing.
For "important" events, aether gives us enough info to figure
out which repo it is happening from. Lets use it instead
of trying to match from project data.
Previously matching from the project data would be incorrect
and output failures or not output anything for transative repos.
Previously the output for downloading files would just say "failed to find".
Instead output the fact checksums were invalid, and from which repository.
Removes the task to be run residing within a project's metadata (inside
:without-profiles) in addition to the original map, in order to prevent
"with-profile" from reviving already used aliases.
This makes it so that a selector such as :only can prevent unnecessary loading
of namespaces that they aren't going to work on. It is a way for a selector
that knows which namespaces it will touch by the selector's arguments and the
namespace names themselves to not have to load all namespaces.
This commit also fixes a bug introduced by a recent pull request where
'namespaces' could not be resolved. Per discussion with technomancy, provided a
default test selector *always*.
This allows for other directories to be used for the automatic
repository tagging. This is useful for repositories that contain
multiple projects, such as leiningen-core and leiningen, so that both
will have the correct repository tag information in their pom.xml.
There was a good reason we couldn't support this in earlier versions
of Leiningen, but it escapes me now. Perhaps it doesn't work on old
JDKs or there are platform-specific issues or something?
This is accomplished with the :reduce metadata, which specifies the
reduce function to use when merging. This allows us to merge
dependencies and repositories deeply like other structures. Note that
dependencies are transformed into a map before they are merged and then
transformed back into a vector.
Also change the way that collections are merged. They used to be merged
by taking the right collection and prepending it to the left collection.
This behavior was needed for :*-paths in defproject, but it is not an
obvious default. Now, the default is to append the right collection, but
the :prepend metadata can be used to tell meta-merge to prepend instead.
By default, :source-paths, :resource-paths and :test-paths have :prepend
set to true.
This is a list of all named profiles that have been merged in, after
following composite profile. This is different from :included-profiles
which is the list of profiles before composite profiles have been
expanded.
* namespaced keywords to control lookup of credentials in env vars
* using a vector to define a number of credential sources to be checked in series
(gh-768)
Showing every failed repo lookup is bad for users.
They see the failure and get confused.
Hook up a custom listener that has the following behavior:
1. success -> print out artifact name, size, and repository name
2. failure -> ignore unless it is the last repo, then print out failure
message with artifact name.
Fixes#610.
use concat instead of merge to merge values, :plugin-repositories and :repositories are lists again
with merge you will end up with a value for :repositories like [[repo {:url url}] ([pluginrepo {:url url}])]
instead of [[repo {:url url}] [pluginrepo {:url url}]]
On some platforms, eg. Mac, it may be more desirable to use an executable other
than 'gpg' for signing and encryption, and it may not be possible to symlink to
'gpg'. This allows the gpg executable used in lein to be specified via LEIN_GPG.
You can use ~/.lein/leinrc or ~/.leinrc to set LEIN_GPG by adding
'export LEIN_GPG=your-gpg' to either of those files.
On a coworker's Mac, the default file encoding was apparently
MacRoman. The -Dfile.encoding=UTF-8 that's in the lein shell script
wasn't being propogated to subprocesses which caused rage and the
replacement character.
Don't call set-profiles from leiningen.core.project/read because it
calls load-middleware, and we want to wait to do that for the first time
in init-project. To solve this, I added init-profiles which is called by
both read and set-profiles.
Also clean up init-project and move code duplicated in set-profiles into
activate-middleware. We now always load hooks and certificates when
activating middleware, and load-certificates is actually called twice in
the course of init-project. To make sure load-certificates is
idempotent, we memoized leiningen.core.ssl/register-scheme.
Both now expect a full var, though hooks will fall back to activate in
the provided namespace for compatibility.
Also, use the following convention for plugin auto hooks and middleware:
- Assuming your plugin is called lein-config
- Put hooks you want auto-loaded in lein-config.plugin/hooks
- Put middleware you want auto-applied in lein-config.plugin/middleware
Previously, you could not unmerge composite profiles. So, if the
currently active profiles were [:default], which is a composite of
[:dev :user :base], then (unmerge-profiles project :dev) would do
nothing. To fix this, we have to keep track of both :included-profiles
and :excluded-profiles.
I also combined apply-profiles and reset-profiles into a single function
called reset-profiles with an optional excluded-profiles argument and
renamed apply-profiles-raw to apply-profiles.
Any dependency marked with :ext true will be loaded by the ext class loader.
Libraries with native dependencies (e.g. tokyocabinet) need to be loaded by
the ext classloader, because native libraries can only be loaded once per
JVM. Also, most SQL libraries (e.g. postgresql) need to be in the ext class
loader because java.sql.DriverManager holds onto the class.
Use 0.6.6 classlojure's alter-java-library-path! to set java.library.path
at runtime.
Perhaps we should be setting all of these system properties back after
we are done, including this one?
This can happen in merge-profiles, unmerge-profiles or in the newly
added reset-profiles. All three rebuild the project map from scratch
using `(:without-profiles (meta project))`. This prevents middleware
from being applied twice to the same project map.
We also have to call apply-middleware explicitly in init-project because
we want to load-plugins before applying middleware in this case only. An
alternative would be to load plugins every time project profiles are
modified. @technomancy, what do you think of that option?
Issue #401
Conflicts:
leiningen-core/src/leiningen/core/main.clj
src/leiningen/pom.clj
The new certificate is trusted by Oracle JVMs by default but there
are still some users with JVMs that don't have any default root certs
at all. The FreeBSD OpenJDK packages are apparently one such example.
You can now overide :default in your project.clj to change what profiles are
active when none are specified. As part of this change, default is no longer
used to for built-in settings; these are now stored in the :base profile.
This makes it possible to override :default while still including the :base
profile.
if a profile value is a vector, then combine the values using
combine-profiles. this allows you to remove duplication by putting
shared configuration in "base" profiles.
This is helps people coming from the Java world. "java" accepts -help
and -version, and neither --help nor --version. With this commit,
Leiningen accepts long names with either single or double dashes.
The default certificates and repositories are in project/defaults
so we need to include it explicitly. The reason load-plugins knew
to try clojars at all is that normalize-repos explicitly adds the
default repos. This obviously doesn't happen for other keys such as
:certificates though.
We need to do this as get-classpath can itself trigger the downloading
of dependencies. This also ensures leiningen-core/resources is added to
the classpath by the wrapper scripts.