If I don't want to use cargo for some reasons, I have the error: could not find 'Cargo.toml'. Is there any way to disable all Cargo.toml-related functionality?
I tried this:
{
"cargo": {
"noSysroot": true,
"sysroot": "",
"autoreload": false,
"buildScripts": { "enable": false }
}
}
But this didn't help.
To use rust-analyzer with single files, please check out https://github.com/rust-lang/rust-analyzer/pull/8955. For larger projects that don't use Cargo, you won't be able to use rust-analyzer at the moment as per this comment.
Related
I am running assemble for my library module , I see from logs that it should generate two files myLib-release.aar and myLib-debug.aar inside the myLib/build/outputs/ folder.
However, I always only find one lib there that is myLib.aar, it doesn't matter if I run assemble for both, assembleDbug or assembleRelease.
Why is this happening?
According to this discussion it is an error (or planned feature) in gradle, up to date it is still the same.
https://github.com/gradle/gradle/issues/8328
Workaround can be to implement this:
// in library/library.gradle
afterEvaluate {
def debugFile = file("$buildDir/outputs/aar/library.aar")
tasks.named("assembleDebug").configure {
doLast {
debugFile.renameTo("$buildDir/outputs/aar/library-debug.aar")
}
}
tasks.named("assembleRelease").configure {
doLast {
debugFile.renameTo("$buildDir/outputs/aar/library-release.aar")
}
}
}
You may then implement copy tasks as desired.
I know how to say that a dependancy is only needed on windows but how do I say (as a crate writer) that a feature is only available on windows.
I tried (based on the depends way)
[target.'cfg(windows)'.features]
windbg = []
but this doesn't work.
cargo build says
warning: unused manifest key: target.cfg(windows).features
and a client app using the crate fails saying that the feature doesn't exist
Currently Cargo is not able to specify feature's target platform, but you can add target_os to your code as an extra attribute to let compiler know that your feature will only be available on the target you set.
Let's say you have defined your feature like below.
#[cfg(feature = "windbg")]
mod windbg {
//...
}
You'll need to replace it with:
#[cfg(all(target_os = "windows", feature = "windbg"))]
mod windbg {
//...
}
I am looking at this https://github.com/lorenwest/node-config, and it seems to do everything I need. However I am wondering if it's possible to specify multiple config files based on their categories.
Is this possible to do this?
./config
default-aws.json or aws-default.json
production-aws.json or aws-production.json
db-default.json
db-production.json
etc..
so the config files can be smaller? I know we could make a giant config that has all of those required in different sections. eg
{
"aws": {
"kinesis": "my-stream"
....
},
"db": {
"host": "my-host"
...
}
}
Anyone has any ideas if this is doable using node-config or different library that works similar to node-config?
Thanks & regards
Tin
The short answer is NO. node-config doesn't support this (As #Mark's response).
The simplest way to do this using node-config is to use JavaScript as config files (https://github.com/lorenwest/node-config/wiki/Configuration-Files#javascript-module---js). This way you still get most of the benefits of using node-config. Then you can simply include other files inside them (https://github.com/lorenwest/node-config/wiki/Special-features-for-JavaScript-configuration-files#including-other-files)
Note that it would be a bit harder to use the multiple config files and overrides for the inner files.
A slightly more complex implementation can use the utility class in config which actually allows you to directly read a specific folder using the same patterns that node-config uses internally (https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities#loadfileconfigsdirectory).
In that case you would probably want to combine all the files to a single config by setting them on the config object before the first call to get (https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source).
I'm a maintainer of node-config. The next version will support a feature to declare multiple NODE_ENV values, separated by a comma.
So if you were doing development in the cloud, you could declare a "development" environment followed by a "cloud" environment.
First the development config would be loaded, followed by the "cloud" config.
The related pull request is #486.
I use nconf. It lets you read multiple configuration files into the same object. Here is an example:
var nconf = require('nconf');
//read the config files; first parameter is a required key
nconf.file('aws', {file: 'default-aws.json'});
nconf.file('db', {file: 'db-default.json'});
console.log(nconf.get('aws:kinesis'));
console.log(nconf.get('db:host'));
default-aws.json:
{
"aws": {
"kinesis": "my-stream"
}
}
db-default.json:
{
"db": {
"host": "my-host"
}
}
How to enable Ignore missing credential option under ssh-agent using DSL Groovy script?
I have tried using ignoreMissingCredentials = true, but no luck.
It seems that:
wrappers {
sshAgentBuildWrapper {
ignoreMissing(true)
}
}
might be what are you looking for.
The Visual Studio Code documentation provides example tasks.json configuration that allows either typescript compilation, or markdown compilation. It does not clarify how to achieve both simultaneously.
How can that be done?
Here is a summary of the two examples...
Typescript Example
If I want VSCode to perform a typescript build step, the directions say I need to install typescript (npm install -g typescript) and then define the following task:
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"showOutput": "silent",
"args": ["*.ts"],
"problemMatcher": "$tsc"
}
Markdown Example
If I want VSCode to perform a Markdown build step, the documentation says I could install a markdown plugin of my choice (e.g. npm install -g marked), and then define a task:
{
"version": "0.1.0",
"command": "marked",
"isShellCommand": true,
"args": ["sample.md", "-o", "sample.html"]
}
Now What?
Evidently, the tasks.json may contain exactly one JSON object. Thus I cannot simply join both definitions above with a comma. On the other hand, it is possible to have multiple tasks defined within the overall task definition:
{
"version": "0.1.0",
"command": "<what goes here?>",
"isShellCommand": true,
"suppressTaskName": true, //or false?
"tasks": [
{
"taskName": "Launch Typescript"
},
{
"taskName": "Launch Markdown"
}
]
}
The above is a skeleton of legal syntax, but it is unclear how to complete the story. I am aware of discussion here and there about how to solve these kinds of issues, but there seems to be a fundamental disconnect. For example, how does VSCode know that it is supposed to execute both tasks when I press ctrl+shift+b?
Assuredly the developers of VSCode have a more direct and simpler way to accommodate multiple build tasks. Does anyone know what that is?
You are almost at the right answer.
You can define multiple build task, as shown in your last example.
What you didn't realize is that you can override global properties within the task. Meaning in one task, you can define "command" and "args" one way and in the other define it with totally different values.
In a sense, copy the meat of two examples you have above into each task in your last example