-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
45 lines (37 loc) · 1.24 KB
/
build.py
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
import asyncio
from json import load
from textwrap import dedent
repos = load(open("./repos.json", "r", encoding="utf-8"))
async def run_project(project, script):
proc = await asyncio.create_subprocess_shell(f"cd {project}\n{script}",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
stdout, stderr = await proc.communicate()
print(f"[{project} exited with {proc.returncode}]")
if stdout:
print(f"[{project}] stdout:\n{stdout.decode()}")
if stderr:
print(f"[{project}] stdout:\n{stderr.decode()}")
async def gradlew(project):
# TODO: this needs to be done in a better way
await run_project(project, dedent(f"""
chmod +x gradlew
./gradlew publishToMavenLocal || \\
./gradlew install || \\
./gradlew installDebug || \\
./gradlew publishReleasePublicationToMavenLocal
"""))
async def maven(project):
await run_project(project, dedent(f"""
mvn install -DskipTests
"""))
async def main():
jobs = []
jobs.extend([
gradlew(repo) for repo in repos["gradlew"]
])
jobs.extend([
maven(repo) for repo in repos["maven"]
])
await asyncio.gather(*jobs)
asyncio.run(main())