@profoundlogic/codermake 3.0.0 → 3.1.0
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.
- package/README.md +82 -0
- package/dist/bin/index.js +1 -1
- package/dist/bin/preprocess-rpg-copy.js +1 -1
- package/dist/bin/rdf-to-dds.js +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/discovery.js +1 -1
- package/dist/lib/ejs-to-dds.js +1 -1
- package/dist/lib/executor.js +1 -1
- package/dist/lib/generate-rdf-dds.js +1 -1
- package/dist/lib/license.js +1 -1
- package/dist/lib/makefile-generator.js +1 -1
- package/dist/lib/platform.js +1 -1
- package/dist/lib/preprocessor.js +1 -1
- package/dist/lib/rdf-to-post-data.js +1 -1
- package/dist/lib/rpg-copy-preprocessor.js +1 -1
- package/dist/lib/ssh.js +1 -1
- package/dist/lib/target-listing.js +1 -0
- package/dist/lib/writer.js +1 -1
- package/dist/makefiles/Makefile +20 -7
- package/dist/makefiles/list.mk +97 -0
- package/dist/makefiles/unix.mk +13 -5
- package/package.json +1 -1
- package/skills/codermake/SKILL.md +25 -1
package/dist/lib/writer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0xece2bb,_0x5e5a60){const _0x53aea5=_0x3547,_0x13ee77=_0xece2bb();while(!![]){try{const _0x1d02bb=parseInt(_0x53aea5(0x159))/0x1+-parseInt(_0x53aea5(0x167))/0x2*(-parseInt(_0x53aea5(0x15e))/0x3)+-parseInt(_0x53aea5(0x163))/0x4+-parseInt(_0x53aea5(0x16b))/0x5+parseInt(_0x53aea5(0x170))/0x6+parseInt(_0x53aea5(0x166))/0x7*(-parseInt(_0x53aea5(0x16a))/0x8)+parseInt(_0x53aea5(0x15d))/0x9*(parseInt(_0x53aea5(0x16d))/0xa);if(_0x1d02bb===_0x5e5a60)break;else _0x13ee77['push'](_0x13ee77['shift']());}catch(_0x511a93){_0x13ee77['push'](_0x13ee77['shift']());}}}(_0x2fb7,0x63ed6));import{writeFileSync,mkdirSync,existsSync}from'fs';import{join}from'path';import{randomUUID}from'crypto';import{tmpdir}from'os';function _0x3547(_0x4d2c9e,_0x403779){_0x4d2c9e=_0x4d2c9e-0x154;const _0x2fb7af=_0x2fb7();let _0x35475d=_0x2fb7af[_0x4d2c9e];if(_0x3547['OgWyRC']===undefined){var _0x5b442b=function(_0x257a9e){const _0xc5d434='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x25f5f9='',_0x27d8fd='';for(let _0x41f5a1=0x0,_0x19686c,_0xf276db,_0x2cb224=0x0;_0xf276db=_0x257a9e['charAt'](_0x2cb224++);~_0xf276db&&(_0x19686c=_0x41f5a1%0x4?_0x19686c*0x40+_0xf276db:_0xf276db,_0x41f5a1++%0x4)?_0x25f5f9+=String['fromCharCode'](0xff&_0x19686c>>(-0x2*_0x41f5a1&0x6)):0x0){_0xf276db=_0xc5d434['indexOf'](_0xf276db);}for(let _0x44777a=0x0,_0x337161=_0x25f5f9['length'];_0x44777a<_0x337161;_0x44777a++){_0x27d8fd+='%'+('00'+_0x25f5f9['charCodeAt'](_0x44777a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x27d8fd);};_0x3547['UCnACB']=_0x5b442b,_0x3547['DGQrNN']={},_0x3547['OgWyRC']=!![];}const _0x543767=_0x2fb7af[0x0],_0x3f30b4=_0x4d2c9e+_0x543767,_0x43300f=_0x3547['DGQrNN'][_0x3f30b4];return!_0x43300f?(_0x35475d=_0x3547['UCnACB'](_0x35475d),_0x3547['DGQrNN'][_0x3f30b4]=_0x35475d):_0x35475d=_0x43300f,_0x35475d;}function ensureDir(_0x327455){const _0x460524=_0x3547,_0x713178={'hTWJn':function(_0x4faea2,_0x272c21,_0x12378b){return _0x4faea2(_0x272c21,_0x12378b);}};if(!existsSync(_0x327455)){const _0x29ec7a={};_0x29ec7a[_0x460524(0x168)]=!![],_0x713178[_0x460524(0x158)](mkdirSync,_0x327455,_0x29ec7a);}}function _0x2fb7(){const _0x572e59=['r1nItwC','DgfYz2v0lw1HChbPBMCUANnVBG','ndeWmZiXogvQuM9Jzq','mtuZntG1mePluhHSrW','CMvJDxjZAxzL','ChvZAa','ofvrAfDzsW','mJm2mJe5mgverNjqzq','y29UzMLNlM1R','nJuYoda1mgTACLDtDG','quD2Dgq','BwTtCKS','otm5nJzgChDWzuG','DgfYz2v0CY5TAW','C3rYAw5NAwz5','C2L6zq','q09ervjnquTfx0vnufrzidO9','wu9irwG','wNvOEeq','Dg1WrgLY','vefsr0vuuYa6psa','AM9PBG','v2nOtha','CNvSzxmUBwS','AfrxsM4','mtu1mZq4AvbNAu5p','z3nWz1K','idO9ia','seToCfK','oxPnwu5yyG','m2Dot3PvCW','y20T','qw5lDvK','DgfYz2v0C0zPBgu','DxrMoa','ndK1mZaWyMj2AwDZ'];_0x2fb7=function(){return _0x572e59;};return _0x2fb7();}export function writeRules(_0x145917,_0x486ba7,_0x5ace68={},_0x3951f5=null){const _0x5a027e=_0x3547,_0x25e1eb={'ZuhxD':function(_0x2eb9ab){return _0x2eb9ab();},'WchLp':function(_0x4c7755,_0x4b5155,_0x320067){return _0x4c7755(_0x4b5155,_0x320067);},'GSbMg':function(_0x9a1f07,_0x1e47e3){return _0x9a1f07(_0x1e47e3);},'NfBbS':_0x5a027e(0x157),'glhNj':_0x5a027e(0x165),'AGvtd':function(_0x475ae3,_0x2dc7e6){return _0x475ae3+_0x2dc7e6;},'mkSrK':function(_0x20f5a7,_0x3eac53,_0x44d063,_0x3d8483){return _0x20f5a7(_0x3eac53,_0x44d063,_0x3d8483);},'AnKuY':_0x5a027e(0x162)};if(!_0x3951f5){const _0x39c5db=_0x25e1eb[_0x5a027e(0x176)](randomUUID)['replace'](/-/g,'');_0x3951f5=_0x25e1eb[_0x5a027e(0x156)](join,_0x25e1eb['ZuhxD'](tmpdir),_0x5a027e(0x15f)+_0x39c5db);}_0x25e1eb[_0x5a027e(0x164)](ensureDir,_0x3951f5);const _0x51a4c8=join(_0x3951f5,_0x25e1eb['NfBbS']),_0x291d71=_0x25e1eb[_0x5a027e(0x156)](join,_0x3951f5,_0x5a027e(0x171)),_0x5e7e5f=join(_0x3951f5,_0x25e1eb['glhNj']),_0x59e1f2=_0x25e1eb[_0x5a027e(0x16e)](_0x145917[_0x5a027e(0x155)]('\x0a'),'\x0a');writeFileSync(_0x51a4c8,_0x59e1f2,_0x5a027e(0x162));const _0x56dae9=_0x5a027e(0x154)+_0x486ba7[_0x5a027e(0x155)]('\x20')+'\x0a';_0x25e1eb['mkSrK'](writeFileSync,_0x291d71,_0x56dae9,_0x25e1eb[_0x5a027e(0x160)]);const _0x20dfa9=JSON[_0x5a027e(0x172)](_0x5ace68,null,0x2);_0x25e1eb[_0x5a027e(0x16f)](writeFileSync,_0x5e7e5f,_0x20dfa9,_0x5a027e(0x162));const _0x1e2aee={};return _0x1e2aee['rulesFile']=_0x51a4c8,_0x1e2aee[_0x5a027e(0x161)]=_0x291d71,_0x1e2aee['mappingFile']=_0x5e7e5f,_0x1e2aee[_0x5a027e(0x177)]=_0x3951f5,_0x1e2aee;}export function writeConfigMk(_0x36c762,_0x44a904){const _0x493bdc=_0x3547,_0x54e310={'HKNpY':function(_0x2d0407,_0x20c7f6){return _0x2d0407===_0x20c7f6;},'YOHEh':function(_0x405830,_0x2bb1e7,_0x361e17){return _0x405830(_0x2bb1e7,_0x361e17);},'gspgY':function(_0xb669e9,_0x517bf5,_0x37c722,_0x332dcd){return _0xb669e9(_0x517bf5,_0x37c722,_0x332dcd);},'hKKVo':function(_0x546bc2,_0x16dbe2){return _0x546bc2+_0x16dbe2;}};if(!_0x44a904||_0x54e310[_0x493bdc(0x15c)](_0x44a904[_0x493bdc(0x173)],0x0))return null;ensureDir(_0x36c762);const _0x174427=_0x54e310[_0x493bdc(0x175)](join,_0x36c762,_0x493bdc(0x16c)),_0x4b4a4c=[_0x493bdc(0x174)];for(const [_0x5e4605,_0x8d8970]of _0x44a904){_0x4b4a4c[_0x493bdc(0x169)](_0x5e4605+_0x493bdc(0x15b)+_0x8d8970);}return _0x54e310[_0x493bdc(0x15a)](writeFileSync,_0x174427,_0x54e310['hKKVo'](_0x4b4a4c[_0x493bdc(0x155)]('\x0a'),'\x0a'),'utf8'),_0x174427;}
|
package/dist/makefiles/Makefile
CHANGED
|
@@ -7,8 +7,12 @@ OS := $(shell uname -s)
|
|
|
7
7
|
# Include base configuration
|
|
8
8
|
include $(CODERMAKE_PACKAGE_DIR)/makefiles/base.mk
|
|
9
9
|
|
|
10
|
-
# Include platform-specific rules
|
|
11
|
-
|
|
10
|
+
# Include platform-specific rules. Target listing (--list-targets) replaces the
|
|
11
|
+
# compiling backends entirely: no recipe runs, nothing is created, and no
|
|
12
|
+
# connection settings are needed. See list.mk and design/LIST_TARGETS.md.
|
|
13
|
+
ifdef CODERMAKE_LIST_TARGETS
|
|
14
|
+
include $(CODERMAKE_PACKAGE_DIR)/makefiles/list.mk
|
|
15
|
+
else ifeq ($(OS),OS400)
|
|
12
16
|
# IBM i platform
|
|
13
17
|
include $(CODERMAKE_PACKAGE_DIR)/makefiles/ibmi.mk
|
|
14
18
|
else
|
|
@@ -16,8 +20,11 @@ else
|
|
|
16
20
|
include $(CODERMAKE_PACKAGE_DIR)/makefiles/unix.mk
|
|
17
21
|
endif
|
|
18
22
|
|
|
19
|
-
# Initialize log directory (shared across platforms)
|
|
23
|
+
# Initialize log directory (shared across platforms). Skipped while listing, which
|
|
24
|
+
# must not discard the previous build's compile listings.
|
|
25
|
+
ifndef CODERMAKE_LIST_TARGETS
|
|
20
26
|
$(shell rm -rf tmp/logs && $(MKDIR) -p tmp/logs)
|
|
27
|
+
endif
|
|
21
28
|
|
|
22
29
|
# Include user compile-option overrides (.codermake/config.json -> config.mk).
|
|
23
30
|
# Optional: absent when the project has no configuration, in which case every
|
|
@@ -38,13 +45,19 @@ $(shell rm -rf tmp/logs && $(MKDIR) -p tmp/logs)
|
|
|
38
45
|
MAKE_SHORTFLAGS := $(filter-out -%,$(firstword $(MAKEFLAGS)))
|
|
39
46
|
|
|
40
47
|
# Per-library bin dirs computed from TARGETS (Unix-like only).
|
|
41
|
-
# Under `make -t`
|
|
42
|
-
#
|
|
43
|
-
#
|
|
48
|
+
# Under `make -t` recipes don't run, so we pre-create these dirs at parse time so
|
|
49
|
+
# dummies inside `build/<lib>.lib/` can be touched. In normal builds, the
|
|
50
|
+
# directory rule in unix.mk creates each one on demand.
|
|
51
|
+
#
|
|
52
|
+
# Deliberately `-t` only, not `-n`. In multi-library mode `build/<lib>.lib/` is
|
|
53
|
+
# itself the library-existence marker, so creating it under a dry run would leave
|
|
54
|
+
# a marker behind that satisfies the rule and suppresses the CRTLIB in a later
|
|
55
|
+
# real build. Nothing under `-n` needs these directories: no recipe runs and no
|
|
56
|
+
# dummy is touched.
|
|
44
57
|
ifneq ($(OS),OS400)
|
|
45
58
|
LIBRARY_BIN_DIRS := $(patsubst %/,%,$(sort $(dir $(filter build/%,$(TARGETS)))))
|
|
46
59
|
ifneq (,$(strip $(LIBRARY_BIN_DIRS)))
|
|
47
|
-
ifneq (,$(findstring t,$(MAKE_SHORTFLAGS))
|
|
60
|
+
ifneq (,$(findstring t,$(MAKE_SHORTFLAGS)))
|
|
48
61
|
$(shell mkdir -p $(LIBRARY_BIN_DIRS))
|
|
49
62
|
endif
|
|
50
63
|
endif
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
######
|
|
2
|
+
# Target listing backend.
|
|
3
|
+
#
|
|
4
|
+
# Included instead of unix.mk when CODERMAKE_LIST_TARGETS is set
|
|
5
|
+
# (`codermake --list-targets`). In this mode every output rule's recipe is a
|
|
6
|
+
# single pre-rendered record line emitted by the preprocessor, and make runs
|
|
7
|
+
# with -n, so no recipe is ever executed: make prints the records for exactly
|
|
8
|
+
# the targets it would have built, and the CLI reads them off stdout.
|
|
9
|
+
#
|
|
10
|
+
# -n is what makes the answer CORRECT, not merely cheap. Make propagates
|
|
11
|
+
# out-of-dateness to a dependent only when it believes a prerequisite was
|
|
12
|
+
# actually remade, which it decides by re-reading timestamps after running the
|
|
13
|
+
# prerequisite's recipe. A recipe that merely prints leaves the marker's
|
|
14
|
+
# timestamp alone, so executing print-recipes would report the directly-changed
|
|
15
|
+
# targets and silently drop every dependent — the opposite of what a listing is
|
|
16
|
+
# for. Under -n make assumes each recipe did its job and cascades normally.
|
|
17
|
+
#
|
|
18
|
+
# Nothing here contacts an IBM i, requires connection settings, prints a banner,
|
|
19
|
+
# or creates a file or directory: a listing is a query and must leave the build
|
|
20
|
+
# state untouched.
|
|
21
|
+
######
|
|
22
|
+
|
|
23
|
+
######
|
|
24
|
+
# Remote builds only. On IBM i the build targets are the objects in QSYS.LIB
|
|
25
|
+
# rather than markers under build/, and `codermake -t` cannot baseline them
|
|
26
|
+
# because touch cannot open a library or an object there. The CLI refuses
|
|
27
|
+
# --list-targets on IBM i before reaching this file; this guard means a wrong
|
|
28
|
+
# answer cannot be produced by accident if it ever gets here anyway.
|
|
29
|
+
######
|
|
30
|
+
ifeq ($(OS),OS400)
|
|
31
|
+
$(error --list-targets is not supported when running on IBM i)
|
|
32
|
+
endif
|
|
33
|
+
|
|
34
|
+
SHELL := /bin/sh
|
|
35
|
+
|
|
36
|
+
######
|
|
37
|
+
# Output library configuration. Only the name the generated rules reference is
|
|
38
|
+
# needed — the library reported for each target is baked into its record by the
|
|
39
|
+
# preprocessor. In single-library mode the library-creation prerequisite is
|
|
40
|
+
# spelled `build/$(LIBRARY).lib`, so LIBRARY must resolve here. Exactly one of
|
|
41
|
+
# IBMI_BUILD_LIBRARY or CODERMAKE_LIBRARY_MAP is set; the CLI has already
|
|
42
|
+
# validated that.
|
|
43
|
+
######
|
|
44
|
+
ifndef CODERMAKE_LIBRARY_MAP
|
|
45
|
+
LIBRARY := $(IBMI_BUILD_LIBRARY)
|
|
46
|
+
endif
|
|
47
|
+
|
|
48
|
+
######
|
|
49
|
+
# Where build output lives, used to tell a target's own sources apart from its
|
|
50
|
+
# object prerequisites when classifying why it is out of date.
|
|
51
|
+
######
|
|
52
|
+
CODERMAKE_LIST_OUT_PREFIX := build/
|
|
53
|
+
|
|
54
|
+
######
|
|
55
|
+
# Why a target is out of date, evaluated per record:
|
|
56
|
+
#
|
|
57
|
+
# missing - the marker does not exist; a build creates the object
|
|
58
|
+
# changed - one of the target's own source prerequisites is newer
|
|
59
|
+
# dependent - out of date only because a prerequisite object is being rebuilt
|
|
60
|
+
#
|
|
61
|
+
# Under -n, $? also lists prerequisites make only PRETENDS it remade, so the
|
|
62
|
+
# discriminator is whether anything outside the output tree is newer.
|
|
63
|
+
#
|
|
64
|
+
# With -B (--always-make) every target is remade by definition and the
|
|
65
|
+
# distinction is meaningless.
|
|
66
|
+
######
|
|
67
|
+
CODERMAKE_LIST_REASON = $(if $(wildcard $@),$(if $(filter-out $(CODERMAKE_LIST_OUT_PREFIX)%,$?),changed,dependent),missing)
|
|
68
|
+
|
|
69
|
+
######
|
|
70
|
+
# Library creation, as a no-op.
|
|
71
|
+
#
|
|
72
|
+
# Every output target carries its library-existence marker as an order-only
|
|
73
|
+
# prerequisite, so the marker needs a rule or make reports "No rule to make
|
|
74
|
+
# target". Listing must not create it: in multi-library mode the marker IS the
|
|
75
|
+
# `build/<lib>.lib/` directory, and leaving one behind would convince a later
|
|
76
|
+
# real build that the library already exists and skip its CRTLIB.
|
|
77
|
+
#
|
|
78
|
+
# A missing order-only prerequisite does not make a target out of date, so this
|
|
79
|
+
# produces no spurious records.
|
|
80
|
+
######
|
|
81
|
+
ifndef CODERMAKE_LIBRARY_MAP
|
|
82
|
+
build/$(LIBRARY).lib:
|
|
83
|
+
@:
|
|
84
|
+
else
|
|
85
|
+
build/%.lib:
|
|
86
|
+
@:
|
|
87
|
+
endif
|
|
88
|
+
|
|
89
|
+
######
|
|
90
|
+
# `clean` has no meaning while listing, and the CLI rejects it outright. This
|
|
91
|
+
# stub exists only so the main Makefile's `clean: platform-clean` still resolves
|
|
92
|
+
# at parse time. It cannot usefully fail instead: under -n a recipe is printed,
|
|
93
|
+
# never run, so there is nothing for a failing command to do.
|
|
94
|
+
######
|
|
95
|
+
.PHONY: platform-clean
|
|
96
|
+
platform-clean:
|
|
97
|
+
@:
|
package/dist/makefiles/unix.mk
CHANGED
|
@@ -23,11 +23,19 @@ ifndef CODERMAKE_LIBRARY_MAP
|
|
|
23
23
|
LIBRARY_PATH := /qsys.lib/$(LIBRARY).lib
|
|
24
24
|
endif
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
######
|
|
27
|
+
# Connection settings. Only warned about when a recipe might actually run:
|
|
28
|
+
# under -n / -q / -t no SSH session is opened, so the variables are genuinely
|
|
29
|
+
# not required and warning about them is noise. CODERMAKE_NO_EXECUTE is set by
|
|
30
|
+
# the CLI for those modes.
|
|
31
|
+
######
|
|
32
|
+
ifndef CODERMAKE_NO_EXECUTE
|
|
33
|
+
ifeq (,$(IBMI_HOST))
|
|
34
|
+
$(warning Warning: Required variable IBMI_HOST is not set.)
|
|
35
|
+
endif
|
|
36
|
+
ifeq (,$(IBMI_USER))
|
|
37
|
+
$(warning Warning: Required variable IBMI_USER is not set.)
|
|
38
|
+
endif
|
|
31
39
|
endif
|
|
32
40
|
|
|
33
41
|
######
|
package/package.json
CHANGED
|
@@ -24,9 +24,13 @@ codermake
|
|
|
24
24
|
# Build a single target
|
|
25
25
|
codermake <target> # e.g. codermake mypgm.pgm
|
|
26
26
|
|
|
27
|
-
# Dry run (show
|
|
27
|
+
# Dry run (show the commands, without running them)
|
|
28
28
|
codermake -n
|
|
29
29
|
|
|
30
|
+
# List the objects a build would create or replace (no compile, no connection;
|
|
31
|
+
# remote builds only)
|
|
32
|
+
codermake --list-targets
|
|
33
|
+
|
|
30
34
|
# Clean all build artifacts
|
|
31
35
|
codermake clean
|
|
32
36
|
|
|
@@ -36,6 +40,26 @@ codermake --print-rules
|
|
|
36
40
|
|
|
37
41
|
Build output for each target is logged to `tmp/logs/<target>.log`.
|
|
38
42
|
|
|
43
|
+
## Checking what a change affects
|
|
44
|
+
|
|
45
|
+
`codermake --list-targets` answers "what will my edit rebuild, and in what
|
|
46
|
+
order" without compiling anything or contacting the IBM i. It is available when
|
|
47
|
+
building remotely from Linux or macOS; running codermake locally on IBM i it is
|
|
48
|
+
refused, because there are no build markers to compare against. Each line reports one
|
|
49
|
+
object with its type, target library, source, and why it is affected:
|
|
50
|
+
|
|
51
|
+
- `changed` — one of the object's own sources is newer
|
|
52
|
+
- `dependent` — affected only because something it depends on is being rebuilt
|
|
53
|
+
- `missing` — the object does not exist yet
|
|
54
|
+
|
|
55
|
+
Use it to confirm that an edit reaches the objects intended before running a
|
|
56
|
+
build, and to see the blast radius of a change to shared source such as a `/COPY`
|
|
57
|
+
member. Add `=tsv` or `=json` for machine-readable output. Listing changes
|
|
58
|
+
nothing, so it is always safe to run.
|
|
59
|
+
|
|
60
|
+
After a successful build the list is empty, which makes it a quick check that
|
|
61
|
+
everything intended was actually built.
|
|
62
|
+
|
|
39
63
|
## Rules.mk syntax
|
|
40
64
|
|
|
41
65
|
Each source directory contains a `Rules.mk` file that declares build targets and their prerequisites. codermake automatically adds path prefixes (`src/`, `build/`, etc.) based on file extensions -- you write only bare filenames.
|