forked from fjmalass/PatentMine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
executable file
·234 lines (195 loc) · 5.71 KB
/
Makefile.toml
File metadata and controls
executable file
·234 lines (195 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
[config]
default_to_workspace = false
skip_core_tasks = true
[env]
GOCACHE = "/tmp/go-build"
PATENTMINE_LOG_FILE = "logs/patentmine.log"
PATENTMINE_MAX_LOGS = "5"
PATENTMINE_MAX_LOG_BACKUPS = "5"
[tasks.default]
alias = "run"
[tasks.init]
private = true
[tasks.end]
private = true
[tasks.empty]
private = true
[tasks.launch]
alias = "run-uspto"
[tasks.run-uspto]
description = "Launch PatentMine using USPTO ODP as the import source."
category = "Application"
command = "go"
args = [
"run",
"-buildvcs=false",
"./cmd/patentmine",
"--import-source", "uspto",
"--log-file",
"${PATENTMINE_LOG_FILE}",
"--max-logs",
"${PATENTMINE_MAX_LOGS}",
]
[tasks.run-google]
description = "Launch PatentMine using Google Patents as the import source."
category = "Application"
command = "go"
args = [
"run",
"-buildvcs=false",
"./cmd/patentmine",
"--import-source", "google",
"--log-file",
"${PATENTMINE_LOG_FILE}",
"--max-logs",
"${PATENTMINE_MAX_LOGS}",
]
[tasks.run-google-debug]
description = "Launch PatentMine using Google Patents with debug logging."
category = "Application"
env = { "PATENT_DEBUG" = "1" }
alias = "run-google"
[tasks.run]
alias = "run-uspto"
[tasks.cli-help]
description = "Show PatentMine CLI flags."
category = "Application"
command = "go"
args = ["run", "-buildvcs=false", "./cmd/patentmine", "--help"]
[tasks.test]
description = "Run all Go tests."
category = "Development"
command = "go"
args = ["test", "./..."]
[tasks.test-debug]
description = "Run all Go tests with verbose USPTO debug logging."
category = "Development"
env = { "PATENT_DEBUG" = "1" }
command = "go"
args = ["test", "-v", "./..."]
[tasks.run-debug]
description = "Launch PatentMine with verbose USPTO debug logging."
category = "Application"
env = { "PATENT_DEBUG" = "1" }
alias = "run-uspto"
# ====================== Build Tasks ======================
# ====================== Shared Variables ======================
[tasks.version]
private = true
script = '''
git describe --tags --always --dirty 2>/dev/null || echo "dev"
'''
[tasks.commit]
private = true
script = '''
git rev-parse --short HEAD 2>/dev/null || echo "unknown"
'''
# ====================== Core Tasks ======================
[tasks.prepare-build-dir]
description = "Create the build output directory."
category = "Development"
command = "mkdir"
args = ["-p", "build"]
[tasks.build]
description = "Build the PatentMine binary for current platform"
category = "Development"
dependencies = ["prepare-build-dir"]
env = { CGO_ENABLED = "0" }
command = "go"
args = [
"build",
"-ldflags", "-X patentmine/internal/version.GitVersion={{@version}} -X patentmine/internal/version.GitCommit={{@commit}}",
"-o", "patentmine",
"./cmd/patentmine"
]
# ====================== Cross Compilation ======================
[tasks.build-macos-amd64]
description = "Build macOS Intel (amd64) binary"
category = "Development"
dependencies = ["prepare-build-dir"]
env = { GOOS = "darwin", GOARCH = "amd64", CGO_ENABLED = "0" }
command = "go"
args = [
"build",
"-ldflags", "-X patentmine/internal/version.GitVersion={{@version}} -X patentmine/internal/version.GitCommit={{@commit}}",
"-o", "build/patentmine-darwin-amd64",
"./cmd/patentmine"
]
[tasks.build-macos-arm64]
description = "Build macOS Apple Silicon (arm64) binary"
category = "Development"
dependencies = ["prepare-build-dir"]
env = { GOOS = "darwin", GOARCH = "arm64", CGO_ENABLED = "0" }
command = "go"
args = [
"build",
"-ldflags", "-X patentmine/internal/version.GitVersion={{@version}} -X patentmine/internal/version.GitCommit={{@commit}}",
"-o", "build/patentmine-darwin-arm64",
"./cmd/patentmine"
]
[tasks.build-windows-amd64]
description = "Build Windows Intel/AMD64 binary"
category = "Development"
dependencies = ["prepare-build-dir"]
env = { GOOS = "windows", GOARCH = "amd64", CGO_ENABLED = "0" }
command = "go"
args = [
"build",
"-ldflags", "-X patentmine/internal/version.GitVersion={{@version}} -X patentmine/internal/version.GitCommit={{@commit}}",
"-o", "build/patentmine-windows-amd64.exe",
"./cmd/patentmine"
]
[tasks.build-macos]
description = "Build macOS binaries for Intel and Apple Silicon."
category = "Development"
dependencies = ["build-macos-amd64", "build-macos-arm64"]
# ===================== Utils ============================
[tasks.tidy]
description = "Resolve and tidy Go module dependencies."
category = "Development"
command = "go"
args = ["mod", "tidy"]
[tasks.fmt]
description = "Format all Go files."
category = "Development"
command = "gofmt"
args = [ "fmt", "./..." ]
[tasks.check]
description = "Format, test, and build."
category = "Development"
dependencies = ["fmt", "test", "build"]
[tasks.clean]
description = "Remove the built binary."
category = "Maintenance"
command = "rm"
args = ["-f", "patentmine"]
[tasks.clean-all]
description = "Remove all local build outputs, including ./patentmine and ./build/."
category = "Maintenance"
command = "rm"
args = ["-rf", "patentmine", "build/"]
[tasks.reset-db]
description = "Remove the local SQLite database so the next launch reseeds the fixture."
category = "Maintenance"
command = "rm"
args = ["-rf", "db/"]
[tasks.logs]
description = "Print the local TUI log file."
category = "Maintenance"
command = "bash"
args = ["scripts/show-log.sh"]
[tasks.backup]
description = "Create a timestamped backup of the database and PDFs using the backup script."
category = "Maintenance"
command = "bash"
args = ["scripts/backup.sh"]
[tasks.backup-log]
description = "Create a dated backup of the current log and prune old log backups."
category = "Maintenance"
command = "bash"
args = ["scripts/backup-log.sh"]
[tasks.list-backups]
description = "List all existing backups."
category = "Maintenance"
command = "ls"
args = ["-lh", "backups/"]