summaryrefslogtreecommitdiffstats
path: root/afb-client/bower_components/foundation-apps/bin/gulp-dynamic-routing.js
blob: 3dc5350ef9a9ac3c361c770cf03f6c17433ece1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var through     = require('through2');
var gutil       = require('gulp-util');
var fm          = require('front-matter');
var PluginError = gutil.PluginError;
var path        = require('path');
var fs           = require('fs');

module.exports = function(options) {
  var configs = [];
  var directory = options.dir || process.cwd();

  function bufferContents(file, enc, cb) {
    var config;
    var content;

    if(file.isNull()) return cb(null, file);

    if(file.isBuffer()) {
      try {
        content = fm(String(file.contents));
      } catch (e) {
        return cb(new PluginError('Gulp Dynamic Routing', e));
      }

      if(content.attributes.name) {
        file.contents = new Buffer(content.body);
        config = content.attributes;
        var relativePath = path.relative(directory + path.sep + options.root, file.path);
        config.path = relativePath.split(path.sep).join('/');
        configs.push(config);
      }
    }

    this.push(file);

    return cb();
  }

  function endStream(cb) {
    var self = this;
    var appPath = options.path;

    configs.sort(function(a, b) {
      return a.url < b.url;
    });


    fs.writeFile(appPath, 'var foundationRoutes = ' + JSON.stringify(configs) + '; \n', function(err) {
      if(err) throw err;
      cb();
    });

  }

  return through.obj(bufferContents, endStream);
};
="na">./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - Select **Run** sub-category, and set: - Run Command: `target/start-on-root@renesas-gen3.sh` - Run Directory: `build-gen3` ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - Click on **OK** button to save settings By changing configuration from **Default** to **Gen3 board**, you can now simply compile your helloworld application natively (**Default** configuration) or cross-compile your application through XDS for the Renesas Gen3 board (**Gen3 board** configuration). ## Visual Studio Code Open your project in VS Code ```bash cd $MY_PROJECT_DIR code . & ``` Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task` command and you will see a list of task runner templates. And define your own tasks, here is an example to build [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) AGL helloworld application based on cmake template. ```json { "version": "2.0.0", "type": "shell", "presentation": { "reveal": "always" }, "tasks": [ { "label": "clean", "type": "shell", "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", "problemMatcher": [] }, { "label": "pre-build", "type": "shell", "group": "build", "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", "problemMatcher": [ "$gcc" ] }, { "label": "build", "type": "shell", "group": "build", "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", "problemMatcher": [ "$gcc" ] }, { "label": "populate", "type": "shell", "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", "problemMatcher": [] } ] } ``` To run a task : press `Ctrl+Shift+P`, select the `Tasks: Run task` and then select for example `pre-build` to trigger pre-build task. > **Note:** > > You can also add your own keybindings to trig above tasks, for example: > > ```json > // Build > { > "key": "alt+f9", > "command": "workbench.action.tasks.runTask", > "args": "clean" > }, > { > "key": "alt+f10", > "command": "workbench.action.tasks.runTask", > "args": "pre-build" > }, > { > "key": "alt+f11", > "command": "workbench.action.tasks.runTask", > "args": "build" > }, > { > "key": "alt+f12", > "command": "workbench.action.tasks.runTask", > "args": "populate" > }, > ``` > > More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) > > More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) ## Qt Creator Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. Thanks to Dennis for providing this useful example. ## Others IDE *Coming soon...*