multi-lang-build 0.2.6__py3-none-any.whl → 0.2.8__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.
@@ -7,7 +7,7 @@ from multi_lang_build.compiler.python import PythonCompiler
7
7
  from multi_lang_build.mirror.config import MirrorConfig, get_mirror_config
8
8
  from multi_lang_build.register import register_skill
9
9
 
10
- __version__ = "0.2.6"
10
+ __version__ = "0.2.8"
11
11
  __all__ = [
12
12
  "BuildConfig",
13
13
  "BuildResult",
@@ -125,25 +125,38 @@ class GoCompiler(CompilerBase):
125
125
  Returns:
126
126
  BuildResult containing success status and output information.
127
127
  """
128
+ from loguru import logger
129
+
128
130
  go_executable = self._get_executable_path()
129
-
131
+
130
132
  # Validate directories
131
133
  source_dir = self._validate_directory(source_dir, create_if_not_exists=False)
132
134
  output_dir = self._validate_directory(output_dir, create_if_not_exists=True)
133
-
135
+
136
+ # Print current working directory
137
+ cwd = Path.cwd().resolve()
138
+ logger.info(f"当前工作目录: {cwd}")
139
+
134
140
  # Prepare environment
135
141
  env = environment.copy() if environment else {}
136
-
142
+
143
+ # Ensure GOMODCACHE is set
144
+ if "GOMODCACHE" not in env and "GOPATH" not in env:
145
+ default_cache = Path.home() / "go" / "pkg" / "mod"
146
+ env["GOMODCACHE"] = str(default_cache)
147
+ logger.info(f"Go模块缓存: {default_cache}")
148
+
137
149
  if mirror_enabled:
138
150
  mirror_key = self._mirror or "go"
139
151
  env = apply_mirror_environment(mirror_key, env)
140
-
152
+
141
153
  # Check for go.mod
142
154
  go_mod = source_dir / "go.mod"
143
155
  has_go_mod = go_mod.exists()
144
-
156
+
145
157
  # Download dependencies if go.mod exists
146
158
  if has_go_mod:
159
+ logger.info("⬇️ 下载Go依赖...")
147
160
  deps_result = self._run_build(
148
161
  [go_executable, "mod", "download"],
149
162
  source_dir,
@@ -151,24 +164,31 @@ class GoCompiler(CompilerBase):
151
164
  environment=env,
152
165
  stream_output=stream_output,
153
166
  )
167
+ logger.info("✅ 依赖下载完成")
154
168
 
155
169
  if not deps_result["success"]:
156
170
  return deps_result
157
171
 
158
172
  # Build the project
173
+ logger.info("🔨 开始构建...")
159
174
  build_args = [go_executable, "build", "-o", str(output_dir)]
160
175
 
161
176
  if extra_args:
162
177
  build_args.extend(extra_args)
163
178
 
164
- return self._run_build(
179
+ build_result = self._run_build(
165
180
  build_args,
166
181
  source_dir,
167
182
  output_dir,
168
183
  environment=env,
169
184
  stream_output=stream_output,
170
185
  )
171
-
186
+
187
+ if build_result["success"]:
188
+ logger.info("✅ 构建成功")
189
+
190
+ return build_result
191
+
172
192
  def build_binary(
173
193
  self,
174
194
  source_dir: Path,
@@ -197,6 +217,8 @@ class GoCompiler(CompilerBase):
197
217
  Returns:
198
218
  BuildResult containing success status and output information.
199
219
  """
220
+ from loguru import logger
221
+
200
222
  go_executable = self._get_executable_path()
201
223
 
202
224
  source_dir = self._validate_directory(source_dir, create_if_not_exists=False)
@@ -204,8 +226,19 @@ class GoCompiler(CompilerBase):
204
226
  # Ensure output directory exists
205
227
  output_path.parent.mkdir(parents=True, exist_ok=True)
206
228
 
229
+ # Print current working directory
230
+ cwd = Path.cwd().resolve()
231
+ logger.info(f"当前工作目录: {cwd}")
232
+
233
+ # Prepare environment
207
234
  env = environment.copy() if environment else {}
208
235
 
236
+ # Ensure GOMODCACHE is set
237
+ if "GOMODCACHE" not in env and "GOPATH" not in env:
238
+ default_cache = Path.home() / "go" / "pkg" / "mod"
239
+ env["GOMODCACHE"] = str(default_cache)
240
+ logger.info(f"Go模块缓存: {default_cache}")
241
+
209
242
  if mirror_enabled:
210
243
  mirror_key = self._mirror or "go"
211
244
  env = apply_mirror_environment(mirror_key, env)
@@ -222,13 +255,19 @@ class GoCompiler(CompilerBase):
222
255
  if target:
223
256
  build_args.append(str(target))
224
257
 
225
- return self._run_build(
258
+ logger.info("🔨 开始构建...")
259
+ build_result = self._run_build(
226
260
  build_args,
227
261
  source_dir,
228
262
  output_path.parent,
229
263
  environment=env,
230
264
  stream_output=stream_output,
231
265
  )
266
+
267
+ if build_result["success"]:
268
+ logger.info("✅ 构建成功")
269
+
270
+ return build_result
232
271
 
233
272
  def build_all(
234
273
  self,
@@ -253,13 +292,26 @@ class GoCompiler(CompilerBase):
253
292
  Returns:
254
293
  BuildResult containing success status and output information.
255
294
  """
295
+ from loguru import logger
296
+
256
297
  go_executable = self._get_executable_path()
257
298
 
258
299
  source_dir = self._validate_directory(source_dir, create_if_not_exists=False)
259
300
  output_dir = self._validate_directory(output_dir, create_if_not_exists=True)
260
301
 
302
+ # Print current working directory
303
+ cwd = Path.cwd().resolve()
304
+ logger.info(f"当前工作目录: {cwd}")
305
+
306
+ # Prepare environment
261
307
  env = environment.copy() if environment else {}
262
308
 
309
+ # Ensure GOMODCACHE is set
310
+ if "GOMODCACHE" not in env and "GOPATH" not in env:
311
+ default_cache = Path.home() / "go" / "pkg" / "mod"
312
+ env["GOMODCACHE"] = str(default_cache)
313
+ logger.info(f"Go模块缓存: {default_cache}")
314
+
263
315
  if mirror_enabled:
264
316
  mirror_key = self._mirror or "go"
265
317
  env = apply_mirror_environment(mirror_key, env)
@@ -269,7 +321,8 @@ class GoCompiler(CompilerBase):
269
321
  if platform:
270
322
  env["GOOS"], env["GOARCH"] = platform.split("/")
271
323
 
272
- return self._run_build(
324
+ logger.info("🔨 开始构建...")
325
+ build_result = self._run_build(
273
326
  build_args,
274
327
  source_dir,
275
328
  output_dir,
@@ -277,6 +330,11 @@ class GoCompiler(CompilerBase):
277
330
  stream_output=stream_output,
278
331
  )
279
332
 
333
+ if build_result["success"]:
334
+ logger.info("✅ 构建成功")
335
+
336
+ return build_result
337
+
280
338
  def run_tests(
281
339
  self,
282
340
  source_dir: Path,
@@ -300,16 +358,29 @@ class GoCompiler(CompilerBase):
300
358
  Returns:
301
359
  BuildResult containing success status and output information.
302
360
  """
361
+ from loguru import logger
362
+
303
363
  go_executable = self._get_executable_path()
304
-
364
+
305
365
  source_dir = self._validate_directory(source_dir, create_if_not_exists=False)
306
-
366
+
367
+ # Print current working directory
368
+ cwd = Path.cwd().resolve()
369
+ logger.info(f"当前工作目录: {cwd}")
370
+
371
+ # Prepare environment
307
372
  env = environment.copy() if environment else {}
308
-
373
+
374
+ # Ensure GOMODCACHE is set
375
+ if "GOMODCACHE" not in env and "GOPATH" not in env:
376
+ default_cache = Path.home() / "go" / "pkg" / "mod"
377
+ env["GOMODCACHE"] = str(default_cache)
378
+ logger.info(f"Go模块缓存: {default_cache}")
379
+
309
380
  if mirror_enabled:
310
381
  mirror_key = self._mirror or "go"
311
382
  env = apply_mirror_environment(mirror_key, env)
312
-
383
+
313
384
  test_args = [go_executable, "test"]
314
385
 
315
386
  if verbose:
@@ -318,7 +389,8 @@ class GoCompiler(CompilerBase):
318
389
  if race:
319
390
  test_args.append("-race")
320
391
 
321
- return self._run_build(
392
+ logger.info("🧪 开始运行测试...")
393
+ test_result = self._run_build(
322
394
  test_args,
323
395
  source_dir,
324
396
  source_dir,
@@ -326,6 +398,11 @@ class GoCompiler(CompilerBase):
326
398
  stream_output=stream_output,
327
399
  )
328
400
 
401
+ if test_result["success"]:
402
+ logger.info("✅ 测试完成")
403
+
404
+ return test_result
405
+
329
406
  def tidy_modules(
330
407
  self,
331
408
  source_dir: Path,
@@ -345,23 +422,42 @@ class GoCompiler(CompilerBase):
345
422
  Returns:
346
423
  BuildResult containing success status and output information.
347
424
  """
425
+ from loguru import logger
426
+
348
427
  go_executable = self._get_executable_path()
349
428
 
350
429
  source_dir = self._validate_directory(source_dir, create_if_not_exists=False)
351
430
 
431
+ # Print current working directory
432
+ cwd = Path.cwd().resolve()
433
+ logger.info(f"当前工作目录: {cwd}")
434
+
435
+ # Prepare environment
352
436
  env = environment.copy() if environment else {}
353
437
 
438
+ # Ensure GOMODCACHE is set
439
+ if "GOMODCACHE" not in env and "GOPATH" not in env:
440
+ default_cache = Path.home() / "go" / "pkg" / "mod"
441
+ env["GOMODCACHE"] = str(default_cache)
442
+ logger.info(f"Go模块缓存: {default_cache}")
443
+
354
444
  if mirror_enabled:
355
445
  mirror_key = self._mirror or "go"
356
446
  env = apply_mirror_environment(mirror_key, env)
357
447
 
358
- return self._run_build(
448
+ logger.info("📦 执行 go mod tidy...")
449
+ tidy_result = self._run_build(
359
450
  [go_executable, "mod", "tidy"],
360
451
  source_dir,
361
452
  source_dir,
362
453
  environment=env,
363
454
  stream_output=stream_output,
364
455
  )
456
+
457
+ if tidy_result["success"]:
458
+ logger.info("✅ 依赖整理完成")
459
+
460
+ return tidy_result
365
461
 
366
462
  def clean(self, directory: Path) -> bool:
367
463
  """Clean Go build artifacts in the specified directory.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multi-lang-build
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Multi-language automated build tool with domestic mirror acceleration support
5
5
  Project-URL: Homepage, https://github.com/example/multi-lang-build
6
6
  Project-URL: Repository, https://github.com/example/multi-lang-build
@@ -1,18 +1,18 @@
1
- multi_lang_build/__init__.py,sha256=YW0JgPhIEyon0KOPPKdHRWsNTpCm-4bVm26iI_3YzQM,1777
1
+ multi_lang_build/__init__.py,sha256=vPtnBTSpvhZ2eYxNuR6-4hsJxPBvG0nT20ULw5BB7Og,1777
2
2
  multi_lang_build/cli.py,sha256=cOlXyJKdb6sReBPyCLZgQhCkJOA_lbkY67Xfk-hGbPc,12949
3
3
  multi_lang_build/py.typed,sha256=c8jtFarMovqA5DdwhEzKPH4WrX85xaoiWilIlvuc6KU,84
4
4
  multi_lang_build/register.py,sha256=dbNXNTnxtbh3r3Giej3trHQmI2VO5ydbkkExvCdYm8w,14501
5
5
  multi_lang_build/types.py,sha256=iCyz_6KmEBU4xwpCtfJnpzXoiSsmOcOKOhzHJVx8Z4Q,1043
6
6
  multi_lang_build/compiler/__init__.py,sha256=y5vvVN6HdSzq4W1kXBMy_vQq9G3-TtiVcNMOyBQHbCw,484
7
7
  multi_lang_build/compiler/base.py,sha256=crtDW9bthfV-FSpp96O2Hi0DrViNqcIt4TjAVK2lPXE,9391
8
- multi_lang_build/compiler/go.py,sha256=JV0GdHfhe-Lqyh7byMX_HguQ_XMwspW9RtHZIG1wyAo,15273
8
+ multi_lang_build/compiler/go.py,sha256=RxDtLAFy6vpphNJb4Jvocl1KlQFffyYsht98VG6x45Y,18407
9
9
  multi_lang_build/compiler/pnpm.py,sha256=BDUVZCX5PuhqlFp_ARKUMbLqUDLraTlKp3tdom60hzk,15774
10
10
  multi_lang_build/compiler/python.py,sha256=8XqE_Jp_G-x6g5Qrux4tCV8Ag-zZqLLLXapSIzcSLJw,17662
11
11
  multi_lang_build/mirror/__init__.py,sha256=RrZOQ83bxImAR275zeAUKyyCgwqdGt5xH8tF_-UShJo,489
12
12
  multi_lang_build/mirror/cli.py,sha256=qv6RI6izxUIsfMCIDOtTK3avcNSJpAaUF3NPiK1W49A,9820
13
13
  multi_lang_build/mirror/config.py,sha256=d9KJoV80BUZOR9R3DpcT1r0nyxH1HK6hfLZU7IsUGcw,8552
14
- multi_lang_build-0.2.6.dist-info/METADATA,sha256=r9uZbTHjc5UOtkvFttd3Lxm9lLRxjXqKYJ56qdjy3To,10073
15
- multi_lang_build-0.2.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
- multi_lang_build-0.2.6.dist-info/entry_points.txt,sha256=0vd5maQH5aZoqnpbr2Yr_IWB_-ncWX1rO3jGBCW3pHY,319
17
- multi_lang_build-0.2.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
- multi_lang_build-0.2.6.dist-info/RECORD,,
14
+ multi_lang_build-0.2.8.dist-info/METADATA,sha256=QWiPflg4EKYDJ6XMewlnmpiKW9AOS484Hw49b5Pn1gg,10073
15
+ multi_lang_build-0.2.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
+ multi_lang_build-0.2.8.dist-info/entry_points.txt,sha256=0vd5maQH5aZoqnpbr2Yr_IWB_-ncWX1rO3jGBCW3pHY,319
17
+ multi_lang_build-0.2.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
+ multi_lang_build-0.2.8.dist-info/RECORD,,