Changeset View
Changeset View
Standalone View
Standalone View
devel/msbuild/files/dotnet
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/usr/bin/env python | |||||
import codecs | |||||
import json | |||||
from os import environ, makedirs | |||||
from os.path import dirname, isdir, isfile, join | |||||
from sys import argv | |||||
NUGET_CACHE = join(environ["HOME"], ".nuget", "packages") | |||||
LOCK = { | |||||
"version": 2, | |||||
"targets": { | |||||
".NETFramework,Version=v4.6": {}, | |||||
}, | |||||
"libraries": {}, | |||||
"projectFileDependencyGroups": {}, | |||||
"tools": {}, | |||||
"projectFileToolGroups": {}, | |||||
"packageFolders": { | |||||
NUGET_CACHE: {}, | |||||
}, | |||||
} | |||||
def main(argv): | |||||
for arg in argv: | |||||
if arg.endswith("project.json"): | |||||
jsonpath = arg | |||||
lockpath = join(dirname(jsonpath), "project.lock.json") | |||||
if not isfile(lockpath): | |||||
project_json = json.load(codecs.open(jsonpath, "r", "utf-8-sig")) | |||||
depends = {} | |||||
depends.update(project_json.setdefault("dependencies", {})) | |||||
depends.update(project_json["frameworks"]["net46"].setdefault("dependencies", {})) | |||||
for depend, version in depends.items(): | |||||
path = join(NUGET_CACHE, depend, version) | |||||
if not isdir(path): | |||||
makedirs(path) | |||||
with open(lockpath, "w") as lockfile: | |||||
json.dump(LOCK, lockfile) | |||||
if __name__ == "__main__": | |||||
main(argv) |