|
14 | 14 | VERSION = RELEASE.split("-")[0]
|
15 | 15 | AP_SOURCE_DIR = BASEDIR / "ap-releases" / f"async-profiler-{VERSION}-code" / "src"
|
16 | 16 | AP_CONVERTER_SOURCE_DIR = AP_SOURCE_DIR / "converter"
|
| 17 | +AP_RESOURCES_SOURCE_DIR = AP_SOURCE_DIR / "res" |
17 | 18 | AP_API_SOURCE_DIR = AP_SOURCE_DIR / "api" / "one" / "profiler"
|
18 | 19 | TARGET_SOURCE_DIR = BASEDIR / "src" / "main" / "java"
|
19 | 20 | TARGET_ONE_DIR = TARGET_SOURCE_DIR / "one"
|
20 | 21 | TARGET_ONE_PROFILER_DIR = TARGET_ONE_DIR / "profiler"
|
21 | 22 | TARGET_CONVERTER_DIR = TARGET_ONE_DIR / "converter"
|
| 23 | +TARGET_RESOURCES_DIR = BASEDIR / "src" / "main" / "resources" |
22 | 24 |
|
23 | 25 | assert AP_SOURCE_DIR.exists(), f"Source directory {AP_SOURCE_DIR} does not exist"
|
24 | 26 | assert AP_CONVERTER_SOURCE_DIR.exists(), f"Source directory {AP_CONVERTER_SOURCE_DIR} does not exist"
|
25 | 27 | assert AP_API_SOURCE_DIR.exists()
|
26 | 28 | assert TARGET_SOURCE_DIR.exists()
|
27 | 29 | assert TARGET_ONE_PROFILER_DIR.exists()
|
| 30 | +assert AP_RESOURCES_SOURCE_DIR.exists() |
28 | 31 |
|
29 | 32 | PROJECT_FILES = ["AsyncProfilerLoader.java"]
|
30 | 33 |
|
31 | 34 | DRY_RUN = False
|
32 | 35 |
|
33 | 36 | os.chdir(BASEDIR)
|
34 | 37 |
|
| 38 | +os.makedirs(TARGET_RESOURCES_DIR, exist_ok=True) |
| 39 | + |
35 | 40 | print("Remove old files")
|
36 | 41 | for f in TARGET_ONE_PROFILER_DIR.glob("*"):
|
37 | 42 | if f.name not in PROJECT_FILES:
|
|
42 | 47 | f.rmdir()
|
43 | 48 | else:
|
44 | 49 | f.unlink()
|
| 50 | + |
45 | 51 | for f in TARGET_ONE_DIR.glob("*"):
|
46 | 52 | if not f.is_dir() or f.name == "profiler":
|
47 | 53 | continue
|
48 | 54 | if DRY_RUN:
|
49 | 55 | print("would remove " + str(f))
|
50 | 56 | else:
|
51 | 57 | shutil.rmtree(f)
|
| 58 | + |
52 | 59 | for f in TARGET_SOURCE_DIR.glob("*.java"):
|
53 | 60 | if DRY_RUN:
|
54 | 61 | print("would remove " + str(f))
|
|
64 | 71 | else:
|
65 | 72 | shutil.copy(f, target_file)
|
66 | 73 |
|
| 74 | +print("Copy converter resource files") |
| 75 | +for f in AP_RESOURCES_SOURCE_DIR.glob("*"): |
| 76 | + target_file = TARGET_RESOURCES_DIR / f.name |
| 77 | + if DRY_RUN: |
| 78 | + print(f"would copy {f} to {target_file}") |
| 79 | + else: |
| 80 | + shutil.copy(f, target_file) |
67 | 81 |
|
68 | 82 | print("Copy converter directories")
|
69 | 83 | for directory in AP_CONVERTER_SOURCE_DIR.glob("one/*"):
|
|
0 commit comments