forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component_opensearch_min.py
53 lines (44 loc) · 1.75 KB
/
component_opensearch_min.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
from git.git_repository import GitRepository
from manifests_workflow.component import Component
from manifests_workflow.component_opensearch import ComponentOpenSearch
from system.properties_file import PropertiesFile
class ComponentOpenSearchMin(Component):
def __init__(self, repo, snapshot=False):
super().__init__(
"OpenSearch",
repo,
snapshot,
["gradle:publish", "gradle:properties:version"],
)
@classmethod
def branches(self):
return Component.branches("https://github.com/opensearch-project/OpenSearch.git")
@classmethod
def versions(self, work_dir=None):
return Component.versions(
"OpenSearch",
"https://github.com/opensearch-project/OpenSearch.git",
work_dir,
)
@classmethod
def checkout(self, path, branch="main", snapshot=False):
return ComponentOpenSearchMin(
GitRepository("https://github.com/opensearch-project/OpenSearch.git", branch, path),
snapshot,
)
def publish_to_maven_local(self):
cmd = ComponentOpenSearch.gradle_cmd("publishToMavenLocal", {"build.snapshot": str(self.snapshot).lower()})
self.git_repo.execute_silent(cmd)
@property
def properties(self):
cmd = ComponentOpenSearch.gradle_cmd("properties", {"build.snapshot": str(self.snapshot).lower()})
return PropertiesFile(self.git_repo.output(cmd))
@property
def version(self):
self.publish_to_maven_local()
return self.properties.get_value("version")