Skip to content

Commit

Permalink
Update workspace dir path, write coordinates into workspace
Browse files Browse the repository at this point in the history
Workspace dir is now ~/.jgo/${groupId}/${artifactId}/${version}/hash
Coordinates are written into workspace as coordinates.txt
  • Loading branch information
Kyle Harrington committed Jun 1, 2021
1 parent b4e755a commit ff4e216
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jgo/jgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ def coordinates_from_endpoints(endpoints):


def workspace_dir_from_coordinates(coordinates, cache_dir):
workspace = os.path.join(cache_dir, *coordinates[0])
coord_string = '+'.join(['-'.join(c) for c in coordinates[1:]])
coord_string = '+'.join(['-'.join(c) for c in coordinates])
hash_path = hashlib.sha256(coord_string.encode('utf-8')).hexdigest()
workspace = '+'.join([workspace, hash_path])
workspace = os.path.join(cache_dir, *coordinates[0], hash_path)

return workspace


Expand Down Expand Up @@ -545,6 +545,11 @@ def resolve_dependencies(endpoint_string,

os.makedirs(workspace, exist_ok=True)

# Write a file with the coordinates into the workspace dir
with open(os.path.join(workspace, 'coordinates.txt'), 'w') as f:
for coordinate in coordinates:
f.write(''.join(['+'.join(coordinate)] + ['\n']))

# TODO should this be for all endpoints or only the primary endpoint?
if manage_dependencies:
dependency_management = '<dependency><groupId>{g}</groupId><artifactId>{a}</artifactId><version>{v}</version>'.format(
Expand Down

0 comments on commit ff4e216

Please sign in to comment.