forked from platformio/platformio-core
Initial support for Project Templates
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
[settings]
|
[settings]
|
||||||
line_length=79
|
line_length=79
|
||||||
known_third_party=arrow,bottle,click,lockfile,pytest,requests,SCons,semantic_version,serial
|
known_third_party=arrow,bottle,click,configobj,lockfile,pytest,requests,SCons,semantic_version,serial
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (3, 5, "0a8")
|
VERSION = (3, 5, "0a9")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -12,22 +12,16 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-locals, too-many-branches
|
from os import getcwd
|
||||||
|
|
||||||
from os import getcwd, makedirs
|
|
||||||
from os.path import isdir, isfile, join
|
|
||||||
from shutil import copyfile
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import exception
|
||||||
from platformio.commands.platform import \
|
|
||||||
platform_install as cli_platform_install
|
|
||||||
from platformio.ide.projectgenerator import ProjectGenerator
|
|
||||||
from platformio.managers.platform import PlatformManager
|
from platformio.managers.platform import PlatformManager
|
||||||
|
from platformio.project.generator import ProjectGenerator
|
||||||
|
|
||||||
|
|
||||||
def validate_boards(ctx, param, value): # pylint: disable=W0613
|
def validate_boards(ctx, param, value): # pylint: disable=unused-argument
|
||||||
pm = PlatformManager()
|
pm = PlatformManager()
|
||||||
for id_ in value:
|
for id_ in value:
|
||||||
try:
|
try:
|
||||||
@ -53,21 +47,27 @@ def validate_boards(ctx, param, value): # pylint: disable=W0613
|
|||||||
resolve_path=True))
|
resolve_path=True))
|
||||||
@click.option(
|
@click.option(
|
||||||
"-b", "--board", multiple=True, metavar="ID", callback=validate_boards)
|
"-b", "--board", multiple=True, metavar="ID", callback=validate_boards)
|
||||||
|
@click.option("-p", "--platform")
|
||||||
|
@click.option("-f", "--framework")
|
||||||
|
@click.option("--ide", type=click.Choice(ProjectGenerator.get_supported_ide()))
|
||||||
|
@click.option("--vcs", type=click.Choice(ProjectGenerator.get_supported_vcs()))
|
||||||
|
@click.option("--ci", type=click.Choice(ProjectGenerator.get_supported_ci()))
|
||||||
@click.option(
|
@click.option(
|
||||||
"--ide", type=click.Choice(ProjectGenerator.get_supported_ides()))
|
"-L", "--list-templates", help="List available source code templates")
|
||||||
@click.option("-O", "--project-option", multiple=True)
|
@click.option("-t", "--template")
|
||||||
|
@click.option("-T", "--template-var", multiple=True)
|
||||||
@click.option("--env-prefix", default="")
|
@click.option("--env-prefix", default="")
|
||||||
|
@click.option("-E", "--env-option", multiple=True)
|
||||||
|
@click.option(
|
||||||
|
"-O",
|
||||||
|
"--project-option",
|
||||||
|
multiple=True,
|
||||||
|
help="Deprecated. Use `--env-option` instead")
|
||||||
@click.option("-s", "--silent", is_flag=True)
|
@click.option("-s", "--silent", is_flag=True)
|
||||||
@click.pass_context
|
def cli( # pylint: disable=too-many-arguments,too-many-locals
|
||||||
def cli(
|
project_dir, board, platform, framework, ide, vcs, ci, list_templates,
|
||||||
ctx, # pylint: disable=R0913
|
template, template_var, env_prefix, env_option, project_option,
|
||||||
project_dir,
|
|
||||||
board,
|
|
||||||
ide,
|
|
||||||
project_option,
|
|
||||||
env_prefix,
|
|
||||||
silent):
|
silent):
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
if project_dir == getcwd():
|
if project_dir == getcwd():
|
||||||
click.secho(
|
click.secho(
|
||||||
@ -89,18 +89,37 @@ def cli(
|
|||||||
click.echo("%s - Put here project specific (private) libraries" %
|
click.echo("%s - Put here project specific (private) libraries" %
|
||||||
click.style("lib", fg="cyan"))
|
click.style("lib", fg="cyan"))
|
||||||
|
|
||||||
init_base_project(project_dir)
|
pg = ProjectGenerator(
|
||||||
|
project_dir,
|
||||||
if board:
|
dict(
|
||||||
fill_project_envs(ctx, project_dir, board, project_option, env_prefix,
|
boards=list(board),
|
||||||
ide is not None)
|
platform=platform,
|
||||||
|
framework=framework,
|
||||||
|
ide=ide,
|
||||||
|
template=template,
|
||||||
|
template_vars=list(template_var),
|
||||||
|
env_prefix=env_prefix,
|
||||||
|
env_options=list(env_option) + list(project_option),
|
||||||
|
vcs=vcs,
|
||||||
|
ci=ci))
|
||||||
|
|
||||||
if ide:
|
if ide:
|
||||||
env_name = get_best_envname(project_dir, board)
|
# install development platform before (show progress)
|
||||||
if not env_name:
|
pm = PlatformManager()
|
||||||
raise exception.BoardNotDefined()
|
for name in pg.project_config.get_env_names():
|
||||||
pg = ProjectGenerator(project_dir, ide, env_name)
|
platform = pg.project_config.env_get(name, "platform")
|
||||||
pg.generate()
|
framework = pg.project_config.env_get(name, "framework")
|
||||||
|
if not platform:
|
||||||
|
continue
|
||||||
|
if framework:
|
||||||
|
pm.install(
|
||||||
|
platform,
|
||||||
|
with_packages=["framework-%s" % framework],
|
||||||
|
silent=True)
|
||||||
|
else:
|
||||||
|
pm.install(platform, silent=True)
|
||||||
|
|
||||||
|
pg.generate()
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
click.secho(
|
click.secho(
|
||||||
@ -113,239 +132,3 @@ def cli(
|
|||||||
"files)\n"
|
"files)\n"
|
||||||
"`platformio run --help` - additional information",
|
"`platformio run --help` - additional information",
|
||||||
fg="green")
|
fg="green")
|
||||||
|
|
||||||
|
|
||||||
def get_best_envname(project_dir, boards=None):
|
|
||||||
config = util.load_project_config(project_dir)
|
|
||||||
env_default = None
|
|
||||||
if config.has_option("platformio", "env_default"):
|
|
||||||
env_default = config.get("platformio",
|
|
||||||
"env_default").split(", ")[0].strip()
|
|
||||||
if env_default:
|
|
||||||
return env_default
|
|
||||||
section = None
|
|
||||||
for section in config.sections():
|
|
||||||
if not section.startswith("env:"):
|
|
||||||
continue
|
|
||||||
elif config.has_option(section, "board") and (not boards or config.get(
|
|
||||||
section, "board") in boards):
|
|
||||||
break
|
|
||||||
return section[4:] if section else None
|
|
||||||
|
|
||||||
|
|
||||||
def init_base_project(project_dir):
|
|
||||||
if not util.is_platformio_project(project_dir):
|
|
||||||
copyfile(
|
|
||||||
join(util.get_source_dir(), "projectconftpl.ini"),
|
|
||||||
join(project_dir, "platformio.ini"))
|
|
||||||
|
|
||||||
lib_dir = join(project_dir, "lib")
|
|
||||||
src_dir = join(project_dir, "src")
|
|
||||||
config = util.load_project_config(project_dir)
|
|
||||||
if config.has_option("platformio", "src_dir"):
|
|
||||||
src_dir = join(project_dir, config.get("platformio", "src_dir"))
|
|
||||||
|
|
||||||
for d in (src_dir, lib_dir):
|
|
||||||
if not isdir(d):
|
|
||||||
makedirs(d)
|
|
||||||
|
|
||||||
init_lib_readme(lib_dir)
|
|
||||||
init_ci_conf(project_dir)
|
|
||||||
init_cvs_ignore(project_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def init_lib_readme(lib_dir):
|
|
||||||
if isfile(join(lib_dir, "readme.txt")):
|
|
||||||
return
|
|
||||||
with open(join(lib_dir, "readme.txt"), "w") as f:
|
|
||||||
f.write("""
|
|
||||||
This directory is intended for the project specific (private) libraries.
|
|
||||||
PlatformIO will compile them to static libraries and link to executable file.
|
|
||||||
|
|
||||||
The source code of each library should be placed in separate directory, like
|
|
||||||
"lib/private_lib/[here are source files]".
|
|
||||||
|
|
||||||
For example, see how can be organized `Foo` and `Bar` libraries:
|
|
||||||
|
|
||||||
|--lib
|
|
||||||
| |--Bar
|
|
||||||
| | |--docs
|
|
||||||
| | |--examples
|
|
||||||
| | |--src
|
|
||||||
| | |- Bar.c
|
|
||||||
| | |- Bar.h
|
|
||||||
| |--Foo
|
|
||||||
| | |- Foo.c
|
|
||||||
| | |- Foo.h
|
|
||||||
| |- readme.txt --> THIS FILE
|
|
||||||
|- platformio.ini
|
|
||||||
|--src
|
|
||||||
|- main.c
|
|
||||||
|
|
||||||
Then in `src/main.c` you should use:
|
|
||||||
|
|
||||||
#include <Foo.h>
|
|
||||||
#include <Bar.h>
|
|
||||||
|
|
||||||
// rest H/C/CPP code
|
|
||||||
|
|
||||||
PlatformIO will find your libraries automatically, configure preprocessor's
|
|
||||||
include paths and build them.
|
|
||||||
|
|
||||||
More information about PlatformIO Library Dependency Finder
|
|
||||||
- http://docs.platformio.org/page/librarymanager/ldf.html
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
def init_ci_conf(project_dir):
|
|
||||||
if isfile(join(project_dir, ".travis.yml")):
|
|
||||||
return
|
|
||||||
with open(join(project_dir, ".travis.yml"), "w") as f:
|
|
||||||
f.write("""# Continuous Integration (CI) is the practice, in software
|
|
||||||
# engineering, of merging all developer working copies with a shared mainline
|
|
||||||
# several times a day < http://docs.platformio.org/page/ci/index.html >
|
|
||||||
#
|
|
||||||
# Documentation:
|
|
||||||
#
|
|
||||||
# * Travis CI Embedded Builds with PlatformIO
|
|
||||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
|
||||||
#
|
|
||||||
# * PlatformIO integration with Travis CI
|
|
||||||
# < http://docs.platformio.org/page/ci/travis.html >
|
|
||||||
#
|
|
||||||
# * User Guide for `platformio ci` command
|
|
||||||
# < http://docs.platformio.org/page/userguide/cmd_ci.html >
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Please choice one of the following templates (proposed below) and uncomment
|
|
||||||
# it (remove "# " before each line) or use own configuration according to the
|
|
||||||
# Travis CI documentation (see above).
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio run
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Template #2: The project is intended to by used as a library with examples
|
|
||||||
#
|
|
||||||
|
|
||||||
# language: python
|
|
||||||
# python:
|
|
||||||
# - "2.7"
|
|
||||||
#
|
|
||||||
# sudo: false
|
|
||||||
# cache:
|
|
||||||
# directories:
|
|
||||||
# - "~/.platformio"
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
|
||||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
|
||||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
|
||||||
#
|
|
||||||
# install:
|
|
||||||
# - pip install -U platformio
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
def init_cvs_ignore(project_dir):
|
|
||||||
ignore_path = join(project_dir, ".gitignore")
|
|
||||||
default = [".pioenvs\n", ".piolibdeps\n"]
|
|
||||||
current = []
|
|
||||||
modified = False
|
|
||||||
if isfile(ignore_path):
|
|
||||||
with open(ignore_path) as fp:
|
|
||||||
current = fp.readlines()
|
|
||||||
if current and not current[-1].endswith("\n"):
|
|
||||||
current[-1] += "\n"
|
|
||||||
for d in default:
|
|
||||||
if d not in current:
|
|
||||||
modified = True
|
|
||||||
current.append(d)
|
|
||||||
if not modified:
|
|
||||||
return
|
|
||||||
with open(ignore_path, "w") as fp:
|
|
||||||
fp.writelines(current)
|
|
||||||
|
|
||||||
|
|
||||||
def fill_project_envs(ctx, project_dir, board_ids, project_option, env_prefix,
|
|
||||||
force_download):
|
|
||||||
content = []
|
|
||||||
used_boards = []
|
|
||||||
used_platforms = []
|
|
||||||
|
|
||||||
config = util.load_project_config(project_dir)
|
|
||||||
for section in config.sections():
|
|
||||||
cond = [
|
|
||||||
section.startswith("env:"),
|
|
||||||
config.has_option(section, "board")
|
|
||||||
]
|
|
||||||
if all(cond):
|
|
||||||
used_boards.append(config.get(section, "board"))
|
|
||||||
|
|
||||||
pm = PlatformManager()
|
|
||||||
for id_ in board_ids:
|
|
||||||
board_config = pm.board_config(id_)
|
|
||||||
used_platforms.append(board_config['platform'])
|
|
||||||
if id_ in used_boards:
|
|
||||||
continue
|
|
||||||
used_boards.append(id_)
|
|
||||||
|
|
||||||
envopts = {"platform": board_config['platform'], "board": id_}
|
|
||||||
# find default framework for board
|
|
||||||
frameworks = board_config.get("frameworks")
|
|
||||||
if frameworks:
|
|
||||||
envopts['framework'] = frameworks[0]
|
|
||||||
|
|
||||||
for item in project_option:
|
|
||||||
if "=" not in item:
|
|
||||||
continue
|
|
||||||
_name, _value = item.split("=", 1)
|
|
||||||
envopts[_name.strip()] = _value.strip()
|
|
||||||
|
|
||||||
content.append("")
|
|
||||||
content.append("[env:%s%s]" % (env_prefix, id_))
|
|
||||||
for name, value in envopts.items():
|
|
||||||
content.append("%s = %s" % (name, value))
|
|
||||||
|
|
||||||
if force_download and used_platforms:
|
|
||||||
_install_dependent_platforms(ctx, used_platforms)
|
|
||||||
|
|
||||||
if not content:
|
|
||||||
return
|
|
||||||
|
|
||||||
with open(join(project_dir, "platformio.ini"), "a") as f:
|
|
||||||
content.append("")
|
|
||||||
f.write("\n".join(content))
|
|
||||||
|
|
||||||
|
|
||||||
def _install_dependent_platforms(ctx, platforms):
|
|
||||||
installed_platforms = [
|
|
||||||
p['name'] for p in PlatformManager().get_installed()
|
|
||||||
]
|
|
||||||
if set(platforms) <= set(installed_platforms):
|
|
||||||
return
|
|
||||||
ctx.invoke(
|
|
||||||
cli_platform_install,
|
|
||||||
platforms=list(set(platforms) - set(installed_platforms)))
|
|
||||||
|
@ -127,6 +127,28 @@ class NotPlatformIOProject(PlatformioException):
|
|||||||
"please use `platformio init` command"
|
"please use `platformio init` command"
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownProjectTemplate(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = "Unknown Project Template '{0}'"
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownProjectTplVar(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = "Unknown Project Template Variable '{0}'"
|
||||||
|
|
||||||
|
|
||||||
|
class IncompatbileProjectTemplate(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = "Project Template '{0}' is not compatible with {1} '{2}'. "\
|
||||||
|
"Valid candidates: {3}"
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidProjectTplVar(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = "Project Template Variable: invalid value `{0}` for '{1}' "\
|
||||||
|
"(type={2}, options={3})"
|
||||||
|
|
||||||
|
|
||||||
class UndefinedEnvPlatform(PlatformioException):
|
class UndefinedEnvPlatform(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "Please specify platform for '{0}' environment"
|
MESSAGE = "Please specify platform for '{0}' environment"
|
||||||
|
@ -1,177 +0,0 @@
|
|||||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from cStringIO import StringIO
|
|
||||||
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
|
|
||||||
|
|
||||||
import bottle
|
|
||||||
import click
|
|
||||||
|
|
||||||
from platformio import exception, util
|
|
||||||
from platformio.commands.run import cli as cmd_run
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectGenerator(object):
|
|
||||||
|
|
||||||
def __init__(self, project_dir, ide, env_name):
|
|
||||||
self.project_dir = project_dir
|
|
||||||
self.ide = ide
|
|
||||||
self.env_name = env_name
|
|
||||||
self._tplvars = {}
|
|
||||||
|
|
||||||
with util.cd(self.project_dir):
|
|
||||||
self.project_src_dir = util.get_projectsrc_dir()
|
|
||||||
|
|
||||||
self._gather_tplvars()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_supported_ides():
|
|
||||||
tpls_dir = join(util.get_source_dir(), "ide", "tpls")
|
|
||||||
return sorted(
|
|
||||||
[d for d in os.listdir(tpls_dir) if isdir(join(tpls_dir, d))])
|
|
||||||
|
|
||||||
@util.memoized
|
|
||||||
def get_project_env(self):
|
|
||||||
data = {}
|
|
||||||
config = util.load_project_config(self.project_dir)
|
|
||||||
for section in config.sections():
|
|
||||||
if not section.startswith("env:"):
|
|
||||||
continue
|
|
||||||
if self.env_name != section[4:]:
|
|
||||||
continue
|
|
||||||
data = {"env_name": section[4:]}
|
|
||||||
for k, v in config.items(section):
|
|
||||||
data[k] = v
|
|
||||||
return data
|
|
||||||
|
|
||||||
@util.memoized
|
|
||||||
def get_project_build_data(self):
|
|
||||||
data = {"defines": [], "includes": [], "cxx_path": None}
|
|
||||||
envdata = self.get_project_env()
|
|
||||||
if not envdata:
|
|
||||||
return data
|
|
||||||
|
|
||||||
out = StringIO()
|
|
||||||
with util.capture_stdout(out):
|
|
||||||
click.get_current_context().invoke(
|
|
||||||
cmd_run,
|
|
||||||
project_dir=self.project_dir,
|
|
||||||
environment=[envdata['env_name']],
|
|
||||||
target=["idedata"])
|
|
||||||
result = out.getvalue()
|
|
||||||
|
|
||||||
if '"includes":' not in result:
|
|
||||||
raise exception.PlatformioException(result)
|
|
||||||
|
|
||||||
for line in result.split("\n"):
|
|
||||||
line = line.strip()
|
|
||||||
if line.startswith('{"') and line.endswith("}"):
|
|
||||||
data = json.loads(line)
|
|
||||||
return data
|
|
||||||
|
|
||||||
def get_project_name(self):
|
|
||||||
return basename(self.project_dir)
|
|
||||||
|
|
||||||
def get_src_files(self):
|
|
||||||
result = []
|
|
||||||
with util.cd(self.project_dir):
|
|
||||||
for root, _, files in os.walk(self.project_src_dir):
|
|
||||||
for f in files:
|
|
||||||
result.append(relpath(join(root, f)))
|
|
||||||
return result
|
|
||||||
|
|
||||||
def get_tpls(self):
|
|
||||||
tpls = []
|
|
||||||
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
|
|
||||||
for root, _, files in os.walk(tpls_dir):
|
|
||||||
for f in files:
|
|
||||||
if not f.endswith(".tpl"):
|
|
||||||
continue
|
|
||||||
_relpath = root.replace(tpls_dir, "")
|
|
||||||
if _relpath.startswith(os.sep):
|
|
||||||
_relpath = _relpath[1:]
|
|
||||||
tpls.append((_relpath, join(root, f)))
|
|
||||||
return tpls
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
for tpl_relpath, tpl_path in self.get_tpls():
|
|
||||||
dst_dir = self.project_dir
|
|
||||||
if tpl_relpath:
|
|
||||||
dst_dir = join(self.project_dir, tpl_relpath)
|
|
||||||
if not isdir(dst_dir):
|
|
||||||
os.makedirs(dst_dir)
|
|
||||||
|
|
||||||
file_name = basename(tpl_path)[:-4]
|
|
||||||
self._merge_contents(
|
|
||||||
join(dst_dir, file_name),
|
|
||||||
self._render_tpl(tpl_path).encode("utf8"))
|
|
||||||
|
|
||||||
def _render_tpl(self, tpl_path):
|
|
||||||
content = ""
|
|
||||||
with open(tpl_path) as f:
|
|
||||||
content = f.read()
|
|
||||||
return bottle.template(content, **self._tplvars)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _merge_contents(dst_path, contents):
|
|
||||||
file_name = basename(dst_path)
|
|
||||||
|
|
||||||
# merge .gitignore
|
|
||||||
if file_name == ".gitignore" and isfile(dst_path):
|
|
||||||
modified = False
|
|
||||||
default = [l.strip() for l in contents.split("\n")]
|
|
||||||
with open(dst_path) as fp:
|
|
||||||
current = [l.strip() for l in fp.readlines()]
|
|
||||||
for d in default:
|
|
||||||
if d and d not in current:
|
|
||||||
modified = True
|
|
||||||
current.append(d)
|
|
||||||
if not modified:
|
|
||||||
return
|
|
||||||
contents = "\n".join(current) + "\n"
|
|
||||||
|
|
||||||
with open(dst_path, "w") as f:
|
|
||||||
f.write(contents)
|
|
||||||
|
|
||||||
def _gather_tplvars(self):
|
|
||||||
self._tplvars.update(self.get_project_env())
|
|
||||||
self._tplvars.update(self.get_project_build_data())
|
|
||||||
self._tplvars.update({
|
|
||||||
"project_name":
|
|
||||||
self.get_project_name(),
|
|
||||||
"src_files":
|
|
||||||
self.get_src_files(),
|
|
||||||
"user_home_dir":
|
|
||||||
abspath(expanduser("~")),
|
|
||||||
"project_dir":
|
|
||||||
self.project_dir,
|
|
||||||
"project_src_dir":
|
|
||||||
self.project_src_dir,
|
|
||||||
"systype":
|
|
||||||
util.get_systype(),
|
|
||||||
"platformio_path":
|
|
||||||
self._fix_os_path(util.where_is_program("platformio")),
|
|
||||||
"env_pathsep":
|
|
||||||
os.pathsep,
|
|
||||||
"env_path":
|
|
||||||
self._fix_os_path(os.getenv("PATH"))
|
|
||||||
})
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _fix_os_path(path):
|
|
||||||
return (re.sub(r"[\\]+", '\\' * 4, path)
|
|
||||||
if "windows" in util.get_systype() else path)
|
|
@ -1,6 +0,0 @@
|
|||||||
% for include in includes:
|
|
||||||
-I{{include}}
|
|
||||||
% end
|
|
||||||
% for define in defines:
|
|
||||||
-D{{!define}}
|
|
||||||
% end
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"execPath": "{{ cxx_path.replace("\\", "/") }}",
|
|
||||||
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
|
|
||||||
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
|
|
||||||
"gccErrorLimit": 15,
|
|
||||||
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
|
|
||||||
"gccSuppressWarnings": false
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
.piolibdeps
|
|
||||||
.clang_complete
|
|
||||||
.gcc-flags.json
|
|
@ -1,3 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
.piolibdeps
|
|
||||||
CMakeListsPrivate.txt
|
|
8
platformio/ide/tpls/clion/.idea/clion.iml.tpl
generated
8
platformio/ide/tpls/clion/.idea/clion.iml.tpl
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="CPP_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
9
platformio/ide/tpls/clion/.idea/modules.xml.tpl
generated
9
platformio/ide/tpls/clion/.idea/modules.xml.tpl
generated
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/clion.iml" filepath="$PROJECT_DIR$/.idea/clion.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/platformio.iml" filepath="$PROJECT_DIR$/.idea/platformio.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="CPP_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
30
platformio/ide/tpls/clion/.idea/watcherTasks.xml.tpl
generated
30
platformio/ide/tpls/clion/.idea/watcherTasks.xml.tpl
generated
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectTasksOptions">
|
|
||||||
<TaskOptions isEnabled="true">
|
|
||||||
<option name="arguments" value="-f -c clion init --ide clion" />
|
|
||||||
<option name="checkSyntaxErrors" value="true" />
|
|
||||||
<option name="description" />
|
|
||||||
<option name="exitCodeBehavior" value="NEVER" />
|
|
||||||
<option name="fileExtension" value="ini" />
|
|
||||||
<option name="immediateSync" value="false" />
|
|
||||||
<option name="name" value="Monitor platformio.ini" />
|
|
||||||
<option name="output" value="" />
|
|
||||||
<option name="outputFilters">
|
|
||||||
<array>
|
|
||||||
<FilterInfo>
|
|
||||||
<option name="description" value="" />
|
|
||||||
<option name="name" value="PIO Conf" />
|
|
||||||
<option name="regExp" value="$FILE_PATH$:^platofrmio" />
|
|
||||||
</FilterInfo>
|
|
||||||
</array>
|
|
||||||
</option>
|
|
||||||
<option name="outputFromStdout" value="false" />
|
|
||||||
<option name="program" value="{{platformio_path}}" />
|
|
||||||
<option name="scopeName" value="Project Files" />
|
|
||||||
<option name="trackOnlyRoot" value="false" />
|
|
||||||
<option name="workingDir" value="$PROJECT_DIR$" />
|
|
||||||
<envs />
|
|
||||||
</TaskOptions>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
266
platformio/ide/tpls/clion/.idea/workspace.xml.tpl
generated
266
platformio/ide/tpls/clion/.idea/workspace.xml.tpl
generated
@ -1,266 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
|
|
||||||
<generated>
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO" />
|
|
||||||
<config projectName="{{project_name}}" targetName="{{project_name}}" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_BUILD" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOAD" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_CLEAN" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_TEST" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_PROGRAM" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOADFS" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPDATE_ALL" />
|
|
||||||
<config projectName="{{project_name}}" targetName="PLATFORMIO_REBUILD_PROJECT_INDEX" />
|
|
||||||
<config projectName="{{project_name}}" targetName="DEBUG" />
|
|
||||||
</generated>
|
|
||||||
</component>
|
|
||||||
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
|
|
||||||
<ADDITIONAL_GENERATION_ENVIRONMENT>
|
|
||||||
<envs />
|
|
||||||
</ADDITIONAL_GENERATION_ENVIRONMENT>
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
|
|
||||||
<ignored path="platformio.iws" />
|
|
||||||
<ignored path=".idea/workspace.xml" />
|
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
||||||
<option name="TRACKING_ENABLED" value="true" />
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
||||||
<component name="CreatePatchCommitExecutor">
|
|
||||||
<option name="PATCH_PATH" value="" />
|
|
||||||
</component>
|
|
||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
|
||||||
<component name="FavoritesManager">
|
|
||||||
<favorites_list name="{{project_name}}" />
|
|
||||||
</component>
|
|
||||||
<component name="FileEditorManager">
|
|
||||||
<leaf>
|
|
||||||
<file leaf-file-name="platformio.ini" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/platformio.ini"></entry>
|
|
||||||
</file>
|
|
||||||
% for file in src_files:
|
|
||||||
<file leaf-file-name="file://$PROJECT_DIR$/{{file}}" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR/${{file}}"></entry>
|
|
||||||
</file>
|
|
||||||
% end
|
|
||||||
</leaf>
|
|
||||||
</component>
|
|
||||||
<component name="JsBuildToolGruntFileManager" detection-done="true" />
|
|
||||||
<component name="JsGulpfileManager">
|
|
||||||
<detection-done>true</detection-done>
|
|
||||||
</component>
|
|
||||||
<component name="NamedScopeManager">
|
|
||||||
<order />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectFrameBounds">
|
|
||||||
<option name="x" value="252" />
|
|
||||||
<option name="y" value="21" />
|
|
||||||
<option name="width" value="1400" />
|
|
||||||
<option name="height" value="1000" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>C/C++</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
||||||
<OptionsSetting value="true" id="Add" />
|
|
||||||
<OptionsSetting value="true" id="Remove" />
|
|
||||||
<OptionsSetting value="true" id="Checkout" />
|
|
||||||
<OptionsSetting value="true" id="Update" />
|
|
||||||
<OptionsSetting value="true" id="Status" />
|
|
||||||
<OptionsSetting value="true" id="Edit" />
|
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectView">
|
|
||||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
|
||||||
<flattenPackages />
|
|
||||||
<showMembers />
|
|
||||||
<showModules />
|
|
||||||
<showLibraryContents />
|
|
||||||
<hideEmptyPackages />
|
|
||||||
<abbreviatePackageNames />
|
|
||||||
<autoscrollToSource />
|
|
||||||
<autoscrollFromSource />
|
|
||||||
<sortByType />
|
|
||||||
<manualOrder />
|
|
||||||
<foldersAlwaysOnTop value="true" />
|
|
||||||
</navigator>
|
|
||||||
<panes>
|
|
||||||
<pane id="ProjectPane">
|
|
||||||
<subPane>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="{{project_name}}" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="{{project_name}}" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="{{project_name}}" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="{{project_name}}" />
|
|
||||||
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="{{project_name}}" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="src" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
</subPane>
|
|
||||||
</pane>
|
|
||||||
</panes>
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">
|
|
||||||
<property name="recentsLimit" value="5" />
|
|
||||||
<property name="settings.editor.selected.configurable" value="CPPToolchains" />
|
|
||||||
<property name="settings.editor.splitter.proportion" value="0.2" />
|
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/platformio.ini" />
|
|
||||||
<property name="restartRequiresConfirmation" value="true" />
|
|
||||||
<property name="FullScreen" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="RunManager" selected="Application.PLATFORMIO_BUILD">
|
|
||||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="{{project_name}}" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
|
||||||
<node-options />
|
|
||||||
<gulpfile />
|
|
||||||
<tasks />
|
|
||||||
<arguments />
|
|
||||||
<pass-parent-envs>true</pass-parent-envs>
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="Build All" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_TEST" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_TEST" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPLOADFS" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPLOADFS" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_PROGRAM" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_PROGRAM" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_UPDATE" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPDATE_ALL" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="PLATFORMIO_REBUILD_PROJECT_INDEX" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_REBUILD_PROJECT_INDEX" CONFIG_NAME="Debug">
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<list size="9">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="Application.Build All" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" />
|
|
||||||
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" />
|
|
||||||
<item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
|
|
||||||
<item index="4" class="java.lang.String" itemvalue="Application.PLATFORMIO_TEST" />
|
|
||||||
<item index="5" class="java.lang.String" itemvalue="Application.PLATFORMIO_PROGRAM" />
|
|
||||||
<item index="6" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOADFS" />
|
|
||||||
<item index="7" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPDATE" />
|
|
||||||
<item index="8" class="java.lang.String" itemvalue="Application.PLATFORMIO_REBUILD_PROJECT_INDEX" />
|
|
||||||
</list>
|
|
||||||
</component>
|
|
||||||
<component name="ShelveChangesManager" show_recycled="false" />
|
|
||||||
<component name="SvnConfiguration">
|
|
||||||
<configuration />
|
|
||||||
</component>
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
|
|
||||||
<created>1435919971910</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<updated>1435919971910</updated>
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="ToolWindowManager">
|
|
||||||
<frame x="181" y="23" width="1400" height="1000" extended-state="0" />
|
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
|
||||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24945612" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
||||||
</layout>
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.UiProperties">
|
|
||||||
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="VcsContentAnnotationSettings">
|
|
||||||
<option name="myLimit" value="2678400000" />
|
|
||||||
</component>
|
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager>
|
|
||||||
<option name="time" value="4" />
|
|
||||||
</breakpoint-manager>
|
|
||||||
<watches-manager />
|
|
||||||
</component>
|
|
||||||
<component name="masterDetails">
|
|
||||||
<states>
|
|
||||||
<state key="ScopeChooserConfigurable.UI">
|
|
||||||
<settings>
|
|
||||||
<splitter-proportions>
|
|
||||||
<option name="proportions">
|
|
||||||
<list>
|
|
||||||
<option value="0.2" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</splitter-proportions>
|
|
||||||
</settings>
|
|
||||||
</state>
|
|
||||||
</states>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,54 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project({{project_name}})
|
|
||||||
|
|
||||||
include(CMakeListsPrivate.txt)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_BUILD ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPLOAD ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_CLEAN ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_TEST ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion test
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_PROGRAM ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPLOADFS ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_UPDATE_ALL ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
PLATFORMIO_REBUILD_PROJECT_INDEX ALL
|
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion init --ide clion
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SRC_LIST})
|
|
@ -1,26 +0,0 @@
|
|||||||
set(ENV{PATH} "{{env_path}}")
|
|
||||||
set(PLATFORMIO_CMD "{{platformio_path}}")
|
|
||||||
|
|
||||||
SET(CMAKE_C_COMPILER "{{cc_path.replace("\\", "/")}}")
|
|
||||||
SET(CMAKE_CXX_COMPILER "{{cxx_path.replace("\\", "/")}}")
|
|
||||||
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}")
|
|
||||||
SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}")
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
|
|
||||||
% for define in defines:
|
|
||||||
add_definitions(-D{{!define}})
|
|
||||||
% end
|
|
||||||
|
|
||||||
% for include in includes:
|
|
||||||
% if include.startswith(user_home_dir):
|
|
||||||
% if "windows" in systype:
|
|
||||||
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
|
||||||
% else:
|
|
||||||
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
|
||||||
% end
|
|
||||||
% else:
|
|
||||||
include_directories("{{include.replace("\\", "/")}}")
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
|
|
||||||
FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*")
|
|
@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_project_file>
|
|
||||||
<FileVersion major="1" minor="6" />
|
|
||||||
<Project>
|
|
||||||
<Option title="{{project_name}}" />
|
|
||||||
<Option makefile_is_custom="1" />
|
|
||||||
<Option pch_mode="2" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<MakeCommands>
|
|
||||||
<Build command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<CompileFile command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<Clean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<DistClean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<AskRebuildNeeded command="1" />
|
|
||||||
<SilentBuild command="{{platformio_path}} -f -c codeblocks run > $(CMD_NULL)" />
|
|
||||||
</MakeCommands>
|
|
||||||
<Build>
|
|
||||||
<Target title="Debug">
|
|
||||||
<Option type="4" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Option parameters="-f -c codeblocks run -t upload" />
|
|
||||||
<Option host_application="{{platformio_path}}" />
|
|
||||||
<Option run_host_application_in_terminal="1" />
|
|
||||||
<Option use_console_runner="0" />
|
|
||||||
<MakeCommands>
|
|
||||||
<Build command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<CompileFile command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<Clean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<DistClean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<AskRebuildNeeded command="1" />
|
|
||||||
<SilentBuild command="{{platformio_path}} -f -c codeblocks run > $(CMD_NULL)" />
|
|
||||||
</MakeCommands>
|
|
||||||
</Target>
|
|
||||||
<Target title="Release">
|
|
||||||
<Option type="4" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Option parameters="-f -c codeblocks run -t upload" />
|
|
||||||
<Option host_application="{{platformio_path}}" />
|
|
||||||
<Option run_host_application_in_terminal="1" />
|
|
||||||
<Option use_console_runner="0" />
|
|
||||||
<MakeCommands>
|
|
||||||
<Build command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<CompileFile command="{{platformio_path}} -f -c codeblocks run" />
|
|
||||||
<Clean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<DistClean command="{{platformio_path}} -f -c codeblocks run -t clean" />
|
|
||||||
<AskRebuildNeeded command="1" />
|
|
||||||
<SilentBuild command="{{platformio_path}} -f -c codeblocks run > $(CMD_NULL)" />
|
|
||||||
</MakeCommands>
|
|
||||||
</Target>
|
|
||||||
</Build>
|
|
||||||
<Compiler>
|
|
||||||
% for define in defines:
|
|
||||||
<Add option="-D{{define}}"/>
|
|
||||||
% end
|
|
||||||
% for include in includes:
|
|
||||||
<Add directory="{{include.replace("\\", "/")}}"/>
|
|
||||||
% end
|
|
||||||
</Compiler>
|
|
||||||
<Unit filename="platformio.ini" />
|
|
||||||
% for file in src_files:
|
|
||||||
<Unit filename="{{file.replace("\\", "/")}}"></Unit>
|
|
||||||
% end
|
|
||||||
</Project>
|
|
||||||
</CodeBlocks_project_file>
|
|
@ -1,187 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
|
||||||
<cconfiguration id="0.910961921">
|
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.910961921" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
|
||||||
<externalSettings/>
|
|
||||||
<extensions>
|
|
||||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
|
||||||
</extensions>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
|
||||||
<configuration artifactName="{{project_name}}" buildProperties="" description="" id="0.910961921" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
|
||||||
<folderInfo id="0.910961921." name="/" resourcePath="">
|
|
||||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.952979152" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
|
||||||
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.952979152.52310970" name=""/>
|
|
||||||
<builder arguments="-f -c eclipse" cleanBuildTarget="run --target clean" command="platformio" id="org.eclipse.cdt.build.core.settings.default.builder.1519453406" incrementalBuildTarget="run" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1409095472" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
|
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1624502120" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
|
||||||
% for include in includes:
|
|
||||||
% if "toolchain" in include:
|
|
||||||
% continue
|
|
||||||
% end
|
|
||||||
% if include.startswith(user_home_dir):
|
|
||||||
% if "windows" in systype:
|
|
||||||
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% end
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="{{include}}"/>
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
|
||||||
% for define in defines:
|
|
||||||
<listOptionValue builtIn="false" value="{{define}}"/>
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.149990277" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.54121539" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
|
||||||
% for include in includes:
|
|
||||||
% if "toolchain" in include:
|
|
||||||
% continue
|
|
||||||
% end
|
|
||||||
% if include.startswith(user_home_dir):
|
|
||||||
% if "windows" in systype:
|
|
||||||
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% end
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="{{include}}"/>
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
|
||||||
% for define in defines:
|
|
||||||
<listOptionValue builtIn="false" value="{{define}}"/>
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.762536863" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1310559623" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
|
||||||
% for include in includes:
|
|
||||||
% if "toolchain" in include:
|
|
||||||
% continue
|
|
||||||
% end
|
|
||||||
% if include.startswith(user_home_dir):
|
|
||||||
% if "windows" in systype:
|
|
||||||
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
|
|
||||||
% end
|
|
||||||
% else:
|
|
||||||
<listOptionValue builtIn="false" value="{{include}}"/>
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
|
||||||
% for define in defines:
|
|
||||||
<listOptionValue builtIn="false" value="{{define}}"/>
|
|
||||||
% end
|
|
||||||
</option>
|
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.549319812" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
|
||||||
</tool>
|
|
||||||
</toolChain>
|
|
||||||
</folderInfo>
|
|
||||||
</configuration>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
|
||||||
</cconfiguration>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
|
||||||
<project id="{{project_name}}.null.189551033" name="{{project_name}}"/>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="scannerConfiguration">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
<scannerConfigBuildInfo instanceId="0.910961921">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
|
||||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
|
||||||
<configuration configurationName="Default">
|
|
||||||
<resource resourceType="PROJECT" workspacePath="/{{env_name}}"/>
|
|
||||||
</configuration>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
|
||||||
<buildTargets>
|
|
||||||
<target name="PlatformIO: Upload using Programmer" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>run -t program</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Upload SPIFFS image" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>run -t uploadfs</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Build" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>run</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Upload" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>run -t upload</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>run -t clean</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Test" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>test</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Update platforms and libraries" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>update</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="PlatformIO: Rebuild C/C++ Project Index" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>platformio</buildCommand>
|
|
||||||
<buildArguments>-f -c eclipse</buildArguments>
|
|
||||||
<buildTarget>init --ide eclipse</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>false</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
</buildTargets>
|
|
||||||
</storageModule>
|
|
||||||
</cproject>
|
|
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>{{project_name}}</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
|
||||||
<triggers>clean,full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
|
||||||
<triggers>full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
|
||||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
|
|
||||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="platformio -c eclipse debug -d ${project_loc} --interface=gdb"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".pioinit"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
|
|
||||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
|
|
||||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value=".pioenvs/{{env_name}}/firmware.elf"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="{{project_name}}"/>
|
|
||||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
|
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
|
||||||
<listEntry value="/{{project_name}}"/>
|
|
||||||
</listAttribute>
|
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
|
||||||
<listEntry value="4"/>
|
|
||||||
</listAttribute>
|
|
||||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
|
||||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
|
||||||
</listAttribute>
|
|
||||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>
|
|
||||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
|
||||||
<stringAttribute key="saved_expressions<seperator>Unknown" value="0x55f4"/>
|
|
||||||
</launchConfiguration>
|
|
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<project>
|
|
||||||
<configuration id="0.910961921" name="Default">
|
|
||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
% if "windows" in systype:
|
|
||||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
|
||||||
% else:
|
|
||||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
|
||||||
% end
|
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
|
||||||
</provider>
|
|
||||||
</extension>
|
|
||||||
</configuration>
|
|
||||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
environment/project/0.910961921/PATH/delimiter={{env_pathsep.replace(":", "\\:")}}
|
|
||||||
environment/project/0.910961921/PATH/operation=replace
|
|
||||||
environment/project/0.910961921/PATH/value={{env_path.replace(":", "\\:")}}
|
|
||||||
environment/project/0.910961921/append=true
|
|
||||||
environment/project/0.910961921/appendContributed=true
|
|
@ -1,6 +0,0 @@
|
|||||||
% for include in includes:
|
|
||||||
-I{{include}}
|
|
||||||
% end
|
|
||||||
% for define in defines:
|
|
||||||
-D{{!define}}
|
|
||||||
% end
|
|
@ -1,3 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
.piolibdeps
|
|
||||||
.clang_complete
|
|
@ -1,72 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configurationDescriptor version="97">
|
|
||||||
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
|
|
||||||
<df root="." name="0">
|
|
||||||
<in>platformio.ini</in>
|
|
||||||
</df>
|
|
||||||
<logicalFolder name="ExternalFiles"
|
|
||||||
displayName="Important Files"
|
|
||||||
projectFiles="false"
|
|
||||||
kind="IMPORTANT_FILES_FOLDER">
|
|
||||||
<itemPath>nbproject/private/launcher.properties</itemPath>
|
|
||||||
</logicalFolder>
|
|
||||||
</logicalFolder>
|
|
||||||
<sourceFolderFilter>^(nbproject|.pioenvs)$</sourceFolderFilter>
|
|
||||||
<sourceRootList>
|
|
||||||
<Elem>.</Elem>
|
|
||||||
</sourceRootList>
|
|
||||||
<projectmakefile></projectmakefile>
|
|
||||||
<confs>
|
|
||||||
<conf name="Default" type="0">
|
|
||||||
<toolsSet>
|
|
||||||
<compilerSet>default</compilerSet>
|
|
||||||
<dependencyChecking>false</dependencyChecking>
|
|
||||||
<rebuildPropChanged>false</rebuildPropChanged>
|
|
||||||
</toolsSet>
|
|
||||||
<codeAssistance>
|
|
||||||
<buildAnalyzer>true</buildAnalyzer>
|
|
||||||
<includeAdditional>true</includeAdditional>
|
|
||||||
</codeAssistance>
|
|
||||||
<makefileType>
|
|
||||||
<makeTool>
|
|
||||||
<buildCommandWorkingDir>.</buildCommandWorkingDir>
|
|
||||||
<buildCommand>{{platformio_path}} -f -c netbeans run</buildCommand>
|
|
||||||
<cleanCommand>{{platformio_path}} -f -c netbeans run --target clean</cleanCommand>
|
|
||||||
<executablePath></executablePath>
|
|
||||||
<cTool>
|
|
||||||
<incDir>
|
|
||||||
<pElem>src</pElem>
|
|
||||||
% for include in includes:
|
|
||||||
<pElem>{{include}}</pElem>
|
|
||||||
% end
|
|
||||||
</incDir>
|
|
||||||
<preprocessorList>
|
|
||||||
% for define in defines:
|
|
||||||
<Elem>{{define}}</Elem>
|
|
||||||
% end
|
|
||||||
</preprocessorList>
|
|
||||||
</cTool>
|
|
||||||
<ccTool>
|
|
||||||
<incDir>
|
|
||||||
<pElem>src</pElem>
|
|
||||||
% for include in includes:
|
|
||||||
<pElem>{{include}}</pElem>
|
|
||||||
% end
|
|
||||||
</incDir>
|
|
||||||
<preprocessorList>
|
|
||||||
% for define in defines:
|
|
||||||
<Elem>{{define}}</Elem>
|
|
||||||
% end
|
|
||||||
</preprocessorList>
|
|
||||||
</ccTool>
|
|
||||||
</makeTool>
|
|
||||||
<preBuild>
|
|
||||||
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
|
|
||||||
<preBuildCommand></preBuildCommand>
|
|
||||||
</preBuild>
|
|
||||||
</makefileType>
|
|
||||||
<item path="platformio.ini" ex="false" tool="3" flavor2="0">
|
|
||||||
</item>
|
|
||||||
</conf>
|
|
||||||
</confs>
|
|
||||||
</configurationDescriptor>
|
|
@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configurationDescriptor version="97">
|
|
||||||
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
|
|
||||||
<df root="." name="0">
|
|
||||||
<df name="lib">
|
|
||||||
</df>
|
|
||||||
<df name="src">
|
|
||||||
</df>
|
|
||||||
<in>platformio.ini</in>
|
|
||||||
</df>
|
|
||||||
</logicalFolder>
|
|
||||||
<projectmakefile></projectmakefile>
|
|
||||||
<confs>
|
|
||||||
<conf name="Default" type="0">
|
|
||||||
<toolsSet>
|
|
||||||
<developmentServer>localhost</developmentServer>
|
|
||||||
<platform>{{4 if "darwin" in systype else 2 if "linux" in systype else 3}}</platform>
|
|
||||||
</toolsSet>
|
|
||||||
<compile>
|
|
||||||
<compiledirpicklist>
|
|
||||||
<compiledirpicklistitem>.</compiledirpicklistitem>
|
|
||||||
<compiledirpicklistitem>${AUTO_FOLDER}</compiledirpicklistitem>
|
|
||||||
</compiledirpicklist>
|
|
||||||
<compiledir>${AUTO_FOLDER}</compiledir>
|
|
||||||
<compilecommandpicklist>
|
|
||||||
<compilecommandpicklistitem>${MAKE} ${ITEM_NAME}.o</compilecommandpicklistitem>
|
|
||||||
<compilecommandpicklistitem>${AUTO_COMPILE}</compilecommandpicklistitem>
|
|
||||||
</compilecommandpicklist>
|
|
||||||
<compilecommand>${AUTO_COMPILE}</compilecommand>
|
|
||||||
</compile>
|
|
||||||
<dbx_gdbdebugger version="1">
|
|
||||||
<gdb_pathmaps>
|
|
||||||
</gdb_pathmaps>
|
|
||||||
<gdb_interceptlist>
|
|
||||||
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
|
||||||
</gdb_interceptlist>
|
|
||||||
<gdb_options>
|
|
||||||
<DebugOptions>
|
|
||||||
</DebugOptions>
|
|
||||||
</gdb_options>
|
|
||||||
<gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/>
|
|
||||||
</dbx_gdbdebugger>
|
|
||||||
<nativedebugger version="1">
|
|
||||||
<engine>gdb</engine>
|
|
||||||
</nativedebugger>
|
|
||||||
<runprofile version="9">
|
|
||||||
<runcommandpicklist>
|
|
||||||
<runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem>
|
|
||||||
<runcommandpicklistitem>{{platformio_path}} -f -c netbeans run --target upload</runcommandpicklistitem>
|
|
||||||
</runcommandpicklist>
|
|
||||||
<runcommand>{{platformio_path}} -f -c netbeans run --target upload</runcommand>
|
|
||||||
<rundir>.</rundir>
|
|
||||||
<buildfirst>false</buildfirst>
|
|
||||||
<terminal-type>0</terminal-type>
|
|
||||||
<remove-instrumentation>0</remove-instrumentation>
|
|
||||||
<environment>
|
|
||||||
</environment>
|
|
||||||
</runprofile>
|
|
||||||
</conf>
|
|
||||||
</confs>
|
|
||||||
</configurationDescriptor>
|
|
@ -1,40 +0,0 @@
|
|||||||
# Launchers File syntax:
|
|
||||||
#
|
|
||||||
# [Must-have property line]
|
|
||||||
# launcher1.runCommand=<Run Command>
|
|
||||||
# [Optional extra properties]
|
|
||||||
# launcher1.displayName=<Display Name, runCommand by default>
|
|
||||||
# launcher1.buildCommand=<Build Command, Build Command specified in project properties by default>
|
|
||||||
# launcher1.runDir=<Run Directory, ${PROJECT_DIR} by default>
|
|
||||||
# launcher1.symbolFiles=<Symbol Files loaded by debugger, ${OUTPUT_PATH} by default>
|
|
||||||
# launcher1.env.<Environment variable KEY>=<Environment variable VALUE>
|
|
||||||
# (If this value is quoted with ` it is handled as a native command which execution result will become the value)
|
|
||||||
# [Common launcher properties]
|
|
||||||
# common.runDir=<Run Directory>
|
|
||||||
# (This value is overwritten by a launcher specific runDir value if the latter exists)
|
|
||||||
# common.env.<Environment variable KEY>=<Environment variable VALUE>
|
|
||||||
# (Environment variables from common launcher are merged with launcher specific variables)
|
|
||||||
# common.symbolFiles=<Symbol Files loaded by debugger>
|
|
||||||
# (This value is overwritten by a launcher specific symbolFiles value if the latter exists)
|
|
||||||
#
|
|
||||||
# In runDir, symbolFiles and env fields you can use these macroses:
|
|
||||||
# ${PROJECT_DIR} - project directory absolute path
|
|
||||||
# ${OUTPUT_PATH} - linker output path (relative to project directory path)
|
|
||||||
# ${OUTPUT_BASENAME}- linker output filename
|
|
||||||
# ${TESTDIR} - test files directory (relative to project directory path)
|
|
||||||
# ${OBJECTDIR} - object files directory (relative to project directory path)
|
|
||||||
# ${CND_DISTDIR} - distribution directory (relative to project directory path)
|
|
||||||
# ${CND_BUILDDIR} - build directory (relative to project directory path)
|
|
||||||
# ${CND_PLATFORM} - platform name
|
|
||||||
# ${CND_CONF} - configuration name
|
|
||||||
# ${CND_DLIB_EXT} - dynamic library extension
|
|
||||||
#
|
|
||||||
# All the project launchers must be listed in the file!
|
|
||||||
#
|
|
||||||
# launcher1.runCommand=...
|
|
||||||
# launcher2.runCommand=...
|
|
||||||
# ...
|
|
||||||
# common.runDir=...
|
|
||||||
# common.env.KEY=VALUE
|
|
||||||
|
|
||||||
# launcher1.runCommand=<type your run command here>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
|
||||||
<code-assistance-data xmlns="http://www.netbeans.org/ns/make-project-private/1">
|
|
||||||
<code-model-enabled>true</code-model-enabled>
|
|
||||||
</code-assistance-data>
|
|
||||||
<data xmlns="http://www.netbeans.org/ns/make-project-private/1">
|
|
||||||
<activeConfTypeElem>0</activeConfTypeElem>
|
|
||||||
<activeConfIndexElem>0</activeConfIndexElem>
|
|
||||||
</data>
|
|
||||||
</project-private>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
|
||||||
<type>org.netbeans.modules.cnd.makeproject</type>
|
|
||||||
<configuration>
|
|
||||||
<data xmlns="http://www.netbeans.org/ns/make-project/1">
|
|
||||||
<name>{{project_name}}</name>
|
|
||||||
<c-extensions/>
|
|
||||||
<cpp-extensions/>
|
|
||||||
<header-extensions/>
|
|
||||||
<sourceEncoding>UTF-8</sourceEncoding>
|
|
||||||
<make-dep-projects/>
|
|
||||||
<sourceRootList>
|
|
||||||
<sourceRootElem>.</sourceRootElem>
|
|
||||||
</sourceRootList>
|
|
||||||
<confList>
|
|
||||||
<confElem>
|
|
||||||
<name>Default</name>
|
|
||||||
<type>0</type>
|
|
||||||
</confElem>
|
|
||||||
</confList>
|
|
||||||
<formatting>
|
|
||||||
<project-formatting-style>false</project-formatting-style>
|
|
||||||
</formatting>
|
|
||||||
</data>
|
|
||||||
</configuration>
|
|
||||||
</project>
|
|
@ -1,28 +0,0 @@
|
|||||||
win32 {
|
|
||||||
HOMEDIR += $$(USERPROFILE)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
HOMEDIR += $$(HOME)
|
|
||||||
}
|
|
||||||
|
|
||||||
% for include in includes:
|
|
||||||
% if include.startswith(user_home_dir):
|
|
||||||
INCLUDEPATH += "$${HOMEDIR}{{include.replace(user_home_dir, "")}}"
|
|
||||||
% else:
|
|
||||||
INCLUDEPATH += "{{include}}"
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
|
|
||||||
% for define in defines:
|
|
||||||
DEFINES += "{{define}}"
|
|
||||||
% end
|
|
||||||
|
|
||||||
OTHER_FILES += platformio.ini
|
|
||||||
|
|
||||||
% for file in src_files:
|
|
||||||
% if file.endswith((".h", ".hpp")):
|
|
||||||
HEADERS += {{file}}
|
|
||||||
% else:
|
|
||||||
SOURCES += {{file}}
|
|
||||||
% end
|
|
||||||
% end
|
|
@ -1,104 +0,0 @@
|
|||||||
{
|
|
||||||
"build_systems":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run"
|
|
||||||
],
|
|
||||||
"name": "PlatformIO",
|
|
||||||
"variants":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run"
|
|
||||||
],
|
|
||||||
"name": "Build"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run",
|
|
||||||
"--target",
|
|
||||||
"clean"
|
|
||||||
],
|
|
||||||
"name": "Clean"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"name": "Test"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run",
|
|
||||||
"--target",
|
|
||||||
"upload"
|
|
||||||
],
|
|
||||||
"name": "Upload"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run",
|
|
||||||
"--target",
|
|
||||||
"program"
|
|
||||||
],
|
|
||||||
"name": "Upload using Programmer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"run",
|
|
||||||
"--target",
|
|
||||||
"uploadfs"
|
|
||||||
],
|
|
||||||
"name": "Upload SPIFFS image"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmd":
|
|
||||||
[
|
|
||||||
"platformio",
|
|
||||||
"-f", "-c", "sublimetext",
|
|
||||||
"update"
|
|
||||||
],
|
|
||||||
"name": "Update platforms and libraries"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"working_dir": "${project_path:${folder}}",
|
|
||||||
"selector": "source.c, source.c++",
|
|
||||||
"path": "{{env_path}}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"folders":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"path": "."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"settings":
|
|
||||||
{
|
|
||||||
"sublimegdb_workingdir": "{{project_dir}}",
|
|
||||||
"sublimegdb_exec_cmd": "-exec-continue",
|
|
||||||
"sublimegdb_commandline": "{{platformio_path}} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
% for include in includes:
|
|
||||||
-I{{include}}
|
|
||||||
% end
|
|
||||||
% for define in defines:
|
|
||||||
-D{{!define}}
|
|
||||||
% end
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"execPath": "{{ cxx_path.replace("\\", "/") }}",
|
|
||||||
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
|
|
||||||
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
|
|
||||||
"gccErrorLimit": 15,
|
|
||||||
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
|
|
||||||
"gccSuppressWarnings": false
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
.piolibdeps
|
|
||||||
.clang_complete
|
|
||||||
.gcc-flags.json
|
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;ino;pde</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="platformio.ini" />
|
|
||||||
</ItemGroup>
|
|
||||||
% for file in src_files:
|
|
||||||
<ItemGroup>
|
|
||||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
|
||||||
<ClInclude Include="{{file}}">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
% else:
|
|
||||||
<ClCompile Include="{{file}}">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
%end
|
|
||||||
</ItemGroup>
|
|
||||||
% end
|
|
||||||
</Project>
|
|
@ -1,74 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Path>{{env_path}}</Path>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{0FA9C3A8-452B-41EF-A418-9102B170F49F}</ProjectGuid>
|
|
||||||
<Keyword>MakeFileProj</Keyword>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Makefile</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Makefile</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<NMakeBuildCommandLine>platformio -f -c visualstudio run</NMakeBuildCommandLine>
|
|
||||||
<NMakeCleanCommandLine>platformio -f -c visualstudio run --target clean</NMakeCleanCommandLine>
|
|
||||||
<NMakePreprocessorDefinitions>{{!";".join(defines)}}</NMakePreprocessorDefinitions>
|
|
||||||
<NMakeIncludeSearchPath>{{";".join(["$(HOMEDRIVE)$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
|
|
||||||
<NMakeCleanCommandLine>platformio run --target clean</NMakeCleanCommandLine>
|
|
||||||
<NMakePreprocessorDefinitions>{{!";".join(defines)}}</NMakePreprocessorDefinitions>
|
|
||||||
<NMakeIncludeSearchPath>{{";".join(["$(HOMEDRIVE)$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="platformio.ini" />
|
|
||||||
</ItemGroup>
|
|
||||||
% for file in src_files:
|
|
||||||
<ItemGroup>
|
|
||||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
|
||||||
<ClInclude Include="{{file}}">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
% else:
|
|
||||||
<ClCompile Include="{{file}}">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
%end
|
|
||||||
</ItemGroup>
|
|
||||||
% end
|
|
||||||
</Project>
|
|
@ -1,3 +0,0 @@
|
|||||||
.pioenvs
|
|
||||||
.piolibdeps
|
|
||||||
.vscode/c_cpp_properties.json
|
|
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
% import platform
|
|
||||||
% systype = platform.system().lower()
|
|
||||||
% if systype == "windows":
|
|
||||||
"name": "Win32",
|
|
||||||
% elif systype == "darwin":
|
|
||||||
"name": "Mac",
|
|
||||||
% else:
|
|
||||||
"name": "Linux",
|
|
||||||
% end
|
|
||||||
"includePath": [
|
|
||||||
% for include in includes:
|
|
||||||
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
|
|
||||||
% end
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"browse": {
|
|
||||||
"limitSymbolsToIncludedHeaders": true,
|
|
||||||
"databaseFilename": "",
|
|
||||||
"path": [
|
|
||||||
% for include in includes:
|
|
||||||
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
|
|
||||||
% end
|
|
||||||
""
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"defines": [
|
|
||||||
% for define in defines:
|
|
||||||
"{{!define.replace('"', '\\"')}}",
|
|
||||||
% end
|
|
||||||
""
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
% from os.path import dirname, join
|
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "gdb",
|
|
||||||
"request": "launch",
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"name": "PlatformIO Debugger",
|
|
||||||
"target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
|
|
||||||
"gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
|
|
||||||
"autorun": [ "source .pioinit" ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -20,10 +20,12 @@ from os.path import join
|
|||||||
from platformio import __version__, exception, util
|
from platformio import __version__, exception, util
|
||||||
from platformio.managers.package import PackageManager
|
from platformio.managers.package import PackageManager
|
||||||
|
|
||||||
|
|
||||||
CORE_PACKAGES = {
|
CORE_PACKAGES = {
|
||||||
"contrib-piohome": ">=0.2.1,<2",
|
"contrib-piohome": ">=0.2.1,<1",
|
||||||
"pysite-pioplus": ">=0.4.2,<2",
|
"contrib-projecttpls": "<1",
|
||||||
"tool-pioplus": ">=0.10.6,<2",
|
"pysite-pioplus": ">=0.4.2,<1",
|
||||||
|
"tool-pioplus": ">=0.10.6,<1",
|
||||||
"tool-unity": "~1.20302.1",
|
"tool-unity": "~1.20302.1",
|
||||||
"tool-scons": "~3.20501.2"
|
"tool-scons": "~3.20501.2"
|
||||||
}
|
}
|
||||||
|
183
platformio/project/config.py
Normal file
183
platformio/project/config.py
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from os.path import isfile
|
||||||
|
|
||||||
|
from configobj import ConfigObj
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectConfig(object):
|
||||||
|
|
||||||
|
INITIAL_COMMENT = """# PlatformIO Project Configuration File
|
||||||
|
#
|
||||||
|
# Build options: build flags, source filter
|
||||||
|
# Upload options: custom upload port, speed and extra flags
|
||||||
|
# Library options: dependencies, extra library storages
|
||||||
|
# Advanced options: extra scripting
|
||||||
|
#
|
||||||
|
# Please visit documentation for the other options and examples
|
||||||
|
# http://docs.platformio.org/page/projectconf.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
SEMICOLON_TO_SHARP_RE = re.compile(r"((^|\s+);)", re.M)
|
||||||
|
SHARP_TO_SEMICOLON_RE = re.compile(r"((^|\s+)#)", re.M)
|
||||||
|
STRIP_INLINE_COMMENT_RE = re.compile(r"(^|\s+)#.*", re.M)
|
||||||
|
MLOPTS_PRE_RE = re.compile(r"^([\w]+)(\s*=[ \t\r\f\v]*)(\n[ \t]+[^\n]+)+",
|
||||||
|
re.M)
|
||||||
|
MLOPTS_POST_RE = re.compile(r"^([\w]+)\s*=[ \t\r\f\v]*(''')([^\2]+)\2",
|
||||||
|
re.M)
|
||||||
|
VARTPL_RE = re.compile(r"\$\{([^\.\}]+)\.([^\}]+)\}")
|
||||||
|
|
||||||
|
def __init__(self, path):
|
||||||
|
self.path = path
|
||||||
|
self._parser = ConfigObj(
|
||||||
|
self._load_lines(),
|
||||||
|
interpolation=False,
|
||||||
|
list_values=False,
|
||||||
|
raise_errors=True)
|
||||||
|
self._modified = False
|
||||||
|
|
||||||
|
def _load_lines(self):
|
||||||
|
if not isfile(self.path):
|
||||||
|
return []
|
||||||
|
content = ""
|
||||||
|
with open(self.path, "r") as fp:
|
||||||
|
content = fp.read()
|
||||||
|
# ConfigObj doesn't support semicolons
|
||||||
|
content = self.SEMICOLON_TO_SHARP_RE.sub(r"\2#", content)
|
||||||
|
# Convert Python's multi-lines to ConfigObj's
|
||||||
|
if "'''" not in content:
|
||||||
|
content = self.MLOPTS_PRE_RE.sub(self._re_sub_mloptspre_handler,
|
||||||
|
content)
|
||||||
|
return content.split("\n")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _re_sub_mloptspre_handler(match):
|
||||||
|
name = match.group(1)
|
||||||
|
value = match.string[match.end(2):match.end(3)].strip()
|
||||||
|
return "%s = '''%s'''" % (name, value)
|
||||||
|
|
||||||
|
def write(self):
|
||||||
|
if not self._modified:
|
||||||
|
return
|
||||||
|
self._parser.initial_comment = self.INITIAL_COMMENT.split("\n")
|
||||||
|
with open(self.path, "w") as fp:
|
||||||
|
self._parser.write(fp)
|
||||||
|
self._post_hooks()
|
||||||
|
|
||||||
|
def _post_hooks(self):
|
||||||
|
with open(self.path, "r+") as fp:
|
||||||
|
content = fp.read()
|
||||||
|
fp.seek(0)
|
||||||
|
fp.truncate()
|
||||||
|
# ConfigObj doesn't support semicolons
|
||||||
|
content = self.SHARP_TO_SEMICOLON_RE.sub(r"\2;", content)
|
||||||
|
# convert ConfigObj's multi-lines to Python's
|
||||||
|
content = self.MLOPTS_POST_RE.sub(self._re_sub_mloptspost_handler,
|
||||||
|
content)
|
||||||
|
fp.write(content)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _re_sub_mloptspost_handler(match):
|
||||||
|
name = match.group(1)
|
||||||
|
items = [i.strip() for i in match.group(3).split("\n") if i.strip()]
|
||||||
|
return "%s = \n %s" % (name, "\n ".join(items))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def parser(self):
|
||||||
|
return self._parser
|
||||||
|
|
||||||
|
def sections(self):
|
||||||
|
return self._parser.keys()
|
||||||
|
|
||||||
|
def add_section(self, section):
|
||||||
|
self._parser[section] = {}
|
||||||
|
|
||||||
|
def delete_section(self, section):
|
||||||
|
if self.has_section(section):
|
||||||
|
self._modified = True
|
||||||
|
del self._parser[section]
|
||||||
|
|
||||||
|
def has_section(self, section):
|
||||||
|
return section in self._parser
|
||||||
|
|
||||||
|
def options(self, section):
|
||||||
|
return self._parser[section]
|
||||||
|
|
||||||
|
def items(self, section):
|
||||||
|
items = []
|
||||||
|
for option in self.options(section):
|
||||||
|
items.append((option, self.get(section, option)))
|
||||||
|
return items
|
||||||
|
|
||||||
|
def get(self, section, option):
|
||||||
|
value = self._parser[section][option]
|
||||||
|
if "${" in value and "}" in value:
|
||||||
|
value = self.VARTPL_RE.sub(self._re_sub_vartpl_handler, value)
|
||||||
|
# make a list from multi-lie values or which are separated via ", "
|
||||||
|
for separator in ("\n", ", "):
|
||||||
|
if separator not in value:
|
||||||
|
return value
|
||||||
|
result = []
|
||||||
|
for line in value.split(separator):
|
||||||
|
if "#" in line:
|
||||||
|
line = self.STRIP_INLINE_COMMENT_RE.sub("", line)
|
||||||
|
line = line.strip()
|
||||||
|
if line:
|
||||||
|
result.append(line)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _re_sub_vartpl_handler(self, match):
|
||||||
|
section, option = match.group(1), match.group(2)
|
||||||
|
if section == "env" and not self.has_section(section):
|
||||||
|
return os.getenv(option)
|
||||||
|
return self.get(section, option)
|
||||||
|
|
||||||
|
def set(self, section, option, value):
|
||||||
|
if not self.has_section(section):
|
||||||
|
self.add_section(section)
|
||||||
|
if self._parser[section].get(option) != value:
|
||||||
|
self._modified = True
|
||||||
|
self._parser[section][option] = value
|
||||||
|
|
||||||
|
def get_env_names(self):
|
||||||
|
return [s[4:] for s in self.sections() if s.startswith("env:")]
|
||||||
|
|
||||||
|
def env_get(self, name, option, default=None):
|
||||||
|
section = "env:%s" % name
|
||||||
|
if self.has_section(section) and option in self._parser[section]:
|
||||||
|
return self.get(section, option)
|
||||||
|
return default
|
||||||
|
|
||||||
|
def env_update(self, name, options):
|
||||||
|
for option, value in options:
|
||||||
|
self.set("env:%s" % name, option, value)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def env_replace(self, name, options):
|
||||||
|
self.delete_section("env:%s" % name)
|
||||||
|
return self.env_update(name, options)
|
||||||
|
|
||||||
|
def dump_all_options(self):
|
||||||
|
result = {}
|
||||||
|
for section in self.sections():
|
||||||
|
if not section.startswith("env:"):
|
||||||
|
continue
|
||||||
|
for option in self.options(section):
|
||||||
|
if option not in result:
|
||||||
|
result[option] = []
|
||||||
|
result[option].append(self.get(section, option))
|
||||||
|
return result
|
279
platformio/project/generator.py
Normal file
279
platformio/project/generator.py
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
|
||||||
|
join, relpath)
|
||||||
|
|
||||||
|
from platformio import app, exception, util
|
||||||
|
from platformio.managers.platform import PlatformManager
|
||||||
|
from platformio.project.config import ProjectConfig
|
||||||
|
from platformio.project.template import ProjectTemplateFactory
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectGenerator(object):
|
||||||
|
|
||||||
|
CONFIG_NAME = "platformio.ini"
|
||||||
|
|
||||||
|
def __init__(self, project_dir, options=None):
|
||||||
|
self.project_dir = project_dir
|
||||||
|
self.options = options or {}
|
||||||
|
|
||||||
|
self._project_lib_dir = None
|
||||||
|
self._project_src_dir = None
|
||||||
|
|
||||||
|
# Will be set to the first used env name
|
||||||
|
# Can be used later for IDE Generator
|
||||||
|
self._main_env_name = None
|
||||||
|
|
||||||
|
self.project_config = self.init_config()
|
||||||
|
|
||||||
|
def init_config(self):
|
||||||
|
config = ProjectConfig(join(self.project_dir, self.CONFIG_NAME))
|
||||||
|
pm = PlatformManager()
|
||||||
|
env_prefix = str(self.options['env_prefix'] or "")
|
||||||
|
|
||||||
|
for bid in self.options['boards']:
|
||||||
|
env_name = "%s%s" % (env_prefix, bid)
|
||||||
|
board_config = pm.board_config(bid, self.options['platform'])
|
||||||
|
env_options = [("platform", self.options['platform']
|
||||||
|
or board_config['platform'])]
|
||||||
|
board_frameworks = board_config.get("frameworks", [])
|
||||||
|
env_framework = self.options['framework']
|
||||||
|
if env_framework is None and board_frameworks:
|
||||||
|
env_framework = board_frameworks[0]
|
||||||
|
if env_framework and env_framework not in board_frameworks:
|
||||||
|
raise exception.PlatformioException(
|
||||||
|
"Board `%s` is not compatible with framework %s" %
|
||||||
|
(bid, env_framework))
|
||||||
|
if env_framework:
|
||||||
|
env_options.append(("framework", env_framework))
|
||||||
|
env_options.append(("board", bid))
|
||||||
|
|
||||||
|
# extra env options
|
||||||
|
for item in self.options['env_options']:
|
||||||
|
_name, _value = item.split("=", 1)
|
||||||
|
env_options.append((_name.strip(), _value.strip()))
|
||||||
|
|
||||||
|
# FIXME: Check [platformio] -> env_default
|
||||||
|
if not self._main_env_name:
|
||||||
|
self._main_env_name = env_name
|
||||||
|
|
||||||
|
config.env_update(env_name, env_options)
|
||||||
|
|
||||||
|
if not self._main_env_name:
|
||||||
|
env_names = config.get_env_names()
|
||||||
|
if env_names:
|
||||||
|
self._main_env_name = env_names[0]
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_supported_ide():
|
||||||
|
return sorted([
|
||||||
|
key[4:] for key in ProjectTemplateFactory.get_templates()
|
||||||
|
if key.startswith("ide.")
|
||||||
|
])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_supported_vcs():
|
||||||
|
return sorted([
|
||||||
|
key[4:] for key in ProjectTemplateFactory.get_templates()
|
||||||
|
if key.startswith("vcs.")
|
||||||
|
])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_supported_ci():
|
||||||
|
return sorted([
|
||||||
|
key[3:] for key in ProjectTemplateFactory.get_templates()
|
||||||
|
if key.startswith("ci.")
|
||||||
|
])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def fix_os_path(path):
|
||||||
|
return (re.sub(r"[\\]+", '\\' * 4, path)
|
||||||
|
if "windows" in util.get_systype() else path)
|
||||||
|
|
||||||
|
def get_src_files(self):
|
||||||
|
assert self._project_src_dir
|
||||||
|
result = []
|
||||||
|
with util.cd(self.project_dir):
|
||||||
|
for root, _, files in os.walk(self._project_src_dir):
|
||||||
|
for f in files:
|
||||||
|
result.append(relpath(join(root, f)))
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
lib_dir, src_dir = self._init_file_structure()
|
||||||
|
self._project_lib_dir = lib_dir
|
||||||
|
self._project_src_dir = src_dir
|
||||||
|
|
||||||
|
self._init_lib_readme(lib_dir)
|
||||||
|
|
||||||
|
if self.options['template']:
|
||||||
|
self._process_user_template(self.options['template'],
|
||||||
|
self.options['template_vars'])
|
||||||
|
|
||||||
|
self.project_config.write()
|
||||||
|
|
||||||
|
if self.options['vcs']:
|
||||||
|
self._process_vcs_template(self.options['vcs'])
|
||||||
|
if self.options['ci']:
|
||||||
|
self._process_ci_template(self.options['ci'])
|
||||||
|
if self.options['ide']:
|
||||||
|
self._process_ide_template(self.options['ide'])
|
||||||
|
|
||||||
|
def _init_file_structure(self):
|
||||||
|
with util.cd(self.project_dir):
|
||||||
|
result = (util.get_projectlib_dir(), util.get_projectsrc_dir())
|
||||||
|
for d in result:
|
||||||
|
if not isdir(d):
|
||||||
|
os.makedirs(d)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _process_user_template(self, name, variables):
|
||||||
|
pt = ProjectTemplateFactory.new("src.%s" % name, self.project_config)
|
||||||
|
for variable in variables:
|
||||||
|
assert "=" in variable, \
|
||||||
|
"Template Variable format is `name=value` pair"
|
||||||
|
pt.assign(*variable.split("=", 1))
|
||||||
|
|
||||||
|
assert pt.is_compatible(raise_errors=True)
|
||||||
|
assert pt.validate_variables()
|
||||||
|
|
||||||
|
for location, content in pt.render():
|
||||||
|
self.write_content(location, content)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _process_vcs_template(self, name):
|
||||||
|
pt = ProjectTemplateFactory.new("vcs.%s" % name, self.project_config)
|
||||||
|
assert pt.is_compatible(raise_errors=True)
|
||||||
|
for location, content in pt.render():
|
||||||
|
self.write_content(location, content)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _process_ci_template(self, name):
|
||||||
|
pt = ProjectTemplateFactory.new("ci.%s" % name, self.project_config)
|
||||||
|
assert pt.is_compatible(raise_errors=True)
|
||||||
|
for location, content in pt.render():
|
||||||
|
self.write_content(location, content)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _process_ide_template(self, ide):
|
||||||
|
if not self._main_env_name:
|
||||||
|
raise exception.BoardNotDefined()
|
||||||
|
|
||||||
|
pt = ProjectTemplateFactory.new("ide.%s" % ide, self.project_config)
|
||||||
|
|
||||||
|
# system
|
||||||
|
pt.assign("systype", util.get_systype())
|
||||||
|
pt.assign("env_pathsep", os.pathsep)
|
||||||
|
pt.assign("env_path", self.fix_os_path(os.getenv("PATH")))
|
||||||
|
pt.assign("user_home_dir", abspath(expanduser("~")))
|
||||||
|
pt.assign("platformio_path",
|
||||||
|
self.fix_os_path(util.where_is_program("platformio")))
|
||||||
|
# project
|
||||||
|
pt.assign("project_name", basename(self.project_dir))
|
||||||
|
pt.assign("project_dir", self.project_dir)
|
||||||
|
pt.assign("project_src_dir", self._project_src_dir)
|
||||||
|
pt.assign("src_files", self.get_src_files())
|
||||||
|
|
||||||
|
# project build environment
|
||||||
|
for name, value in self._dump_build_env(self._main_env_name).items():
|
||||||
|
pt.assign(name, value)
|
||||||
|
|
||||||
|
assert pt.is_compatible(raise_errors=True)
|
||||||
|
assert pt.validate_variables()
|
||||||
|
|
||||||
|
for location, content in pt.render():
|
||||||
|
self.write_content(location, content)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _dump_build_env(self, env_name):
|
||||||
|
data = {"defines": [], "includes": [], "cxx_path": None}
|
||||||
|
cmd = [util.get_pythonexe_path(), "-m", "platformio", "-f"]
|
||||||
|
if app.get_session_var("caller_id"):
|
||||||
|
cmd.extend(["-c", app.get_session_var("caller_id")])
|
||||||
|
cmd.extend(["run", "-t", "idedata", "-e", env_name])
|
||||||
|
cmd.extend(["-d", self.project_dir])
|
||||||
|
result = util.exec_command(cmd)
|
||||||
|
|
||||||
|
if result['returncode'] != 0 or '"includes":' not in result['out']:
|
||||||
|
raise exception.PlatformioException(
|
||||||
|
"\n".join([result['out'], result['err']]))
|
||||||
|
|
||||||
|
for line in result['out'].split("\n"):
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith('{"') and '"cxx_path"' in line:
|
||||||
|
data = json.loads(line[:line.rindex("}") + 1])
|
||||||
|
return data
|
||||||
|
|
||||||
|
def write_content(self, location, content):
|
||||||
|
for name in ("project_dir", "lib_dir", "src_dir"):
|
||||||
|
pattern = "%%%s%%" % name
|
||||||
|
if pattern not in location:
|
||||||
|
continue
|
||||||
|
location = location.replace(pattern, self.project_dir
|
||||||
|
if name == "project_dir" else getattr(
|
||||||
|
self, "_project_%s" % name))
|
||||||
|
if not isdir(dirname(location)):
|
||||||
|
os.makedirs(dirname(location))
|
||||||
|
with open(join(location), "w") as fp:
|
||||||
|
fp.write(content.encode("utf8"))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _init_lib_readme(lib_dir):
|
||||||
|
if isfile(join(lib_dir, "readme.txt")):
|
||||||
|
return
|
||||||
|
with open(join(lib_dir, "readme.txt"), "w") as f:
|
||||||
|
f.write(
|
||||||
|
"""This directory is intended for the project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link to executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in separate directory, like
|
||||||
|
"lib/private_lib/[here are source files]".
|
||||||
|
|
||||||
|
For example, see how can be organized `Foo` and `Bar` libraries:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |- readme.txt --> THIS FILE
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.cpp
|
||||||
|
|
||||||
|
Then in `src/main.cpp` you should use:
|
||||||
|
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
// rest H/C/CPP code
|
||||||
|
|
||||||
|
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||||
|
include paths and build them.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- http://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
|
""")
|
391
platformio/project/template.py
Normal file
391
platformio/project/template.py
Normal file
@ -0,0 +1,391 @@
|
|||||||
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
import os
|
||||||
|
from imp import load_source
|
||||||
|
from os.path import dirname, isdir, isfile, join, relpath, sep
|
||||||
|
|
||||||
|
import bottle
|
||||||
|
|
||||||
|
from platformio import exception, util
|
||||||
|
from platformio.managers.core import get_core_package_dir
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTemplateFactory(object):
|
||||||
|
|
||||||
|
MANIFEST_NAME = "template.py"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@util.memoized
|
||||||
|
def get_templates(cls):
|
||||||
|
pkg_dir = get_core_package_dir("contrib-projecttpls")
|
||||||
|
assert pkg_dir
|
||||||
|
items = {}
|
||||||
|
for root, _, _ in os.walk(pkg_dir):
|
||||||
|
if isfile(join(root, cls.MANIFEST_NAME)):
|
||||||
|
key = relpath(root, pkg_dir).replace(sep, ".")
|
||||||
|
items[key] = root
|
||||||
|
return items
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def load_module(key, path):
|
||||||
|
module = None
|
||||||
|
try:
|
||||||
|
module = load_source(
|
||||||
|
"platformio.project.template.%s" % key.replace(".", "_"), path)
|
||||||
|
except ImportError:
|
||||||
|
raise exception.UnknownProjectTemplate(key)
|
||||||
|
return module
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def new(cls, key, project_config):
|
||||||
|
if key not in cls.get_templates():
|
||||||
|
raise exception.UnknownProjectTemplate(key)
|
||||||
|
template_py = join(cls.get_templates()[key], cls.MANIFEST_NAME)
|
||||||
|
for _, _class in inspect.getmembers(
|
||||||
|
cls.load_module(key, template_py), inspect.isclass):
|
||||||
|
if issubclass(_class, ProjectTemplateBase):
|
||||||
|
return _class(project_config)
|
||||||
|
|
||||||
|
raise exception.UnknownProjectTemplate(key)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTemplateBase(object):
|
||||||
|
|
||||||
|
TITLE = None
|
||||||
|
DESCRIPTION = None
|
||||||
|
|
||||||
|
COMPATIBLE_PLATFORMS = None
|
||||||
|
COMPATIBLE_BOARDS = None
|
||||||
|
COMPATIBLE_FRAMEWORKS = None
|
||||||
|
|
||||||
|
VARIABLES = None
|
||||||
|
CONTENTS = None
|
||||||
|
|
||||||
|
def __init__(self, project_config):
|
||||||
|
self.project_config = project_config
|
||||||
|
self.project_dir = dirname(project_config.path)
|
||||||
|
|
||||||
|
def get_title(self):
|
||||||
|
return self.TITLE or self.__class__.__name__
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
return self.DESCRIPTION or self.get_title()
|
||||||
|
|
||||||
|
def get_compatible_platforms(self):
|
||||||
|
return self.COMPATIBLE_PLATFORMS or []
|
||||||
|
|
||||||
|
def get_compatible_boards(self):
|
||||||
|
return self.COMPATIBLE_BOARDS or []
|
||||||
|
|
||||||
|
def get_compatible_frameworks(self):
|
||||||
|
return self.COMPATIBLE_FRAMEWORKS or []
|
||||||
|
|
||||||
|
def get_variables(self):
|
||||||
|
return self.VARIABLES or []
|
||||||
|
|
||||||
|
def get_contents(self):
|
||||||
|
return self.CONTENTS or []
|
||||||
|
|
||||||
|
def assign(self, name, value):
|
||||||
|
found = False
|
||||||
|
for var in self.get_variables():
|
||||||
|
if var.name == name:
|
||||||
|
var.set_value(value)
|
||||||
|
found = True
|
||||||
|
if not found:
|
||||||
|
raise exception.UnknownProjectTplVar(name)
|
||||||
|
|
||||||
|
def is_compatible(self, raise_errors=False):
|
||||||
|
options = self.project_config.dump_all_options()
|
||||||
|
name_candidates = dict(
|
||||||
|
platform=set(self.get_compatible_platforms()),
|
||||||
|
board=set(self.get_compatible_boards()),
|
||||||
|
framework=set(self.get_compatible_frameworks()))
|
||||||
|
for name, candidates in name_candidates.items():
|
||||||
|
if not candidates:
|
||||||
|
continue
|
||||||
|
diff = set(options.get(name, [])) - candidates
|
||||||
|
if name not in options or diff:
|
||||||
|
if raise_errors:
|
||||||
|
raise exception.IncompatbileProjectTemplate(
|
||||||
|
self.get_title(), name, ", ".join(diff),
|
||||||
|
", ".join(candidates))
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def validate_variables(self):
|
||||||
|
return all([v.validate() for v in self.get_variables()])
|
||||||
|
|
||||||
|
def render(self):
|
||||||
|
items = []
|
||||||
|
data = dict(__project_config=self.project_config)
|
||||||
|
data.update({v.name: v.get_value() for v in self.get_variables()})
|
||||||
|
for item in self.get_contents():
|
||||||
|
result = self.render_content(item, data)
|
||||||
|
if result:
|
||||||
|
items.append(result)
|
||||||
|
return items
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def render_content(item, data):
|
||||||
|
return (item.location, item.render(data))
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Template Contents
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplContentBase(object):
|
||||||
|
|
||||||
|
def __init__(self, content, location):
|
||||||
|
self.content = content
|
||||||
|
self.location = location
|
||||||
|
|
||||||
|
def render(self, data):
|
||||||
|
content = self.content
|
||||||
|
if isfile(content):
|
||||||
|
with open(content) as fp:
|
||||||
|
content = fp.read()
|
||||||
|
return bottle.template(self.content, **data)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplRootContent(ProjectTplContentBase):
|
||||||
|
|
||||||
|
def __init__(self, content, location):
|
||||||
|
super(ProjectTplRootContent,
|
||||||
|
self).__init__(content, join("%project_dir%", location))
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplSrcContent(ProjectTplContentBase):
|
||||||
|
|
||||||
|
def __init__(self, content, location):
|
||||||
|
super(ProjectTplSrcContent, self).__init__(content,
|
||||||
|
join("%src_dir%", location))
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplLibContent(ProjectTplContentBase):
|
||||||
|
|
||||||
|
def __init__(self, content, location):
|
||||||
|
super(ProjectTplLibContent, self).__init__(content,
|
||||||
|
join("%lib_dir%", location))
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Template Variables
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarBase(object):
|
||||||
|
|
||||||
|
TYPE = None
|
||||||
|
|
||||||
|
def __init__(self, # pylint: disable=too-many-arguments
|
||||||
|
name,
|
||||||
|
title=None,
|
||||||
|
description=None,
|
||||||
|
default=None,
|
||||||
|
options=None):
|
||||||
|
self.name = name
|
||||||
|
self.title = title
|
||||||
|
self.description = description
|
||||||
|
self.default = default
|
||||||
|
self.options = options or {}
|
||||||
|
self._value = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def type(self):
|
||||||
|
return self.TYPE
|
||||||
|
|
||||||
|
def set_value(self, value):
|
||||||
|
self._value = value
|
||||||
|
|
||||||
|
def get_value(self):
|
||||||
|
return self._value or self.default
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
value = self.get_value()
|
||||||
|
if "min" in self.options:
|
||||||
|
assert value >= self.options['min']
|
||||||
|
if "max" in self.options:
|
||||||
|
assert value <= self.options['max']
|
||||||
|
if "enum" in self.options:
|
||||||
|
assert value in self.options['enum']
|
||||||
|
except AssertionError:
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarString(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "string"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
self.set_value(str(self.get_value()))
|
||||||
|
super(ProjectTplVarString, self).validate()
|
||||||
|
except ValueError:
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarInteger(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "integer"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
self.set_value(int(self.get_value()))
|
||||||
|
super(ProjectTplVarInteger, self).validate()
|
||||||
|
except ValueError:
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarNumber(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "number"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
self.set_value(float(self.get_value()))
|
||||||
|
super(ProjectTplVarNumber, self).validate()
|
||||||
|
except ValueError:
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarBoolean(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "boolean"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
value = self.get_value()
|
||||||
|
if not isinstance(value, bool):
|
||||||
|
value = str(value).lower()
|
||||||
|
assert value in ("1", "0", "true", "false", "yes", "no")
|
||||||
|
value = bool(value in ("1", "true", "yes"))
|
||||||
|
self.set_value(value)
|
||||||
|
super(ProjectTplVarBoolean, self).validate()
|
||||||
|
except (AssertionError, ValueError):
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarArray(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "array"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
try:
|
||||||
|
value = self.get_value()
|
||||||
|
if not isinstance(value, list):
|
||||||
|
value = str(value).split(", ")
|
||||||
|
self.set_value(value)
|
||||||
|
if "enum" in self.options:
|
||||||
|
assert set(self.options['enum']) >= set(value)
|
||||||
|
except (AssertionError, ValueError):
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarFilePath(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "file"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if isfile(self.get_value()):
|
||||||
|
return True
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTplVarDirPath(ProjectTplVarBase):
|
||||||
|
|
||||||
|
TYPE = "directory"
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if isdir(self.get_value()):
|
||||||
|
return True
|
||||||
|
raise exception.InvalidProjectTplVar(self.get_value(), self.name,
|
||||||
|
self.type, self.options)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Base IDE template
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
class IDEProjectTemplateBase(ProjectTemplateBase):
|
||||||
|
|
||||||
|
VARIABLES = [
|
||||||
|
# system
|
||||||
|
ProjectTplVarString("systype"),
|
||||||
|
ProjectTplVarString("env_pathsep"),
|
||||||
|
ProjectTplVarString("env_path"),
|
||||||
|
ProjectTplVarDirPath("user_home_dir"),
|
||||||
|
ProjectTplVarFilePath("platformio_path"),
|
||||||
|
|
||||||
|
# project
|
||||||
|
ProjectTplVarString("project_name"),
|
||||||
|
ProjectTplVarDirPath("project_dir"),
|
||||||
|
ProjectTplVarDirPath("project_src_dir"),
|
||||||
|
ProjectTplVarArray("src_files"),
|
||||||
|
|
||||||
|
# project build environment
|
||||||
|
ProjectTplVarString("prog_path"),
|
||||||
|
ProjectTplVarFilePath("cc_path"),
|
||||||
|
ProjectTplVarFilePath("cxx_path"),
|
||||||
|
ProjectTplVarFilePath("gdb_path"),
|
||||||
|
ProjectTplVarArray("defines"),
|
||||||
|
ProjectTplVarArray("libsource_dirs"),
|
||||||
|
ProjectTplVarArray("includes"),
|
||||||
|
ProjectTplVarString("cc_flags"),
|
||||||
|
ProjectTplVarString("cxx_flags")
|
||||||
|
]
|
||||||
|
|
||||||
|
def render_content(self, item, data):
|
||||||
|
dst_path = item.location.replace("%project_dir%", self.project_dir)
|
||||||
|
conds = [
|
||||||
|
item.location.endswith(".gitignore"),
|
||||||
|
isfile(item.content),
|
||||||
|
isfile(dst_path)
|
||||||
|
]
|
||||||
|
if not all(conds):
|
||||||
|
return super(IDEProjectTemplateBase, self).render_content(
|
||||||
|
item, data)
|
||||||
|
# merge .gitignore
|
||||||
|
assert isfile(item.content)
|
||||||
|
with open(item.content) as fp:
|
||||||
|
content = fp.read()
|
||||||
|
modified = False
|
||||||
|
default = [l.strip() for l in content.split("\n")]
|
||||||
|
with open(dst_path) as fp:
|
||||||
|
current = [l.strip() for l in fp.readlines()]
|
||||||
|
for d in default:
|
||||||
|
if d and d not in current:
|
||||||
|
modified = True
|
||||||
|
current.append(d)
|
||||||
|
if not modified:
|
||||||
|
return
|
||||||
|
return (item.location, "\n".join(current) + "\n")
|
@ -1,9 +0,0 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; http://docs.platformio.org/page/projectconf.html
|
|
1
setup.py
1
setup.py
@ -22,6 +22,7 @@ install_requires = [
|
|||||||
"bottle<0.13",
|
"bottle<0.13",
|
||||||
"click>=5,<6",
|
"click>=5,<6",
|
||||||
"colorama",
|
"colorama",
|
||||||
|
"configobj",
|
||||||
"lockfile>=0.9.1,<0.13",
|
"lockfile>=0.9.1,<0.13",
|
||||||
"pyserial>=3,<4,!=3.3",
|
"pyserial>=3,<4,!=3.3",
|
||||||
"requests>=2.4.0,<3",
|
"requests>=2.4.0,<3",
|
||||||
|
@ -20,6 +20,10 @@ from platformio import exception, util
|
|||||||
from platformio.commands.boards import cli as cmd_boards
|
from platformio.commands.boards import cli as cmd_boards
|
||||||
from platformio.commands.init import cli as cmd_init
|
from platformio.commands.init import cli as cmd_init
|
||||||
|
|
||||||
|
# test dynamic ${env.VAR} in option value
|
||||||
|
# test incompatible framework/platform for a board
|
||||||
|
# test dynamic vars in INI
|
||||||
|
|
||||||
|
|
||||||
def validate_pioproject(pioproject_dir):
|
def validate_pioproject(pioproject_dir):
|
||||||
pioconf_path = join(pioproject_dir, "platformio.ini")
|
pioconf_path = join(pioproject_dir, "platformio.ini")
|
||||||
|
Reference in New Issue
Block a user