72 with open(os.path.join(THIS_DIR, 'files.json')) as f:
73 dependencies = json.load(f)
74
75 parser = argparse.ArgumentParser(description='Generate the POM file for the engine artifacts')
76 parser.add_argument(
77 '--engine-artifact-id',
78 type=utf8,
79 required=True,
80 help='The artifact id. e.g. android_arm_release'
81 )
82 parser.add_argument('--engine-version', type=utf8, required=True, help='The engine commit hash')
83 parser.add_argument(
84 '--destination', type=utf8, required=True, help='The destination directory absolute path'
85 )
86 parser.add_argument(
87 '--include-embedding-dependencies',
88 type=bool,
89 help='Include the dependencies for the embedding'
90 )
91
92 args = parser.parse_args()
93 engine_artifact_id = args.engine_artifact_id
94 engine_version = args.engine_version
95 artifact_version = '1.0.0-' + engine_version
96 out_file_name = '%s.pom' % engine_artifact_id
97
98 pom_dependencies = ''
99 if args.include_embedding_dependencies:
100 for dependency in dependencies:
101 if not dependency['provides']:
102
103 continue
104 group_id, artifact_id, version = dependency['maven_dependency'].split(':')
105 pom_dependencies += POM_DEPENDENCY.format(group_id, artifact_id, version)
106
107
108 with open(os.path.join(args.destination, out_file_name), 'w') as f:
109 f.write(POM_FILE_CONTENT.format(engine_artifact_id, artifact_version, pom_dependencies))
110
111
112 with open(os.path.join(args.destination, '%s.maven-metadata.xml' % engine_artifact_id), 'w') as f:
113 timestamp = datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S")
114 f.write(MAVEN_METADATA_CONTENT.format(engine_artifact_id, artifact_version, timestamp))
115
116