18REPO_URL =
"https://github.com/vektra/mockery.git"
19REPO_DIR =
"mockery_repo"
20BINARY_NAME =
"mockery"
24 """Create the asset."""
29 output = subprocess.check_output([
"git",
"clone", REPO_URL, REPO_DIR])
31 os.chdir(os.path.join(target_dir, REPO_DIR))
32 output = subprocess.check_output([
"git",
"checkout",
"v2.4.0"])
41 output = subprocess.check_output([
"go",
"get",
"golang.org/x/tools@v0.1.10"])
43 output = subprocess.check_output([
"go",
"mod",
"tidy"])
55 ldflags =
"-s -w -X github.com/vektra/mockery/v2/pkg/config.SemVer=2.4.0"
56 build_command = [
"go",
"build",
"-ldflags=\"%s\"" % ldflags]
57 print(
"Building with command:", build_command)
58 output = subprocess.check_output([
"go",
"build",
"-ldflags=" + ldflags])
62 output = subprocess.check_output([
"cp", BINARY_NAME,
".."])
63 shutil.copy(os.path.join(target_dir, REPO_DIR, BINARY_NAME), target_dir)
64 shutil.rmtree(os.path.join(target_dir, REPO_DIR))
69 parser = argparse.ArgumentParser()
70 parser.add_argument(
'--target_dir',
'-t', required=
True)
71 args = parser.parse_args()
75if __name__ ==
'__main__':
def create_asset(target_dir)
def print(*args, **kwargs)