Skip to content

Commit 7ee92ec

Browse files
authored
Update build.py
1 parent 46a027d commit 7ee92ec

File tree

1 file changed

+70
-44
lines changed

1 file changed

+70
-44
lines changed

src/build.py

Lines changed: 70 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,70 @@
1-
name: build
2-
3-
on:
4-
release:
5-
types: [published]
6-
7-
jobs:
8-
9-
build:
10-
runs-on: ${{ matrix.os }}
11-
strategy:
12-
matrix:
13-
os: [windows-latest]
14-
15-
steps:
16-
- uses: actions/checkout@v3
17-
- name: Run build on ${{ matrix.os }}
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.9.9"
21-
22-
- name: Install dependencies
23-
run: |
24-
python3 -m pip install --upgrade pip
25-
pip3 install pyinstaller
26-
pip install pillow
27-
pip3 install -r "requirements.txt"
28-
29-
30-
- name: Build tpp using tppbuild
31-
run: |
32-
python3 "./build.py"
33-
34-
35-
36-
37-
- name: uploading tpp for ${{ matrix.os}}
38-
uses: svenstaro/upload-release-action@v2
39-
with:
40-
repo_token: ${{ secrets.GITHUB_TOKEN }}
41-
file: |
42-
./*.tpp
43-
overwrite: true
44-
file_glob: true
1+
##Build.py
2+
3+
from TouchPortalAPI import tppbuild
4+
5+
6+
"""
7+
PLUGIN_MAIN: This lets tppbuild know where your main python plugin file is located so it will know which file to compile.
8+
"""
9+
PLUGIN_MAIN = "main.py"
10+
11+
"""
12+
PLUGIN_EXE_NAME: This defines what you want your plugin executable to be named. tppbuild will also use this for the .tpp file in the format:
13+
`pluginname + "_v" + version + "_" + os_name + ".tpp"`
14+
If left blank, the file name from PLUGIN_MAIN is used (w/out .py extension).
15+
"""
16+
PLUGIN_EXE_NAME = "adb-android-tp-plugin"
17+
18+
"""
19+
PLUGIN_EXE_ICON: This should be a path to a .ico file. However if png passed in, it will automatically converted to ico.
20+
"""
21+
PLUGIN_EXE_ICON = r"androidadb.ico"
22+
23+
24+
"""
25+
PLUGIN_ENTRY: This can be either path to entry.tp or path to a python file that contains infomation about entry.
26+
Note if you pass in a entry.tp, tppbuild will automatically validate the json. If you pass in a python file, it will
27+
build entry.tp & validate it for you. If validation fails, tppbuild will exit.
28+
"""
29+
PLUGIN_ENTRY = "entry.tp" # Here we just use the same file as the plugin's main code since that contains all the definitions for entry.tp.
30+
31+
"""
32+
"""
33+
PLUGIN_ENTRY_INDENT = 2
34+
35+
""" This is the root folder name that will be inside of .tpp """
36+
PLUGIN_ROOT = "Android"
37+
38+
""" Path to icon file used in entry.tp for category `imagepath`, if any. If left blank, TP will use a default icon. """
39+
PLUGIN_ICON = r"androidadb.png"
40+
41+
""" This tells tppbuild where you want finished build tpp to be saved at. Default "./" meaning current dir where tppbuild is running from. """
42+
OUTPUT_PATH = r"./"
43+
44+
45+
""" PLUGIN_VERSION: A version string for the generated .tpp file name. This example reads the `__version__` from the example plugin's code. """
46+
import json
47+
import os
48+
49+
entry = os.path.join(os.path.split(__file__)[0], PLUGIN_ENTRY)
50+
with open(entry, "r") as f:
51+
PLUGIN_VERSION = str(json.load(f)['version'])
52+
53+
54+
"""
55+
If you have any required file(s) that your plugin needs, put them in this list.
56+
"""
57+
ADDITIONAL_FILES = [
58+
]
59+
60+
"""
61+
Any additional arguments to be passed to Pyinstaller. Optional.
62+
"""
63+
ADDITIONAL_PYINSTALLER_ARGS = [
64+
# "--log-level=WARN", "--noconsole"
65+
]
66+
67+
# validateBuild()
68+
69+
if __name__ == "__main__":
70+
tppbuild.runBuild()

0 commit comments

Comments
 (0)