Skip to content

Commit

Permalink
Merge branch 'release/v1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jun 11, 2020
2 parents 9b111d7 + d6bffd2 commit edbcd3d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Examples

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
38 changes: 38 additions & 0 deletions builder/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2014-present PlatformIO <[email protected]>
#
# 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.

from SCons.Script import AlwaysBuild, Import


Import("env")


# Added in PIO Core 4.4.0
if not hasattr(env, "AddPlatformTarget"):

def AddPlatformTarget(
env,
name,
dependencies,
actions,
title=None,
description=None,
always_build=True,
):
target = env.Alias(name, dependencies, actions)
if always_build:
AlwaysBuild(target)
return target

env.AddMethod(AddPlatformTarget)
24 changes: 15 additions & 9 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621


env = DefaultEnvironment()
env.SConscript("compat.py", exports="env")

env.Replace(
AR="avr-gcc-ar",
Expand Down Expand Up @@ -153,10 +154,13 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
# Target: Print binary size
#

target_size = env.Alias(
"size", target_elf,
env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"))
AlwaysBuild(target_size)
target_size = env.AddPlatformTarget(
"size",
target_elf,
env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"),
"Program Size",
"Calculate program size",
)

#
# Target: Upload by default .hex file
Expand Down Expand Up @@ -189,16 +193,18 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.Replace(
UPLOADCMD='$UPLOADER $UPLOADERFLAGS %s' % " ".join(upload_cmd))

AlwaysBuild(env.Alias("upload", target_firm, upload_actions))
env.AddPlatformTarget("upload", target_firm, upload_actions, "Upload")

#
# Target: Upload firmware using external programmer
#

target_program = env.Alias(
"program", target_firm,
env.VerboseAction("$UPLOADCMD", "Programming $SOURCE"))
AlwaysBuild(target_program)
env.AddPlatformTarget(
"program",
target_firm,
env.VerboseAction("$UPLOADCMD", "Programming $SOURCE"),
"Upload using Programmer",
)

#
# Setup default targets
Expand Down
2 changes: 1 addition & 1 deletion platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-atmelmegaavr.git"
},
"version": "1.1.0",
"version": "1.1.1",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json"
Expand Down

0 comments on commit edbcd3d

Please sign in to comment.