Skip to content

Commit eebeb10

Browse files
Added a new build action which builds through a python script. It also supports stafllib (#11)
* Create action.yml * Create script.py * Updated python build script * Added logic path to build stafllib * Updated script.py * Added case insensitivity when checking if project is stafllib
1 parent 47eb3ba commit eebeb10

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

CCStudioBuild/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Name: CCStudio Build
2+
Description: This action does the actual building of our projects through a python script
3+
Author: Harmander Sihra
4+
5+
inputs:
6+
project_name:
7+
description: The name of the project you would like to build
8+
required: true
9+
build_config:
10+
description: The name of the build config used to build the project in CCStudio
11+
required: true
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- run: ${{ github.action_path }}\script.py ${{ inputs.project_name }} ${{ inputs.build_config }}
17+
shell: powershell
18+

CCStudioBuild/script.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
# This python script will build a project with stafllib
3+
4+
import os
5+
import subprocess
6+
import sys
7+
8+
9+
def main(project_name, build_config):
10+
# We need to be one directory up to simplify paths
11+
os.chdir("..")
12+
13+
eclipse_path = 'C:/ti/ccs1100/ccs/eclipse/eclipsec.exe'
14+
workspace = os.getcwd()
15+
16+
# Import the main project
17+
import_command = "{} -noSplash -data {} -application com.ti.ccstudio.apps.projectImport -ccs.location " \
18+
"{}\{} -ccs.overwrite".format(eclipse_path, workspace, workspace, project_name)
19+
if os.system(import_command) != 0:
20+
raise RuntimeError
21+
22+
# Import stafllib
23+
# Note: If we're building stafllib itself, we don't need to do this
24+
if (project_name.lower() != "stafllib"):
25+
submodule_import_command = "{} -noSplash -data {} -application com.ti.ccstudio.apps.projectImport -ccs.location " \
26+
"{}\{}\stafllib -ccs.overwrite".format(eclipse_path, workspace, workspace, project_name)
27+
if os.system(submodule_import_command) != 0:
28+
raise RuntimeError
29+
30+
# Build project
31+
build_command = "{} -noSplash -data {} -application com.ti.ccstudio.apps.projectBuild -ccs.projects {} " \
32+
"-ccs.configuration {}".format(eclipse_path, workspace, project_name, build_config)
33+
if os.system(build_command) != 0:
34+
raise RuntimeError
35+
36+
37+
if __name__ == '__main__':
38+
# We first make sure we have the right amount of arguments
39+
if len(sys.argv) != 3:
40+
sys.exit("Invalid usage. Correct usage: ./script.py <project_name> <build_config>")
41+
42+
project_name = sys.argv[1]
43+
build_config = sys.argv[2]
44+
45+
main(project_name, build_config)

0 commit comments

Comments
 (0)