How to set environment variable LD_LIBRARY_PATH through build.gradle to generate protobuf code - build.gradle

I am using protobuf gradle plugin in my build.gradle file to
generate grpc and reactor gprc java code.
Due to the security constraints, I cannot use the plugin directly
from the maven central. I have to download those plugins and provide
the local path in my gradle file.
Unfortunately, while setting things locally, it seems that the
protoc compiler looks for LD_LIBRARY_PATH which we need to provide
explicitly.
Is there a way to set this path in gradle file?
Below is how I am using protobuf plugin
apply plugin: "com.google.protobuf"
protobuf {
protoc {
path = "Local protoc path"
}
plugins {
grpc {
path = "Local Protoc gen grpc path"
}
reactor {
path = "Local salesforce reactor grpc path
}
}
generateProtoTasks {
ofSourceSet("main")*.plugins {
grpc {}
reactor {}
}
}
}
Running above file gives below error
"error while loading shared libraries: libprotoc.so.15: cannot open shared object file: No such file or directory"
Looking for this error online shows that I need to set LD_LIBRARY_PATH

The protoc version on Maven Central is statically linked with libprotoc, so LB_LIBRARY_PATH would not be necessary. Use it instead. Note that the files must have a file extension, so they use the .exe file extension even on Linux. You can similarly download the grpc protoc plugin.

Related

How to use relative path to packages in JSonTransform config file

My team uses a shared Git repo that contains, in addition to a src folder with a .net solution, also a tools folder containing JSonTransform tool, that we use during deploy to generate config production files.
This tool uses a json config file named JsonTransform.runtimeconfig.dev.json, with this content:
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\**specific_username**\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\**specific_username**\\.nuget\\packages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
]
}
}
These paths are used when resolving nuget package dependencies by JSonTransform. As you can see, the first two can only work on a specific machine, since they are absolute path containing a "specific_username".
There is a way to use relative paths to .dotnet and .nuget folders, so that it can works on every pc?

Autodesk Viewer Markup extension - can't compile from sources

I'm trying to achieve similar viewer annotations like official demo:
lvm-react
I read official blog post and use files from Autodesk Extensions github:
http://adndevblog.typepad.com/cloud_and_mobile/2016/04/markup3d-sample-for-view-data-api.html
But I can't compile extensions from sources (create bundle.js). Tried just npm install, but there are many errors like:
ERROR in ./src/Viewing.Extension.VisualReport/PieChart/PieChart.js
Module not found: Error: Cannot resolve module 'EventsEmitter' in MY_FILES
and
ERROR in ./src/Viewing.Extension.StateManager/Viewing.Extension.StateManager.scss
Module parse failed: /MY_PATH/library-javascript-viewer-extensions-master/src/Viewing.Extension.StateManager/Viewing.Extension.StateManager.scss Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
I also installed webpack using npm, but without result, there are still many errors.
There was a few loaders missing from the webpack build production config. It is fixed now and you should be able to build all extensions. Please use the latest version from the repo.
When testing your extensions, I recommend you use npm run build-dev command, so the generated extensions files will not be minified and have source-map enabled, so you can easily debug them in browser console. When building for production, you can use npm run build-prod.
You can also remove the various entries from the webpack config to build only the extensions you are interested in, for example:
module.exports = {
devtool: 'eval-source-map',
entry: {
'Viewing.Extension.Markup3D':
'./src/Viewing.Extension.Markup3D/Viewing.Extension.Markup3D.js',
},
// ... rest of the config ...
You may also want to change the output path, in my config the output is outside of the extensions directory, directly in the project using them:
output: {
path: path.join(__dirname, '../../App/dynamic/extensions'),
filename: "[name]/[name].js",
libraryTarget: "umd",
library: "[name]",
watch: true
},
In addition to including the extension file to your project, you should also make sure that you include the babel polyfill (from node_modules/babel-polyfill/dist/polyfill.min.js) before any extension script.
Hope that helps, let me know if you have any further trouble using those extensions.

How to deploy PKI in Azure using JSON template (windows server)

I'm new to Azure.
I have JSON template that successfully deploys VM.
Can I add some code to JSON template to deploy this VM with rootCA. Or some syntax for AD CS deployment.
I googled a lot but there are only DSC methods.
You can't "add some code to JSON template".
Your options:
Native ARM via Keyvault:
https://github.com/Azure/azure-quickstart-templates/blob/875d139c16c9c023dce519e6dd48c707e3473346/201-vm-push-certificate-windows/azuredeploy.json
Add an extention to the ARM template.
An extention can be DSC as you mentioned, but can also be custom PowerShell for example. (see custom script extension)
Run your script after the deployment. If you run New-AzureRmResourceGroupDeployment form PowerShell, you can output the VM connection information, and manage it after. See how to configure WinRM on a created VM.

Why is this Sublime Text Grunt Build failing in Windows 7?

Why is this Sublime Text Grunt Build failing in Windows 7?
{
"cmd": ["grunt.cmd", "--no-color"],
"path": "C:\\Users\\USER\\AppData\\Roaming\\npm;C:\\Program/ Files\\nodejs",
"working_dir": "${project_path}"
}
Console says:
'node' is not recognized as an internal or external command, operable program or batch file.
[Finished in 0.1s with exit code 1]
Try the following first:
{
"cmd": ["grunt.cmd", "--no-color"],
"path": "C:/Users/USER/AppData/Roaming/npm;C:/Program\ Files/nodejs",
"working_dir": "${project_path}"
}
If that doesn't work, try removing the \ character between Program and Files. You don't need the "selector" argument at all, as that is used to specify the scope for the build system. ["Gruntfile.js"] is not a valid scope.
As an alternative option, check out the Grunt plugin available via Package Control. I haven't used it myself, but it looks quite useful. It parses your Gruntfile.(js|coffee) file and adds the available tasks to the Command Palette, among other things. It directly reads your PATH variable, so as long as your node and npm directories are there, it should work quite well.

Configuration path of Log4j2

I am trying to adopt Log4j2 to my project. Since my Java Application is packeted in a JAR file. I don't want "log4j2.xml" configuration packaged inside of JAR file. I am trying to learn how configuration file works from "http://logging.apache.org/log4j/2.x/manual/configuration.html"
But seems there is no clear instruction regarding altering the configuration file path of the Log4j2.
After googling about this topic I found something like "Referencing log4j config file within executable JAR" Referencing log4j config file within executable JAR, But this solution is not available any more according to "http://logging.apache.org/log4j/2.x/manual/migration.html" (if I understand it correctly).
So I am wondering if someone have any idea about this issue.
Thanks
You can set the system property to specify the configuration path.
set the
"-Dlog4j.configurationFile="D:\learning\blog\20130115\config\LogConfig.xml"
in VM arguments. replace
"D:\learning\blog\20130115\config\LogConfig.xml"
to your configuration path.
Put the log4j2.xml file in resource directory in your project so that the log4j will locate files under class path automatically.
Loading log4j2.xml file from the customized location-
You can use the System property/ VM arguments- Dlog4j.configurationFile=file:/path/to/file/log4j2.xml
This will work for any web application.
For some legacy applications, you can create a class for loading log4j2.xml/ log4j2.properties from the custom location on the machine like- D:/property/log4j2.xml
Using any of these approach,during application startup, the log4j2.xml file from the src/resources folder will be overridden by the custom location log4j.xml file.
Try using -Dlogging.config=Path_to_your_file