I am using InteliJ IDEA to develop my application which was working as expected until I added the [lein-environ "1.0.1"] plugin to my project.clj.
If I run my application using lein it all runs as expected however, if I launch a debug repl (need to test the logic etc) then I get the following error:
Could not locate lein_environ/plugin__init.class or lein_environ/plugin.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
My 'project.clj' contents:
defproject some-project "1.0.0"
:description "Some random description"
:license {:name "FILLER DATA"}
:dependencies [[org.clojure/clojure "1.7.0"]
[environ "1.0.1"]
[stencil "0.5.0"]
[clj-http "2.0.0"]
[clj-ssh "0.5.11"]
[cheshire "5.5.0"]
[clj-time "0.11.0"]
[amazonica "0.3.33"]
[expectations "2.0.9"]
[im.chit/cronj "1.4.1"]
[dk.ative/docjure "1.9.0"]
[com.draines/postal "1.11.3"]
[org.clojure/data.csv "0.1.3"]
[org.clojure/java.jdbc "0.4.1"]
[...]]
:plugins [[lein-environ "1.0.1"]
[lein-expectations "0.0.8"]]
:resource-paths ["resources" "jobs"]
:profiles {:repl {:env {:in-repl? true}}}
:main source-file.core)
If I remove the [lein-environ "1.0.1"] from the plugins the debug repl launches and functions as expected however, I need the plugin to be able to generate the .lein-env from my profiles.clj
Any idea what is causing this issue? I have tried removing environ from ~/.m2/path/to/lein-environ but no luck.
This was a bug in a recent version of Cursive. If you upgrade it should be fixed.
Related
The root problem is that nix uses autoconf to build libxml2-2.9.14 instead of cmake, and a consequence of this is that the cmake-configuration is missing (details like version number, platform specific dependencies like ws2_32 etc which are needed by my project cmake scripts). libxml2-2.9.14 already comes with cmake configuration and works nicely, except that nix does not use it (I guess they have their own reasons).
Therefore I would like to reuse the libxml2-2.9.14 nix package and override the builder script with my own (which is a trivial cmake dance).
Here is my attempt:
defaultPackage = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
cmakeLibxml = pkgs.libxml2.overrideAttrs( o: rec {
PROJECT_ROOT = builtins.getEnv "PWD";
builder = "${PROJECT_ROOT}/nix-libxml2-builder.sh";
});
in
Where nix-libxml2-builder.sh is my script calling cmake with all the options I need. It fails like this:
last 1 log lines:
> bash: /nix-libxml2-builder.sh: No such file or directory
For full logs, run 'nix log /nix/store/andvld0jy9zxrscxyk96psal631awp01-libxml2-2.9.14.drv'.
As you can see the issue is that PROJECT_ROOT does not get set (ignored) and I do not know how to feed my builder script.
What am I doing wrong?
Guessing from the use of defaultPackage in your snippet, you use flakes. Flakes are evaluated in pure evaluation mode, which means there is no way to influence the build from outside. Hence, getEnv always returns an empty string (unfortunately, this is not properly documented).
There is no need to refer to the builder script via $PWD. The whole flake is copied to the nix store so you can use your files directly. For example:
builder = ./nix-libxml2-builder.sh;
That said, the build will probably still fail, because cmake will not be available in the build environment. You would have to override nativeBuildInputs attribute to add cmake there.
I am trying to find all cases of println and replace them with log.debug() for starters, then clean up the logs. Is there a tool somewhere than can help me do that? Is this even possible? We are trying to replace both the beginning of a line with log.debug( AND the end of it, with the ).
We are on:
Groovy 2.5.11
Java 1.8
IntelliJ IDEA 2020.2.1 (Ultimate Edition) Build #IU-202.6948.69
Windows OS
Example:
//find all instances of (text in logs is varied)
println "this is a log"
//and replace with
log.debug("this is a log")
Search pattern: println "(.*?)"
Replace pattern: log.debug("$1")
Notice the regex search option is enabled (.* icon on the right).
More details in IntelliJ IDEA documentation.
I'm trying to convert autotools project to Meson and stuck on translation of desktop file.
There is no problem to get all .mo files created.
POTFILES and LINGUAS are in 'po' folder as per manual.
Only problem is i18n.merge_file is not generating file with translations.
My meson.build looks like
...
package = meson.project_name()
i18n = import('i18n')
add_project_arguments('-DGETTEXT_PACKAGE="#0#"'.format(package), language:'c')
subdir('po')
i18n.merge_file(
input: 'data/clipit.desktop.in',
output: 'clipit.desktop',
type: 'desktop',
po_dir: 'po',
install: true,
install_dir: '/usr/share/applications'
)
...
po/meson.build
i18n.gettext(package, preset: 'glib')
clipit.desktop.in
[Desktop Entry]
_Name=ClipIt
_Comment=Clipboard Manager
Icon=clipit-trayicon-offline
Exec=clipit
Terminal=false
Type=Application
Categories=GTK;GNOME;Application;Utility;
After ninja install output is:
[Desktop Entry]
Icon=clipit-trayicon-offline
Exec=clipit
Terminal=false
Type=Application
Categories=GTK;GNOME;Application;Utility;
It is based on (https://mesonbuild.com/Porting-from-autotools.html) but also tried to follow 'eye of gnome' meson.build. No luck.
Current version of code on github.
Edit:
Leaving snippet that can be used, as meson documentation don't cover using intltool.
custom_target('clipit.desktop',
input : 'data/clipit.desktop.in',
output : 'clipit.desktop',
command: [intltool_merge, '-d', '-u', join_paths(meson.source_root(), 'po'), '#INPUT#', '#OUTPUT#'],
install : true,
install_dir : get_option('datadir') / 'applications')
The reason why this doesn't work, is that this isn't valid input to gettext :)
The underscore at the start of the _Name and _Comment fields are because of intltool, another translation tool similar to gettext. To solve this, just remove the underscore of those fields. This will work for .desktop files. For more information, you can also take a few hints from https://wiki.gnome.org/MigratingFromIntltoolToGettext
On a side note, you shouldn't direct install to '/usr/share/applications', since someone might want to choose a custom prefix or datadir (see Meson - Built-in options for more info). It's better to use install_dir: get_option('datadir') / 'applications'.
First of all I should point out I'm new to Atlassian's Bamboo and continuous integration in general. This is the first project where I've used either.
I've created a raft of unit tests using the tSQLt framework. I've also configured Bamboo to:
Get a fresh copy of the repository from BitBucket
Drop & re-create the build DB
Use Red-Gate SQL Compare to deploy the DB objects from source to the build DB
Run the tSQLt tests
Output the results of the tests in XML format to a file called TestResults.xml
I've checked and can confirm that the TestResults.xml file is created.
In Bamboo I then added a JUnit Parser task to consume the contents of this TestResults.xml file. However when that task runs it returns this error:
Failed to parse test result file
At first I thought it might have meant that Bamboo could not find the file. I changed the task that created the results file to output a file called TestResults2.xml. When I did that the JUnit Parser returned this error:
Failing task since test cases were expected but none were found.
So I'm assuming that the first error message means Bamboo is finding the file, it just can't parse the file.
I have no idea where to start working out what exactly is the problem. Has anyone got any ideas?
I had a similar problem, but turned out to be weird behavior from bamboo needing file stamps being modified to have visibility of the JUnit file.
In Windows enviornment you just need to add "script task" before the "JUnit task"
powershell (ls *.xml).LastWriteTime = Get-Date
Reference
https://jira.atlassian.com/browse/BAM-12768
I have had several cases of this and was able to fix it by removing single quotes and greater than / less than characters from test names inside the *.rb file.
Example
test "make sure 'go_to_world' is removed from header and length < 23"
change to remove single quotes and < symbol
test "make sure go_to_world is removed from header and length less than 23"
Very common are contractions: "won't don't shouldn't", or possessives: "the vessel's data".
And also < or > characters.
I think there is a bug in the parser that just doesn't escape those characters in a test title appropriately.
I'm new to Clojure, and I would like to know where is all the documentation
for all the libraries such as those found on clojars.org?
for example using lein I do the following to the project.clj
(defproject Program-name "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[facts/speech-synthesis "1.0.0"]
[org.clojars.jeffsigmon/maryclient "4.3.0"]
[speech-synthesis "1.0.0"]
[clarity "0.5.6"]])
then uselein deps to install all the libraries
Core.clj
(ns Program-name.core
(:use [speech-synthesis.say :as say])(use [clarity.component]))
(use 'clarity.form)
so how would I import and get the API information for org.clojars.jeffsigmon/maryclient?
note: I read that that the API documentation is stored in the
libraries and you have to import them to access it
The API docs are in the code in the form of docstrings
e.g.
(defn my-func
"This is the doc string"
[a b c]
...)
You can access the doc strings in the REPL:
$ lein repl
user> (doc println)
-------------------------
clojure.core/println
([& more])
Same as print followed by (newline)
user> (apropos "print")
(*print-radix* *print-miser-width* *print-pprint-dispatch* print-table
print-length-loop pprint-indent pprint *print-suppress-namespaces*
*print-right-margin* *print-pretty* with-pprint-dispatch ...)
user> (find-doc "print")
... lots of functions related to print with docs...
Various IDEs also give access to the docs. e.g. in emacs, with swank you can use slime-describe-symbol accessed via the shortcut C-c C-d d
use doc, find-doc, apropos function on REPL, use lein repl start a repl.
BTW: if the library jar is not include .clj files, you cannot use them.