I am learning gradle kotlin DSL. Why is this code example failing to compile with Gradle 6.7.1? - kotlin

the following lines do not compile in my build.gradle.kts, but I do not understand why:
tasks.getting(JavaExec::class) {
standardInput=System.in
}
* What went wrong:
Script compilation error:
Line 21: standardInput = System.in
^ Expecting an element
What is the correct way to write this?

In Kotlin, in is a hard keyword, which cannot be used as an identifier. To access or declare members named in, you have to surround it with backticks (`):
standardInput = System.`in`

Related

how to customize nix package builder script

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.

How do we use the --pdf flag for generating documentation?

The video tutorial in http://www.kframework.org/index.php/Lesson_4,_LAMBDA:_Generating_Documentation;_Latex_Attributes suggests that we should use kompile lambda --pdf, but when I run it I got the following error:
[Error] Critical: Unknown option: --pdf (Unknown option: --pdf)
The kdoc --help option also result in a Command 'kdoc' not found error.
How do I correctly use this option to generate the formatted K definition?
The kdoc functionality (and --pdf) has not worked for quite some time.
If you want LaTeX ASTs output for given individual terms, you can use --output latex for any of kast, krun, or kprove. Unfortunately this does not work for entire definitions yet, and will not auto-format for you (it only outputs an AST, you'll still need to tell LaTeX how to render the nodes in said AST).

Enable Suggestions after dot (.) operator?

How do I enable suggestions after dot operator in Intellij 14?
For eg., If I have the following code,
String s = "hello"; --> line 1
s. ---> line 2
In line 2, If I enter . after the variable 's', the suggestions like variables and methods in class String is not shown in suggestions. How can I enable it in Intellij 14?
P.S : Java class path is set correctly and compilation happens properly. Just the development is screwing me up without showing suggestions.
From IntelliJ, try Help > Find Action..., and then type 'code completion'. Make sure the feature is enabled in Settings.

How can i define DEBUG when the build type is debug?

I want to pass "-DDEBUG" to the C++ compiler when the build type starts with "debug", something like this:
if meson.build_type().starts_with('debug')
add_global_arguments('-DDEBUG', language : 'cpp')
endif
However there is no meson.build_type(), so I get this error message from meson:
Meson encountered an error in file meson.build, line 5, column 23:
Unknown method "build_type" in object.
How can I get the build type? Or is there a different way to define DEBUG in debug builds?
if get_option('buildtype').startswith('debug')
add_project_arguments('-DDEBUG', language : 'cpp')
endif
The accepted answer didn't work on meson 0.63.0, instead I did this, per the FAQ:
if get_option('buildtype') == 'debug'
add_global_arguments('-DDEBUG', language : 'cpp')
endif

Getting error "Argument is not a literal String" while running genstrings command

While trying to run the following command: genstrings ./Classes/*.m on a Terminal, I am getting the following error: Argument is not a literal String. Does anyone know what the problem might be?
Check your source files if you have something like
NSLocalizedString(stringVariable, #"comment");
Maybe you should have a literal string in this function:
NSLocalizedString(#"literalString", #"comment");
In my case, I got the error because I had NSLocalizableString in a comment (e.g. "// TODO: Change line above to NSLocalizableString before going to production"). Apparently, genstrings does not ignore comments.
In my case, importing the NSLocalizedString function in Swift caused this issue:
import func Foundation.NSLocalizedString
I just temporarily used import Foundation and it worked.