@profoundlogic/codermake 3.0.1 → 3.1.1
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(_0x345e08,_0x7f34d7){const _0x57851d=_0x43bb,_0x548a44=_0x345e08();while(!![]){try{const _0x3bfb4a=-parseInt(_0x57851d(0x17f))/0x1*(parseInt(_0x57851d(0x168))/0x2)+-parseInt(_0x57851d(0x184))/0x3+parseInt(_0x57851d(0x185))/0x4*(parseInt(_0x57851d(0x171))/0x5)+-parseInt(_0x57851d(0x188))/0x6+parseInt(_0x57851d(0x182))/0x7+parseInt(_0x57851d(0x17d))/0x8*(parseInt(_0x57851d(0x166))/0x9)+parseInt(_0x57851d(0x17e))/0xa;if(_0x3bfb4a===_0x7f34d7)break;else _0x548a44['push'](_0x548a44['shift']());}catch(_0x1fe181){_0x548a44['push'](_0x548a44['shift']());}}}(_0x552f,0x3a2ef));import{writeFileSync,mkdirSync,existsSync}from'fs';import{join}from'path';function _0x552f(){const _0x3b3dfe=['q09ervjnquTfx0vnufrzidO9','y1zLu0e','mJeZmdaXogDtyM1StG','C2L6zq','vefsr0vuuYa6psa','ndCYmJu3ANr0uu1z','DgfYz2v0C0zPBgu','mZe3nJiYwM1IruvL','CNvSzxmUBwS','DgfYz2v0CY5TAW','wxvjwva','rwfvD2G','BwfWCgLUz0zPBgu','CNvSzxngAwXL','Dg1WrgLY','DxrMoa','nwDVtMDtEa','C3rYAw5NAwz5','ChvZAa','rwrMzKO','CMvJDxjZAxzL','vhPpBNy','AM9PBG','ANncueG','y29UzMLNlM1R','y20T','ugL1DgW','yMLXq2e','ntzurfrUEwu','mZi1otK2mgr1CvPHqq','m3n3rhnVyW','EuL3vfy','v1PTrKS','mJqYntq3mK1qA2z6Ba','idO9ia','mtG0nJmYrNf1wNzq','mZy1otG0B3PAq252'];_0x552f=function(){return _0x3b3dfe;};return _0x552f();}import{randomUUID}from'crypto';function _0x43bb(_0x219160,_0x225084){_0x219160=_0x219160-0x164;const _0x552fc9=_0x552f();let _0x43bb3d=_0x552fc9[_0x219160];if(_0x43bb['fTDzaQ']===undefined){var _0x94ce=function(_0x440514){const _0x2ce303='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3c0c7e='',_0xf4d87='';for(let _0x5e0195=0x0,_0x37c2de,_0x4ca7ab,_0x2bb5d8=0x0;_0x4ca7ab=_0x440514['charAt'](_0x2bb5d8++);~_0x4ca7ab&&(_0x37c2de=_0x5e0195%0x4?_0x37c2de*0x40+_0x4ca7ab:_0x4ca7ab,_0x5e0195++%0x4)?_0x3c0c7e+=String['fromCharCode'](0xff&_0x37c2de>>(-0x2*_0x5e0195&0x6)):0x0){_0x4ca7ab=_0x2ce303['indexOf'](_0x4ca7ab);}for(let _0x324f4f=0x0,_0x77ad8b=_0x3c0c7e['length'];_0x324f4f<_0x77ad8b;_0x324f4f++){_0xf4d87+='%'+('00'+_0x3c0c7e['charCodeAt'](_0x324f4f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xf4d87);};_0x43bb['kOnDCg']=_0x94ce,_0x43bb['HkrOng']={},_0x43bb['fTDzaQ']=!![];}const _0x323322=_0x552fc9[0x0],_0x243a46=_0x219160+_0x323322,_0xdf2b7a=_0x43bb['HkrOng'][_0x243a46];return!_0xdf2b7a?(_0x43bb3d=_0x43bb['kOnDCg'](_0x43bb3d),_0x43bb['HkrOng'][_0x243a46]=_0x43bb3d):_0x43bb3d=_0xdf2b7a,_0x43bb3d;}import{tmpdir}from'os';function ensureDir(_0x16525e){const _0x45b4a3=_0x43bb;if(!existsSync(_0x16525e)){const _0x2ea29f={};_0x2ea29f[_0x45b4a3(0x175)]=!![],mkdirSync(_0x16525e,_0x2ea29f);}}export function writeRules(_0xda493d,_0x17f87e,_0xe9d1b8={},_0x302d9e=null){const _0x3d4b7d=_0x43bb,_0x3a8f4a={'TzOnv':function(_0x24d97d){return _0x24d97d();},'EaUwh':function(_0x5aad1f,_0x1f6562){return _0x5aad1f(_0x1f6562);},'cVeSA':function(_0x27d57f,_0x861788,_0x5080a){return _0x27d57f(_0x861788,_0x5080a);},'sNHQm':_0x3d4b7d(0x16a),'biqCa':_0x3d4b7d(0x170),'Piutl':function(_0x187f0a,_0x2dfb64,_0x29bbeb,_0x2d7040){return _0x187f0a(_0x2dfb64,_0x29bbeb,_0x2d7040);}};if(!_0x302d9e){const _0x4c5568=randomUUID()['replace'](/-/g,'');_0x302d9e=join(_0x3a8f4a[_0x3d4b7d(0x176)](tmpdir),_0x3d4b7d(0x17a)+_0x4c5568);}_0x3a8f4a[_0x3d4b7d(0x16c)](ensureDir,_0x302d9e);const _0x54d74d=_0x3a8f4a[_0x3d4b7d(0x187)](join,_0x302d9e,_0x3d4b7d(0x169)),_0x4634ac=join(_0x302d9e,_0x3a8f4a['sNHQm']),_0x5905bf=join(_0x302d9e,'target-mapping.json'),_0x5a07e1=_0xda493d[_0x3d4b7d(0x177)]('\x0a')+'\x0a';writeFileSync(_0x54d74d,_0x5a07e1,_0x3a8f4a[_0x3d4b7d(0x17c)]);const _0x89fcd8=_0x3d4b7d(0x165)+_0x17f87e[_0x3d4b7d(0x177)]('\x20')+'\x0a';writeFileSync(_0x4634ac,_0x89fcd8,_0x3a8f4a[_0x3d4b7d(0x17c)]);const _0x4f718a=JSON[_0x3d4b7d(0x172)](_0xe9d1b8,null,0x2);_0x3a8f4a[_0x3d4b7d(0x17b)](writeFileSync,_0x5905bf,_0x4f718a,_0x3a8f4a[_0x3d4b7d(0x17c)]);const _0x10e0ab={};return _0x10e0ab[_0x3d4b7d(0x16e)]=_0x54d74d,_0x10e0ab[_0x3d4b7d(0x167)]=_0x4634ac,_0x10e0ab[_0x3d4b7d(0x16d)]=_0x5905bf,_0x10e0ab[_0x3d4b7d(0x16f)]=_0x302d9e,_0x10e0ab;}export function writeConfigMk(_0x3d95f8,_0x6e86c0){const _0x369324=_0x43bb,_0x19bd8b={'yIwTV':function(_0x387a3a,_0x174650){return _0x387a3a(_0x174650);},'YuIYP':function(_0x187215,_0x24c38b,_0x535726){return _0x187215(_0x24c38b,_0x535726);},'EdffJ':_0x369324(0x179),'jsBPH':function(_0x4c0a5c,_0x2feefd,_0x185c43,_0x42cf77){return _0x4c0a5c(_0x2feefd,_0x185c43,_0x42cf77);},'WZmFK':_0x369324(0x170)};if(!_0x6e86c0||_0x6e86c0[_0x369324(0x164)]===0x0)return null;_0x19bd8b[_0x369324(0x180)](ensureDir,_0x3d95f8);const _0x2e071a=_0x19bd8b[_0x369324(0x16b)](join,_0x3d95f8,_0x19bd8b[_0x369324(0x174)]),_0x90dcff=[_0x369324(0x186)];for(const [_0x21e1f6,_0x145e12]of _0x6e86c0){_0x90dcff[_0x369324(0x173)](_0x21e1f6+_0x369324(0x183)+_0x145e12);}return _0x19bd8b[_0x369324(0x178)](writeFileSync,_0x2e071a,_0x90dcff[_0x369324(0x177)]('\x0a')+'\x0a',_0x19bd8b[_0x369324(0x181)]),_0x2e071a;}
|
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.
|