浏览代码

[subpackage] master-package.json now specifies relative paths to the sub-packages that should be used

/main
Peter Bay Bastian 7 年前
当前提交
0d14ee02
共有 2 个文件被更改,包括 34 次插入16 次删除
  1. 15
      ScriptableRenderPipeline/master-package.json
  2. 35
      subpackage.py

15
ScriptableRenderPipeline/master-package.json


{
"version": "0.1.7",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.3"
}
"version": "0.1.7",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.3"
},
"subPackages": [
"Core",
"HDRenderPipeline",
"LightweightPipeline"
]
}

35
subpackage.py


parser.add_argument("-p", "--publish", action="store_true",
help="DANGER: actually do the publish and then clean-up. if not set, only preparation will be "
"done for inspection purposes")
parser.add_argument("-F", "--filter", default="",
help="only packages containing the specified string will be published")
parser.add_argument("-s", "--silent", action="store_true", help="don't tell me what's going on here")
parser.add_argument("-s", "--silent", action="store_true",
help="don't tell me what's going on here")
args = parser.parse_args()
silent = args.silent
base_folder = os.path.realpath(args.folder)

error_print(e)
exit(1)
potential_folders = master_package["subPackages"] if "subPackages" in master_package else []
for item in os.listdir(base_folder):
for item in potential_folders:
file_path = os.path.join(base_folder, item, "sub-package.json")
if os.path.isfile(file_path):
info_print("Found sub-package file: {}".format(file_path))

sub_packages[sub_package["name"]] = sub_package
sub_package_folders[sub_package["name"]] = os.path.join(base_folder, item)
sub_package_folders[sub_package["name"]
] = os.path.join(base_folder, item)
except json.JSONDecodeError as e:
error_print("Error: {}".format(e))

for i, sub_package in enumerate(sub_packages.values()):
if "subDependencies" in sub_package and sub_package["subDependencies"]:
for dependency in sub_package["subDependencies"]:
dependency_list[dependency][sub_package["name"]] = dependency_list[sub_package["name"]]
dependency_list[dependency][sub_package["name"]
] = dependency_list[sub_package["name"]]
dependency_tree[sub_package["name"]] = dependency_list[sub_package["name"]]
dependency_tree[sub_package["name"]
] = dependency_list[sub_package["name"]]
error_print("Dependency tree is empty. You might have a circular reference.")
error_print(
"Dependency tree is empty. You might have a circular reference.")
exit(1)
def print_dependency_tree(tree, indent):

def fill_publish_order(tree):
for key, sub_tree in tree.items():
if key not in visited:
publish_order.append(key)
if args.filter in key:
publish_order.append(key)
fill_publish_order(sub_tree)
fill_publish_order(dependency_tree)

info_print(" {}:".format(sub_package["name"]))
for sub_dependency in sub_package["subDependencies"]:
sub_package["dependencies"][sub_dependency] = master_package["version"]
info_print(" {}@{}".format(sub_dependency, sub_package["dependencies"][sub_dependency]))
info_print(" {}@{}".format(sub_dependency,
sub_package["dependencies"][sub_dependency]))
del sub_package["subDependencies"]
info_print("")

info_print("Downloading npm config:")
c = HTTPSConnection("staging-packages.unity.com")
auth = b64encode("{}@unity:{}".format(args.username, args.key).encode("ascii")).decode("ascii")
auth = b64encode("{}@unity:{}".format(
args.username, args.key).encode("ascii")).decode("ascii")
for folder in sub_package_folders.values():
for name in publish_order:
folder = sub_package_folders[name]
path = os.path.join(folder, ".npmrc")
with open(path, 'w') as file:
file.write(npm_config)

if not args.dirty:
info_print("Removing temporary files:")
files = []
for folder in sub_package_folders.values():
for name in publish_order:
folder = sub_package_folders[name]
files.append(os.path.join(folder, "package.json"))
files.append(os.path.join(folder, ".npmrc"))
for file in files:

正在加载...
取消
保存