[Help wanted] How to FTP C++ executable?
daldr-ntml opened this issue · 10 comments
I have Build Task that builds a C++ executable. I want to copy that executable to a remote target using FTP. How would I do that using Deploy?
You can use "deploy on change" feature which can deploy things that are change, like generated executables.
Thanks for your answer.
I want to deploy file ../srcpath/outfile to /dstpath/outpath, where srcpath and destpath are different. So I tried:
"deploy": {
"button": {
"enabled": true,
"test": "Deploy myApp",
"packages": [ "myApp" ]
},
"packages": [
{
"name": "myApp",
"description": "Package version 2.3.4",
"files": [
"myApp.out"
],
"loadFrom": "../srcpath/",
],
"deployOnSave": true,
"targets": [
"myApp"
]
}
],
"targets": [
{
"type": "sftp",
"name": "myApp",
"description": "my target",
"dir": "destpath",
<snip>
}
]
}
Is that strategy (using loadFrom) the correct way to go?
I get error:
"Loading data from 'c:\SVNProj\myPath' failed: Error: EISDIR: illegal operation on a directory, read"
but the path shown in the error message is valid
Because you use a build task, you should use deploy on change instead.
The difference is that "deploy on save" is fired when you explicitly save the file in your editor, and "deploy on change" means that anything, like you or a background build task, changes a file.
Btw.: The loadFrom
is used in a wrong way here. You can define a path to a file with that setting, which JSON data should be merged with the package.
{
"deploy": {
"packages": [
{
"name": "myApp project",
"deployOnChange": {
"files": [ "myApp.out" ],
"useTargetList": true
},
"targets": [ "myApp" ]
}
],
"targets": [
{
"name": "myApp",
"type": "sftp"
}
]
}
}
Now the extension will deploy myApp.out
file to myApp
SFTP server, when it is changed by build task.
Thanks for your reply. So I now have:
"deploy": {
"packages": [
{
"name": "My project",
"deployOnChange": {
"files": [
"Source/LedaAP_workbench/LedaAP/NonDebug/LedaAP.out"
],
"useTargetList": true
},
"targets": [ "ledapc" ]
}
],
"targets": [
{
"type": "sftp",
"name": "ledapc",
"dir": "/home/mydir"
<snip>
}
]
}
but nothing is appearing in /home/mydir on the target after the project gets built. Can you see anything wrong?
Please note that I would like the destination to be:
/home/mydir/LedaAP.out
not
/home/mydir/Source/LedaAP_workbench/LedaAP/NonDebug/LedaAP.out
Sorry, the file I specified is being deployed successfully. However, my second question is still valid, that is:
I want the destination to be:
/home/mydir/LedaAP.out
not
/home/mydir/Source/LedaAP_workbench/LedaAP/NonDebug/LedaAP.out
Is it possible to configure that in Deploy's settings?
Yes, you can use folder mappings.
Thanks, folder mappings does what I need.
I am deploying one file:
"packages": [
{
"name": "My project",
"deployOnChange": {
"files": [
"Source/<snip>/LedaAP.out"
],
"useTargetList": true
},
"targets": [ "ledapc" ]
}
],
but get two deploy messages:
Deploying file 'c:/SVNProj/<snip>/LedaAP.out' to '/home/me' ('ledapc')...
Deploying file 'c:/SVNProj/<snip>/LedaAP.out' to '/home/me' ('ledapc')... [OK]
Finished
[OK]
Finished
Is that expected?
The build task is creating the LedaAP.out
in background and you do not save this file in your editor, right?
Maybe the build task changes / creates the file twice, what means that "file change event" is also fired twice.
Yes, it's built in the background. Thanks for your explanation.