@@ -7,10 +7,64 @@ ifndef plugin
7
7
endif
8
8
9
9
build : validate_plugin
10
- go run generate/generator.go templates . $(plugin ) $(plugin_github_url )
10
+
11
+ # Remove existing work dir and create a new directory for the render process
12
+ rm -rf work && \
13
+ mkdir -p work
14
+
15
+ # Copy the entire source tree, excluding .git directory, into the new directory
16
+ rsync -a --exclude='.git' . work/ >/dev/null 2>&1
17
+
18
+ # Change to the new directory to perform operations
19
+ cd work && \
20
+ go run generate/generator.go templates . $(plugin) $(plugin_github_url) && \
21
+ go mod tidy && \
22
+ $(MAKE) -f out/Makefile build
23
+
24
+ # Copy the created binary from the work directory
25
+ cp work/steampipe_sqlite_$(plugin).so .
26
+
27
+ # Note: The work directory will contain the full code tree with changes,
28
+ # binaries will be copied to the actual root directory.
29
+
30
+ # render target
31
+ render : validate_plugin
32
+ @echo " Rendering code for plugin: $( plugin) "
33
+
34
+ # Remove existing work dir and create a new directory for the render process
35
+ rm -rf work && \
36
+ mkdir -p work
37
+
38
+ # Copy the entire source tree, excluding .git directory, into the new directory
39
+ rsync -a --exclude='.git' . work/ >/dev/null 2>&1
40
+
41
+ # Change to the new directory to perform operations
42
+ cd work && \
43
+ go run generate/generator.go templates . $(plugin) $(plugin_github_url) && \
11
44
go mod tidy
45
+
46
+ # Note: The work directory will contain the full code tree with rendered changes
47
+
48
+ # build_from_work target
49
+ build_from_work : validate_plugin
50
+ @if [ ! -d " work" ]; then \
51
+ echo " Error: 'work' directory does not exist. Please run the render target first." >&2 ; \
52
+ exit 1; \
53
+ fi
54
+ @echo " Building from work directory for plugin: $( plugin) "
55
+
56
+ # Change to the work directory to perform build operations
57
+ cd work && \
12
58
$(MAKE) -f out/Makefile build
13
59
60
+ # Copy the created binary from the work directory
61
+ cp work/steampipe_sqlite_$(plugin).so .
62
+
63
+ # Note: This target builds from the 'work' directory and binaries will be copied to the actual root directory.
64
+
65
+ clean :
66
+ rm -rf work
67
+
14
68
.PHONY : release-dry-run
15
69
release-dry-run :
16
70
@docker run \
0 commit comments