mandochka 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elyb/__init__.py +6 -0
- elyb/cli.py +4 -0
- elyb/cmds/build.py +1 -0
- elyb/cmds/cached.py +1 -0
- elyb/cmds/components/progress.py +2 -0
- elyb/cmds/components/rawterm.py +1 -0
- elyb/cmds/ignore.py +1 -0
- elyb/cmds/new.py +1 -0
- elyb/cmds/obfuscate.py +1 -0
- elyb/cmds/script.py +1 -0
- elyb/cmds/stats.py +1 -0
- elyb/cmds/version.py +1 -0
- elyb/cmds/watch.py +1 -0
- elyb/config.json +6 -0
- elyb/elyxdsl/__init__.py +1 -0
- elyb/elyxdsl/ast_nodes.py +1 -0
- elyb/elyxdsl/errors.py +1 -0
- elyb/elyxdsl/interpreter.py +1 -0
- elyb/elyxdsl/lexer.py +1 -0
- elyb/elyxdsl/parser/parser.py +1 -0
- mandochka/__init__.py +3 -0
- mandochka/cli.py +265 -0
- mandochka/cmds/build.py +412 -0
- mandochka/cmds/cached.py +129 -0
- mandochka/cmds/dex.py +96 -0
- mandochka/cmds/doctor.py +84 -0
- mandochka/cmds/ignore.py +77 -0
- mandochka/cmds/new.py +335 -0
- mandochka/cmds/script.py +59 -0
- mandochka/cmds/stats.py +200 -0
- mandochka/cmds/version.py +12 -0
- mandochka/cmds/watch.py +106 -0
- mandochka/config.json +8 -0
- mandochka/core/config.py +97 -0
- mandochka/core/fastio.py +163 -0
- mandochka/core/manifest.py +60 -0
- mandochka/core/progress.py +129 -0
- mandochka/core/terminal.py +145 -0
- mandochka/dex/compiler.py +259 -0
- mandochka/dex/config.py +158 -0
- mandochka/dex/toolchain.py +307 -0
- mandochka/dsl/__init__.py +6 -0
- mandochka/dsl/ast_nodes.py +239 -0
- mandochka/dsl/errors.py +36 -0
- mandochka/dsl/interpreter.py +258 -0
- mandochka/dsl/lexer.py +175 -0
- mandochka/dsl/parser.py +571 -0
- mandochka/pack/archive.py +225 -0
- mandochka/pack/meta.py +68 -0
- mandochka/py/ast_check.py +86 -0
- mandochka/py/compiler.py +306 -0
- mandochka/py/obfuscate.py +372 -0
- mandochka-0.1.0.dist-info/METADATA +197 -0
- mandochka-0.1.0.dist-info/RECORD +58 -0
- mandochka-0.1.0.dist-info/WHEEL +5 -0
- mandochka-0.1.0.dist-info/entry_points.txt +4 -0
- mandochka-0.1.0.dist-info/licenses/LICENSE +22 -0
- mandochka-0.1.0.dist-info/top_level.txt +2 -0
elyb/__init__.py
ADDED
elyb/cli.py
ADDED
elyb/cmds/build.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.build import runBuild, loadYaml, loadJson, findRefmap, loadMetainfo, resolveBuildName, compileSourceFiles, checkAst
|
elyb/cmds/cached.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.cached import runCached
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.core.terminal import RawTerminal, readKey, readByte, termSize
|
elyb/cmds/ignore.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.ignore import runAddIgnore, runDelIgnore
|
elyb/cmds/new.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.new import runNew, runInteractive, writePlugin, normalizeName
|
elyb/cmds/obfuscate.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.py.obfuscate import *
|
elyb/cmds/script.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.script import runScript
|
elyb/cmds/stats.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.stats import runStatBuilds, runStatLines, runStatSize, runStatFiles
|
elyb/cmds/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.version import runVersion
|
elyb/cmds/watch.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.cmds.watch import runWatch
|
elyb/config.json
ADDED
elyb/elyxdsl/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl import tokenize, parse, run, ParseError, ElyxRuntimeError, ScriptExit, ContextError
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl.ast_nodes import *
|
elyb/elyxdsl/errors.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl.errors import *
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl.interpreter import *
|
elyb/elyxdsl/lexer.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl.lexer import *
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mandochka.dsl.parser import parse, _Parser
|
mandochka/__init__.py
ADDED
mandochka/cli.py
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import os
|
|
3
|
+
import shlex
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from .cmds.version import runVersion
|
|
7
|
+
from .cmds.doctor import runDoctor
|
|
8
|
+
from .cmds.new import runNew, runInteractive
|
|
9
|
+
from .cmds.build import runBuild
|
|
10
|
+
from .cmds.dex import runDex
|
|
11
|
+
from .cmds.cached import runCached
|
|
12
|
+
from .cmds.ignore import runAddIgnore, runDelIgnore
|
|
13
|
+
from .cmds.stats import runStatBuilds, runStatLines, runStatSize, runStatFiles
|
|
14
|
+
from .cmds.watch import runWatch
|
|
15
|
+
from .cmds.script import runScript
|
|
16
|
+
from .core.config import findRefmap, resolveBuilderDir
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def buildParser() -> argparse.ArgumentParser:
|
|
20
|
+
parser = argparse.ArgumentParser(
|
|
21
|
+
prog="mandochka",
|
|
22
|
+
description="Mandochka — High-performance ElyxCore plugin builder with native D8/Javac DEX integration"
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument("-v", "--version", action="store_true", help="show version")
|
|
25
|
+
|
|
26
|
+
subparsers = parser.add_subparsers(dest="command")
|
|
27
|
+
|
|
28
|
+
# doctor
|
|
29
|
+
subparsers.add_parser("doctor", help="diagnose compiler environment (JDK, Javac, D8, Python 3.11)")
|
|
30
|
+
|
|
31
|
+
# dex
|
|
32
|
+
dexParser = subparsers.add_parser("dex", help="standalone compile Java sources to Dalvik DEX")
|
|
33
|
+
dexParser.add_argument("-s", "--source", help="Java source directory or file (default: dex_src)")
|
|
34
|
+
dexParser.add_argument("-o", "--output", help="output .dex file path")
|
|
35
|
+
dexParser.add_argument("--stubs", nargs="+", help="compile stubs directory or jar files")
|
|
36
|
+
dexParser.add_argument("--min-api", type=int, help="Android min API level (default: 26)")
|
|
37
|
+
dexParser.add_argument("--release", type=int, help="Java release target (e.g. 8, default: 8)")
|
|
38
|
+
dexParser.add_argument("--d8", help="custom path to d8 binary or r8.jar")
|
|
39
|
+
dexParser.add_argument("--javac", help="custom path to javac binary")
|
|
40
|
+
dexParser.add_argument("-f", "--force", action="store_true", help="force recompile, ignoring cache")
|
|
41
|
+
dexParser.add_argument("-c", "--clean", action="store_true", help="clean DEX cache before compilation")
|
|
42
|
+
dexParser.add_argument("-v", "--verbose", action="store_true", help="verbose compiler output")
|
|
43
|
+
|
|
44
|
+
# new
|
|
45
|
+
newParser = subparsers.add_parser("new", help="create new plugin from template")
|
|
46
|
+
newParser.add_argument("-g", "--gen", action="store_true", dest="gen", help="fast generation (non-interactive)")
|
|
47
|
+
newParser.add_argument("-n", "--name", dest="pluginname", help="plugin name (required with --gen)")
|
|
48
|
+
newParser.add_argument("-a", "--author", dest="author", help="author id (required with --gen)")
|
|
49
|
+
newParser.add_argument("-zf", "--zipformat", default="eaf", help="zip format (default: eaf, only with --gen)")
|
|
50
|
+
newParser.add_argument("--with-dex", action="store_true", help="scaffold with native Java DEX bridge (only with --gen)")
|
|
51
|
+
|
|
52
|
+
# build
|
|
53
|
+
buildParser = subparsers.add_parser("build", help="build plugin into archive")
|
|
54
|
+
buildParser.add_argument("--no-assets", action="store_true", dest="noAssets", help="exclude optionalAssets from archive")
|
|
55
|
+
buildParser.add_argument("-nf", "--no-folder", action="store_true", dest="noFolder", help="exclude builder directory from archive")
|
|
56
|
+
buildParser.add_argument("-v", "--verbose", action="store_true", dest="verbose", help="print build log")
|
|
57
|
+
buildParser.add_argument("-r", "--reset", action="store_true", dest="reset", help="clear compilation cache before build")
|
|
58
|
+
buildParser.add_argument("-p", "--password", nargs=2, metavar=("METHOD", "PASSWORD"), dest="encrypt", help="encrypt archive (e.g. -p aes-256 mypassword)")
|
|
59
|
+
buildParser.add_argument("-ni", "--no-info", action="store_true", dest="noInfo", help="skip appending info block to metainfo")
|
|
60
|
+
buildParser.add_argument("-sv", "--static-version", nargs="+", metavar=("VERSION", "APPEND"), dest="staticVersion", default=None, help="set static_ver in build info; optional APPEND=true appends version to archive name")
|
|
61
|
+
buildParser.add_argument("-sc", "--static-client", nargs="+", metavar=("PACKAGE", "NAME"), dest="staticClient", default=None, help="set client in build info; optional NAME appended to archive name")
|
|
62
|
+
buildParser.add_argument("-o", "--obfuscation", nargs="*", metavar="FILE", dest="obfuscation", default=None, help="obfuscate source; optional file paths relative to source")
|
|
63
|
+
|
|
64
|
+
buildModeGroup = buildParser.add_mutually_exclusive_group()
|
|
65
|
+
buildModeGroup.add_argument("-a", "--ast", action="store_true", dest="checkAst", help="check .py files in source via AST before build")
|
|
66
|
+
buildModeGroup.add_argument("-c", "--compile", nargs="?", type=int, choices=[0, 1, 2], const=1, default=None, dest="compile", metavar="LEVEL", help="compile .py files to .pyc (optimization level 0-2, default 1)")
|
|
67
|
+
|
|
68
|
+
# Dex flags
|
|
69
|
+
dexGroup = buildParser.add_mutually_exclusive_group()
|
|
70
|
+
dexGroup.add_argument("--dex", action="store_true", help="force DEX compilation")
|
|
71
|
+
dexGroup.add_argument("--skip-dex", "--no-dex", action="store_true", dest="skipDex", help="skip DEX compilation")
|
|
72
|
+
|
|
73
|
+
# Performance flags
|
|
74
|
+
buildParser.add_argument("-j", "--jobs", type=int, default=8, help="number of parallel compiler workers (default: 8)")
|
|
75
|
+
buildParser.add_argument("-b", "--benchmark", action="store_true", help="display millisecond build benchmark timer summary")
|
|
76
|
+
|
|
77
|
+
# cached
|
|
78
|
+
subparsers.add_parser("cached", help="show which source and DEX files have changed since last compilation")
|
|
79
|
+
|
|
80
|
+
# watch
|
|
81
|
+
watchParser = subparsers.add_parser("watch", help="poll for changes and rebuild automatically")
|
|
82
|
+
watchParser.add_argument("interval", type=int, nargs="?", default=2, metavar="TIME", help="polling interval in seconds (default: 2)")
|
|
83
|
+
watchParser.add_argument("-a", "--args", dest="buildArgs", default="", metavar="ARGS", help="arguments to pass to build")
|
|
84
|
+
|
|
85
|
+
# stats
|
|
86
|
+
statsParser = subparsers.add_parser("stats", help="project statistics")
|
|
87
|
+
statsSubparsers = statsParser.add_subparsers(dest="statsCommand")
|
|
88
|
+
statsSubparsers.add_parser("builds", help="show build counts")
|
|
89
|
+
linesParser = statsSubparsers.add_parser("lines", help="count lines of code")
|
|
90
|
+
linesParser.add_argument("-a", "--all", action="store_true", dest="allMode", help="count all non-binary files in plugin root")
|
|
91
|
+
linesParser.add_argument("-add", "--additional", nargs="+", dest="additionalDirs", metavar="DIR", default=[], help="additional directories to include")
|
|
92
|
+
|
|
93
|
+
sizeParser = statsSubparsers.add_parser("size", help="count file sizes")
|
|
94
|
+
sizeParser.add_argument("-a", "--all", action="store_true", dest="allMode", help="count all non-binary files in plugin root")
|
|
95
|
+
sizeParser.add_argument("-add", "--additional", nargs="+", dest="additionalDirs", metavar="DIR", default=[], help="additional directories to include")
|
|
96
|
+
|
|
97
|
+
filesParser = statsSubparsers.add_parser("files", help="count files by extension")
|
|
98
|
+
filesParser.add_argument("-a", "--all", action="store_true", dest="allMode", help="include all files and additional directories")
|
|
99
|
+
filesParser.add_argument("-add", "--additional", nargs="+", dest="additionalDirs", metavar="DIR", default=[], help="additional directories to include")
|
|
100
|
+
|
|
101
|
+
# script
|
|
102
|
+
scriptParser = subparsers.add_parser("script", help="run .edsl script")
|
|
103
|
+
scriptParser.add_argument("name", help="script name")
|
|
104
|
+
scriptParser.add_argument("args", nargs="*", help="arguments passed to script")
|
|
105
|
+
|
|
106
|
+
# add-ignore
|
|
107
|
+
addIgnoreParser = subparsers.add_parser("add-ignore", help="add path to an ignore list in config.yml")
|
|
108
|
+
addIgnoreParser.add_argument("path", help="path to add")
|
|
109
|
+
addIgnoreGroup = addIgnoreParser.add_mutually_exclusive_group(required=True)
|
|
110
|
+
addIgnoreGroup.add_argument("-a", "--all", action="store_const", const="all", dest="target", help="add to ignoreAll")
|
|
111
|
+
addIgnoreGroup.add_argument("-na", "--no-assets", action="store_const", const="no_assets", dest="target", help="add to optionalAssets")
|
|
112
|
+
addIgnoreGroup.add_argument("-c", "--compile", action="store_const", const="compile", dest="target", help="add to compilationIgnore")
|
|
113
|
+
|
|
114
|
+
# del-ignore
|
|
115
|
+
delIgnoreParser = subparsers.add_parser("del-ignore", help="remove path from an ignore list by index")
|
|
116
|
+
delIgnoreParser.add_argument("index", help="index to remove")
|
|
117
|
+
delIgnoreGroup = delIgnoreParser.add_mutually_exclusive_group(required=True)
|
|
118
|
+
delIgnoreGroup.add_argument("-a", "--all", action="store_const", const="all", dest="target", help="remove from ignoreAll")
|
|
119
|
+
delIgnoreGroup.add_argument("-na", "--no-assets", action="store_const", const="no_assets", dest="target", help="remove from optionalAssets")
|
|
120
|
+
delIgnoreGroup.add_argument("-c", "--compile", action="store_const", const="compile", dest="target", help="remove from compilationIgnore")
|
|
121
|
+
|
|
122
|
+
return parser
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def main():
|
|
126
|
+
parser = buildParser()
|
|
127
|
+
args = parser.parse_args()
|
|
128
|
+
|
|
129
|
+
if args.version:
|
|
130
|
+
runVersion()
|
|
131
|
+
return
|
|
132
|
+
|
|
133
|
+
if args.command is None:
|
|
134
|
+
parser.print_help()
|
|
135
|
+
sys.exit(0)
|
|
136
|
+
|
|
137
|
+
if args.command == "doctor":
|
|
138
|
+
runDoctor()
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
if args.command == "dex":
|
|
142
|
+
ok = runDex(
|
|
143
|
+
source=args.source,
|
|
144
|
+
output=args.output,
|
|
145
|
+
stubs=args.stubs,
|
|
146
|
+
min_api=args.min_api,
|
|
147
|
+
release=args.release,
|
|
148
|
+
d8_path=args.d8,
|
|
149
|
+
javac_path=args.javac,
|
|
150
|
+
force=args.force,
|
|
151
|
+
clean=args.clean,
|
|
152
|
+
verbose=args.verbose,
|
|
153
|
+
)
|
|
154
|
+
if not ok:
|
|
155
|
+
sys.exit(1)
|
|
156
|
+
return
|
|
157
|
+
|
|
158
|
+
if args.command == "new":
|
|
159
|
+
if args.gen:
|
|
160
|
+
if not args.pluginname:
|
|
161
|
+
parser.error("--gen requires -n/--name")
|
|
162
|
+
if not args.author:
|
|
163
|
+
parser.error("--gen requires -a/--author")
|
|
164
|
+
runNew(args.pluginname, args.author, args.zipformat, getattr(args, "with_dex", False))
|
|
165
|
+
else:
|
|
166
|
+
runInteractive()
|
|
167
|
+
return
|
|
168
|
+
|
|
169
|
+
if args.command == "build":
|
|
170
|
+
staticVersion = None
|
|
171
|
+
staticVersionInName = False
|
|
172
|
+
if args.staticVersion:
|
|
173
|
+
staticVersion = args.staticVersion[0]
|
|
174
|
+
if len(args.staticVersion) > 1 and args.staticVersion[1].lower() == "true":
|
|
175
|
+
staticVersionInName = True
|
|
176
|
+
|
|
177
|
+
staticClient = None
|
|
178
|
+
staticClientName = None
|
|
179
|
+
if args.staticClient:
|
|
180
|
+
staticClient = args.staticClient[0]
|
|
181
|
+
if len(args.staticClient) > 1:
|
|
182
|
+
staticClientName = args.staticClient[1]
|
|
183
|
+
|
|
184
|
+
encryptMethod = None
|
|
185
|
+
encryptPassword = None
|
|
186
|
+
if args.encrypt:
|
|
187
|
+
encryptMethod = args.encrypt[0]
|
|
188
|
+
encryptPassword = args.encrypt[1]
|
|
189
|
+
|
|
190
|
+
ok = runBuild(
|
|
191
|
+
noAssets=args.noAssets,
|
|
192
|
+
noFolder=args.noFolder,
|
|
193
|
+
verbose=args.verbose,
|
|
194
|
+
checkAstFlag=args.checkAst,
|
|
195
|
+
compileLevel=args.compile,
|
|
196
|
+
resetCache=args.reset,
|
|
197
|
+
encryptMethod=encryptMethod,
|
|
198
|
+
encryptPassword=encryptPassword,
|
|
199
|
+
noInfo=args.noInfo,
|
|
200
|
+
staticVersion=staticVersion,
|
|
201
|
+
staticVersionInName=staticVersionInName,
|
|
202
|
+
staticClient=staticClient,
|
|
203
|
+
staticClientName=staticClientName,
|
|
204
|
+
obfuscation=args.obfuscation,
|
|
205
|
+
dex=args.dex,
|
|
206
|
+
skipDex=args.skipDex,
|
|
207
|
+
jobs=args.jobs,
|
|
208
|
+
benchmark=args.benchmark,
|
|
209
|
+
)
|
|
210
|
+
if not ok:
|
|
211
|
+
sys.exit(1)
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
if args.command == "cached":
|
|
215
|
+
runCached()
|
|
216
|
+
return
|
|
217
|
+
|
|
218
|
+
if args.command == "watch":
|
|
219
|
+
buildArgs = shlex.split(args.buildArgs) if args.buildArgs else []
|
|
220
|
+
runWatch(args.interval, buildArgs)
|
|
221
|
+
return
|
|
222
|
+
|
|
223
|
+
if args.command == "stats":
|
|
224
|
+
cwd = os.getcwd()
|
|
225
|
+
refmapResult = findRefmap(cwd)
|
|
226
|
+
if not refmapResult:
|
|
227
|
+
print("error: refmap not found in current directory", file=sys.stderr)
|
|
228
|
+
sys.exit(1)
|
|
229
|
+
|
|
230
|
+
refmapPath, refmap = refmapResult
|
|
231
|
+
builderDir, _ = resolveBuilderDir(cwd, refmap)
|
|
232
|
+
pluginDir = os.path.dirname(builderDir) if os.path.basename(builderDir).startswith(".") else cwd
|
|
233
|
+
|
|
234
|
+
from .core.config import loadBuilderConfig
|
|
235
|
+
_, config = loadBuilderConfig(builderDir)
|
|
236
|
+
sourceRelPath = config.get("source", "")
|
|
237
|
+
sourceDir = os.path.join(cwd, sourceRelPath) if sourceRelPath else cwd
|
|
238
|
+
|
|
239
|
+
if args.statsCommand == "builds":
|
|
240
|
+
runStatBuilds(builderDir)
|
|
241
|
+
elif args.statsCommand == "lines":
|
|
242
|
+
runStatLines(sourceDir, pluginDir, args.allMode, args.additionalDirs)
|
|
243
|
+
elif args.statsCommand == "size":
|
|
244
|
+
runStatSize(sourceDir, pluginDir, args.allMode, args.additionalDirs)
|
|
245
|
+
elif args.statsCommand == "files":
|
|
246
|
+
runStatFiles(pluginDir, args.allMode, args.additionalDirs)
|
|
247
|
+
else:
|
|
248
|
+
parser.parse_args(["stats", "--help"])
|
|
249
|
+
return
|
|
250
|
+
|
|
251
|
+
if args.command == "script":
|
|
252
|
+
runScript(args.name, args.args)
|
|
253
|
+
return
|
|
254
|
+
|
|
255
|
+
if args.command == "add-ignore":
|
|
256
|
+
runAddIgnore(args.path, args.target)
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
if args.command == "del-ignore":
|
|
260
|
+
runDelIgnore(args.index, args.target)
|
|
261
|
+
return
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if __name__ == "__main__":
|
|
265
|
+
main()
|