ccgo 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccgo-1.0.0/LICENSE +25 -0
- ccgo-1.0.0/PKG-INFO +31 -0
- ccgo-1.0.0/README.md +8 -0
- ccgo-1.0.0/ccgo/__init__.py +0 -0
- ccgo-1.0.0/ccgo/cli.py +79 -0
- ccgo-1.0.0/ccgo/commands/__init__.py +0 -0
- ccgo-1.0.0/ccgo/commands/build.py +83 -0
- ccgo-1.0.0/ccgo/commands/help.py +57 -0
- ccgo-1.0.0/ccgo/commands/lib.py +71 -0
- ccgo-1.0.0/ccgo/commands/publish.py +72 -0
- ccgo-1.0.0/ccgo/main.py +33 -0
- ccgo-1.0.0/ccgo/ops/__init__.py +0 -0
- ccgo-1.0.0/ccgo/utils/__init__.py +0 -0
- ccgo-1.0.0/ccgo/utils/cmd/__init__.py +0 -0
- ccgo-1.0.0/ccgo/utils/cmd/cmd_util.py +48 -0
- ccgo-1.0.0/ccgo/utils/context/__init__.py +0 -0
- ccgo-1.0.0/ccgo/utils/context/command.py +38 -0
- ccgo-1.0.0/ccgo/utils/context/context.py +26 -0
- ccgo-1.0.0/ccgo/utils/context/namespace.py +27 -0
- ccgo-1.0.0/ccgo/utils/context/result.py +45 -0
- ccgo-1.0.0/ccgo.egg-info/PKG-INFO +31 -0
- ccgo-1.0.0/ccgo.egg-info/SOURCES.txt +27 -0
- ccgo-1.0.0/ccgo.egg-info/dependency_links.txt +1 -0
- ccgo-1.0.0/ccgo.egg-info/entry_points.txt +2 -0
- ccgo-1.0.0/ccgo.egg-info/not-zip-safe +1 -0
- ccgo-1.0.0/ccgo.egg-info/requires.txt +2 -0
- ccgo-1.0.0/ccgo.egg-info/top_level.txt +1 -0
- ccgo-1.0.0/setup.cfg +4 -0
- ccgo-1.0.0/setup.py +54 -0
ccgo-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
ccgo project is licensed for use as follows:
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
MIT License
|
|
5
|
+
|
|
6
|
+
Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to
|
|
10
|
+
deal in the Software without restriction, including without limitation the
|
|
11
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
12
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
IN THE SOFTWARE.
|
|
25
|
+
"""
|
ccgo-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ccgo
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A C++ cross-platform build system.
|
|
5
|
+
Home-page: https://github.com/zhlinh/ccgo
|
|
6
|
+
Author: zhlinh
|
|
7
|
+
Author-email: zhlinhng@gmail.com
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: copier>=9.2.0
|
|
22
|
+
Requires-Dist: copier-templates-extensions>=0.3.0
|
|
23
|
+
|
|
24
|
+
## ccgo
|
|
25
|
+
|
|
26
|
+
c++ cross-platform build system used to fasten your development.
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
ccgo is available under the [MIT license](https://opensource.org/license/MIT).
|
|
31
|
+
See the LICENSE file for the full license text.
|
ccgo-1.0.0/README.md
ADDED
|
File without changes
|
ccgo-1.0.0/ccgo/cli.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import importlib
|
|
15
|
+
import argparse
|
|
16
|
+
# setup path
|
|
17
|
+
# >>>>>>>>>>>>>>
|
|
18
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
19
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
20
|
+
sys.path.append(SCRIPT_PATH)
|
|
21
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
22
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
23
|
+
# <<<<<<<<<<<<<<
|
|
24
|
+
# import this project modules
|
|
25
|
+
from utils.context.namespace import CliNameSpace
|
|
26
|
+
from utils.context.context import CliContext
|
|
27
|
+
from utils.context.command import CliCommand
|
|
28
|
+
|
|
29
|
+
# Root Class for Command Line Interface
|
|
30
|
+
class Cli(CliCommand):
|
|
31
|
+
def description(self) -> str:
|
|
32
|
+
return """
|
|
33
|
+
This is the CCGO Build System.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def get_command_list(self) -> list:
|
|
37
|
+
arr = []
|
|
38
|
+
for command in os.listdir(os.path.join(SCRIPT_PATH, "commands")):
|
|
39
|
+
if not command.startswith("_") and command.endswith(".py"):
|
|
40
|
+
arr.append(os.path.splitext(os.path.basename(command))[0])
|
|
41
|
+
return arr
|
|
42
|
+
|
|
43
|
+
def cli(self) -> CliNameSpace:
|
|
44
|
+
parser = argparse.ArgumentParser(
|
|
45
|
+
prog="CCGO",
|
|
46
|
+
formatter_class = argparse.RawDescriptionHelpFormatter,
|
|
47
|
+
description=self.description(),
|
|
48
|
+
)
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
'subcommand', metavar=f"{self.get_command_list()}",
|
|
51
|
+
type=str, choices=self.get_command_list(),
|
|
52
|
+
)
|
|
53
|
+
# parse only known args
|
|
54
|
+
args, unknown = parser.parse_known_args()
|
|
55
|
+
return args
|
|
56
|
+
|
|
57
|
+
def exec(self, context: CliContext, args: CliNameSpace):
|
|
58
|
+
print(vars(args))
|
|
59
|
+
# get module name
|
|
60
|
+
module_name = f"commands.{args.subcommand}"
|
|
61
|
+
# get class name
|
|
62
|
+
class_name = args.subcommand.capitalize()
|
|
63
|
+
# import module
|
|
64
|
+
module = importlib.import_module(module_name)
|
|
65
|
+
# get class of module
|
|
66
|
+
klass = getattr(module, class_name)
|
|
67
|
+
# instance class
|
|
68
|
+
sub_cmd = klass()
|
|
69
|
+
# now execute the subcommand
|
|
70
|
+
sub_cmd.exec(CliContext(), sub_cmd.cli())
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def main():
|
|
74
|
+
cmd = Cli()
|
|
75
|
+
cmd.exec(CliContext(), cmd.cli())
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
main()
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import argparse
|
|
15
|
+
import subprocess
|
|
16
|
+
from copier import run_copy
|
|
17
|
+
# setup path
|
|
18
|
+
# >>>>>>>>>>>>>>
|
|
19
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
20
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
21
|
+
sys.path.append(SCRIPT_PATH)
|
|
22
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
23
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
24
|
+
# <<<<<<<<<<<<<
|
|
25
|
+
# import this project modules
|
|
26
|
+
from utils.context.namespace import CliNameSpace
|
|
27
|
+
from utils.context.context import CliContext
|
|
28
|
+
from utils.context.command import CliCommand
|
|
29
|
+
from utils.cmd.cmd_util import exec_command
|
|
30
|
+
|
|
31
|
+
class Build(CliCommand):
|
|
32
|
+
def description(self) -> str:
|
|
33
|
+
return """
|
|
34
|
+
This is a subcommand to build a library.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def get_target_list(self) -> list:
|
|
38
|
+
return [
|
|
39
|
+
"android", "ios", "windows",
|
|
40
|
+
"linux", "macos",
|
|
41
|
+
"tests", "benches"
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
def cli(self) -> CliNameSpace:
|
|
45
|
+
parser = argparse.ArgumentParser(
|
|
46
|
+
# 获取文件名
|
|
47
|
+
prog=os.path.basename(__file__),
|
|
48
|
+
formatter_class = argparse.RawDescriptionHelpFormatter,
|
|
49
|
+
description=self.description(),
|
|
50
|
+
)
|
|
51
|
+
parser.add_argument(
|
|
52
|
+
'target',
|
|
53
|
+
metavar=f"{self.get_target_list()}",
|
|
54
|
+
type=str,
|
|
55
|
+
choices=self.get_target_list(),
|
|
56
|
+
)
|
|
57
|
+
parser.add_argument(
|
|
58
|
+
"--ide-project",
|
|
59
|
+
action="store",
|
|
60
|
+
help="generate ide project",
|
|
61
|
+
)
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
"--arch",
|
|
64
|
+
action="store",
|
|
65
|
+
default="arm64-v8a",
|
|
66
|
+
help="arch like armeabi-v7a, arm64-v8a, x86_64, etc",
|
|
67
|
+
)
|
|
68
|
+
module_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
69
|
+
input_argv = [x for x in sys.argv[1:] if x != module_name]
|
|
70
|
+
args, unknown = parser.parse_known_args(input_argv)
|
|
71
|
+
return args
|
|
72
|
+
|
|
73
|
+
def exec(self, context: CliContext, args: CliNameSpace):
|
|
74
|
+
print("Building library, with configuration...")
|
|
75
|
+
print(vars(args))
|
|
76
|
+
num = 2 if args.ide_project else 1
|
|
77
|
+
arch = args.arch if args.target == "android" else ""
|
|
78
|
+
cmd = f"python3 build_{args.target}.py {num} {arch}"
|
|
79
|
+
print("\nExecute command:")
|
|
80
|
+
print(cmd)
|
|
81
|
+
err_code = os.system(cmd)
|
|
82
|
+
sys.exit(err_code)
|
|
83
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import argparse
|
|
15
|
+
from copier import run_copy
|
|
16
|
+
# setup path
|
|
17
|
+
# >>>>>>>>>>>>>>
|
|
18
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
19
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
20
|
+
sys.path.append(SCRIPT_PATH)
|
|
21
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
22
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
23
|
+
# <<<<<<<<<<<<<
|
|
24
|
+
# import this project modules
|
|
25
|
+
from utils.context.namespace import CliNameSpace
|
|
26
|
+
from utils.context.context import CliContext
|
|
27
|
+
from utils.context.command import CliCommand
|
|
28
|
+
from utils.cmd.cmd_util import exec_command
|
|
29
|
+
|
|
30
|
+
class Help(CliCommand):
|
|
31
|
+
def description(self) -> str:
|
|
32
|
+
return """
|
|
33
|
+
This is a subcommand to show help.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def cli(self) -> CliNameSpace:
|
|
37
|
+
parser = argparse.ArgumentParser(
|
|
38
|
+
# 获取文件名
|
|
39
|
+
prog=os.path.basename(__file__),
|
|
40
|
+
formatter_class = argparse.RawDescriptionHelpFormatter,
|
|
41
|
+
description=self.description(),
|
|
42
|
+
)
|
|
43
|
+
module_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
44
|
+
input_argv = [x for x in sys.argv[1:] if x != module_name]
|
|
45
|
+
args, unknown = parser.parse_known_args(input_argv)
|
|
46
|
+
return args
|
|
47
|
+
|
|
48
|
+
def exec(self, context: CliContext, args: CliNameSpace):
|
|
49
|
+
# show help
|
|
50
|
+
print("\n1. create a library project")
|
|
51
|
+
print("\nccgo lib create LibName --template-url TemplateUrl")
|
|
52
|
+
print("\n2. build a library")
|
|
53
|
+
print("\nccgo build android --arch armeabi-v7a,arm64-v8a,x86_64")
|
|
54
|
+
print("\nccgo build ios")
|
|
55
|
+
print("\n")
|
|
56
|
+
|
|
57
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import argparse
|
|
15
|
+
from copier import run_copy
|
|
16
|
+
from copier import run_recopy
|
|
17
|
+
# setup path
|
|
18
|
+
# >>>>>>>>>>>>>>
|
|
19
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
20
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
21
|
+
sys.path.append(SCRIPT_PATH)
|
|
22
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
23
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
24
|
+
# <<<<<<<<<<<<<
|
|
25
|
+
# import this project modules
|
|
26
|
+
from utils.context.namespace import CliNameSpace
|
|
27
|
+
from utils.context.context import CliContext
|
|
28
|
+
from utils.context.command import CliCommand
|
|
29
|
+
|
|
30
|
+
class Lib(CliCommand):
|
|
31
|
+
def description(self) -> str:
|
|
32
|
+
return """
|
|
33
|
+
This is a subcommand to create a library project.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def get_target_list(self) -> list:
|
|
37
|
+
return ["create"]
|
|
38
|
+
|
|
39
|
+
def cli(self) -> CliNameSpace:
|
|
40
|
+
parser = argparse.ArgumentParser(
|
|
41
|
+
# 获取文件名
|
|
42
|
+
prog=os.path.basename(__file__),
|
|
43
|
+
formatter_class = argparse.RawDescriptionHelpFormatter,
|
|
44
|
+
description=self.description(),
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
'target',
|
|
48
|
+
metavar=f"{self.get_target_list()}",
|
|
49
|
+
type=str,
|
|
50
|
+
choices=self.get_target_list(),
|
|
51
|
+
)
|
|
52
|
+
parser.add_argument('dst_dir')
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--template-url",
|
|
55
|
+
action="store",
|
|
56
|
+
help="template url",
|
|
57
|
+
)
|
|
58
|
+
module_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
59
|
+
input_argv = [x for x in sys.argv[1:] if x != module_name]
|
|
60
|
+
args, unknown = parser.parse_known_args(input_argv)
|
|
61
|
+
return args
|
|
62
|
+
|
|
63
|
+
def exec(self, context: CliContext, args: CliNameSpace):
|
|
64
|
+
print("Creating library project, with configuration...")
|
|
65
|
+
print(vars(args))
|
|
66
|
+
if os.path.exists(args.dst_dir):
|
|
67
|
+
# directory exists, recopy
|
|
68
|
+
run_recopy(args.dst_dir, unsafe=True)
|
|
69
|
+
else:
|
|
70
|
+
run_copy(args.template_url, args.dst_dir, unsafe=True)
|
|
71
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import argparse
|
|
15
|
+
# setup path
|
|
16
|
+
# >>>>>>>>>>>>>>
|
|
17
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
18
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(SCRIPT_PATH)
|
|
20
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
21
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
22
|
+
# <<<<<<<<<<<<<
|
|
23
|
+
# import this project modules
|
|
24
|
+
from utils.context.namespace import CliNameSpace
|
|
25
|
+
from utils.context.context import CliContext
|
|
26
|
+
from utils.context.command import CliCommand
|
|
27
|
+
from utils.cmd.cmd_util import exec_command
|
|
28
|
+
|
|
29
|
+
class Publish(CliCommand):
|
|
30
|
+
def description(self) -> str:
|
|
31
|
+
return """
|
|
32
|
+
This is a subcommand to publish the library to maven repository.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def get_target_list(self) -> list:
|
|
36
|
+
return [
|
|
37
|
+
"android", "ios", "windows",
|
|
38
|
+
"linux", "macos",
|
|
39
|
+
"tests", "benches"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
def cli(self) -> CliNameSpace:
|
|
43
|
+
parser = argparse.ArgumentParser(
|
|
44
|
+
# 获取文件名
|
|
45
|
+
prog=os.path.basename(__file__),
|
|
46
|
+
formatter_class = argparse.RawDescriptionHelpFormatter,
|
|
47
|
+
description=self.description(),
|
|
48
|
+
)
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
'target',
|
|
51
|
+
metavar=f"{self.get_target_list()}",
|
|
52
|
+
type=str,
|
|
53
|
+
choices=self.get_target_list(),
|
|
54
|
+
)
|
|
55
|
+
module_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
56
|
+
input_argv = [x for x in sys.argv[1:] if x != module_name]
|
|
57
|
+
args, unknown = parser.parse_known_args(input_argv)
|
|
58
|
+
return args
|
|
59
|
+
|
|
60
|
+
def exec(self, context: CliContext, args: CliNameSpace):
|
|
61
|
+
print("Publishing library project, with configuration...")
|
|
62
|
+
print(vars(args))
|
|
63
|
+
if args.target != "android":
|
|
64
|
+
print("\nPublishing only support maven of android now")
|
|
65
|
+
sys.exit(1)
|
|
66
|
+
# do publish
|
|
67
|
+
cmd = f"./gradlew publishMainPublicationToMavenRepository"
|
|
68
|
+
err_code, err_msg = exec_command(cmd)
|
|
69
|
+
if err_code != 0:
|
|
70
|
+
print("\nEnd with error:")
|
|
71
|
+
print(err_msg)
|
|
72
|
+
|
ccgo-1.0.0/ccgo/main.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
# setup path
|
|
15
|
+
# >>>>>>>>>>>>>>
|
|
16
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
17
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
18
|
+
sys.path.append(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
20
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
21
|
+
# <<<<<<<<<<<<<<
|
|
22
|
+
# import this project module
|
|
23
|
+
from cli import Cli
|
|
24
|
+
from utils.context.context import CliContext
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def main():
|
|
28
|
+
cmd = Cli()
|
|
29
|
+
cmd.exec(CliContext(), cmd.cli())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import subprocess
|
|
13
|
+
import time
|
|
14
|
+
from threading import Timer
|
|
15
|
+
|
|
16
|
+
DEFAULT_TIMEOUT_SECOND = 10
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def exec_command(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT):
|
|
20
|
+
# timeout is 3 hours
|
|
21
|
+
return exec_command_with_timeout_second(command, 3 * 3600)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def exec_command_with_timeout_second(command,
|
|
25
|
+
timeout_second=DEFAULT_TIMEOUT_SECOND,
|
|
26
|
+
stdout=subprocess.PIPE,
|
|
27
|
+
stderr=subprocess.STDOUT):
|
|
28
|
+
start_mills = int(time.time() * 1000)
|
|
29
|
+
# default timeout is 10 second
|
|
30
|
+
compile_popen = subprocess.Popen(
|
|
31
|
+
command, shell=True, stdout=stdout, stderr=stderr,
|
|
32
|
+
)
|
|
33
|
+
timer = Timer(timeout_second, lambda process: process.kill(), [compile_popen])
|
|
34
|
+
try:
|
|
35
|
+
timer.start()
|
|
36
|
+
stdout, stderr = compile_popen.communicate()
|
|
37
|
+
finally:
|
|
38
|
+
timer.cancel()
|
|
39
|
+
err_code = compile_popen.returncode
|
|
40
|
+
err_msg = bytes.decode(stdout, "UTF-8")
|
|
41
|
+
if err_code == -9:
|
|
42
|
+
if not err_msg:
|
|
43
|
+
if stderr:
|
|
44
|
+
err_msg = bytes.decode(stderr, "UTF-8")
|
|
45
|
+
if not err_msg:
|
|
46
|
+
use_time = int(time.time() * 1000) - start_mills
|
|
47
|
+
err_msg = f"Failed for timeout({err_code}), use_time: {use_time}ms"
|
|
48
|
+
return err_code, err_msg
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
# setup path
|
|
15
|
+
# >>>>>>>>>>>>>>
|
|
16
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
17
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
18
|
+
sys.path.append(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
20
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
21
|
+
# <<<<<<<<<<<<<
|
|
22
|
+
# import this project modules
|
|
23
|
+
from .namespace import CliNameSpace
|
|
24
|
+
from .context import CliContext
|
|
25
|
+
from .result import CliResult
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# This Command class is the interface for all commands
|
|
29
|
+
class CliCommand:
|
|
30
|
+
def description(self) -> str:
|
|
31
|
+
raise NotImplementedError
|
|
32
|
+
|
|
33
|
+
def cli(self) -> CliNameSpace:
|
|
34
|
+
raise NotImplementedError
|
|
35
|
+
|
|
36
|
+
def exec(self, context: CliContext, args: CliNameSpace) -> CliResult:
|
|
37
|
+
raise NotImplementedError
|
|
38
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
# setup path
|
|
15
|
+
# >>>>>>>>>>>>>>
|
|
16
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
17
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
18
|
+
sys.path.append(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
20
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
21
|
+
# <<<<<<<<<<<<
|
|
22
|
+
|
|
23
|
+
# This context data class to save the context of the command
|
|
24
|
+
class CliContext:
|
|
25
|
+
def __init__(self):
|
|
26
|
+
self.home_path = None
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
# setup path
|
|
16
|
+
# >>>>>>>>>>>>>>
|
|
17
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
18
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(SCRIPT_PATH)
|
|
20
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
21
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
22
|
+
# <<<<<<<<<<<<
|
|
23
|
+
|
|
24
|
+
# CliNameSpace is a class that inherits from argparse.Namespace
|
|
25
|
+
class CliNameSpace(argparse.Namespace):
|
|
26
|
+
def __init__(self):
|
|
27
|
+
self.home_path = None
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 zhlinh and ccgo Project Authors. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
# setup path
|
|
15
|
+
# >>>>>>>>>>>>>>
|
|
16
|
+
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
|
|
17
|
+
PROJECT_ROOT_PATH = os.path.dirname(SCRIPT_PATH)
|
|
18
|
+
sys.path.append(SCRIPT_PATH)
|
|
19
|
+
sys.path.append(PROJECT_ROOT_PATH)
|
|
20
|
+
PACKAGE_NAME = os.path.basename(SCRIPT_PATH)
|
|
21
|
+
# <<<<<<<<<<<<
|
|
22
|
+
|
|
23
|
+
class CliResult:
|
|
24
|
+
def __init__(self, value=None, error=None):
|
|
25
|
+
self.value = value
|
|
26
|
+
self.error = error
|
|
27
|
+
|
|
28
|
+
def is_success(self):
|
|
29
|
+
return self.error is None
|
|
30
|
+
|
|
31
|
+
def is_failure(self):
|
|
32
|
+
return self.error is not None
|
|
33
|
+
|
|
34
|
+
def get_value(self, default=None):
|
|
35
|
+
if self.is_success():
|
|
36
|
+
return self.value
|
|
37
|
+
else:
|
|
38
|
+
return default
|
|
39
|
+
|
|
40
|
+
def get_error(self, default=None):
|
|
41
|
+
if self.is_failure():
|
|
42
|
+
return self.error
|
|
43
|
+
else:
|
|
44
|
+
return default
|
|
45
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ccgo
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A C++ cross-platform build system.
|
|
5
|
+
Home-page: https://github.com/zhlinh/ccgo
|
|
6
|
+
Author: zhlinh
|
|
7
|
+
Author-email: zhlinhng@gmail.com
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: copier>=9.2.0
|
|
22
|
+
Requires-Dist: copier-templates-extensions>=0.3.0
|
|
23
|
+
|
|
24
|
+
## ccgo
|
|
25
|
+
|
|
26
|
+
c++ cross-platform build system used to fasten your development.
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
ccgo is available under the [MIT license](https://opensource.org/license/MIT).
|
|
31
|
+
See the LICENSE file for the full license text.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
ccgo/__init__.py
|
|
5
|
+
ccgo/cli.py
|
|
6
|
+
ccgo/main.py
|
|
7
|
+
ccgo.egg-info/PKG-INFO
|
|
8
|
+
ccgo.egg-info/SOURCES.txt
|
|
9
|
+
ccgo.egg-info/dependency_links.txt
|
|
10
|
+
ccgo.egg-info/entry_points.txt
|
|
11
|
+
ccgo.egg-info/not-zip-safe
|
|
12
|
+
ccgo.egg-info/requires.txt
|
|
13
|
+
ccgo.egg-info/top_level.txt
|
|
14
|
+
ccgo/commands/__init__.py
|
|
15
|
+
ccgo/commands/build.py
|
|
16
|
+
ccgo/commands/help.py
|
|
17
|
+
ccgo/commands/lib.py
|
|
18
|
+
ccgo/commands/publish.py
|
|
19
|
+
ccgo/ops/__init__.py
|
|
20
|
+
ccgo/utils/__init__.py
|
|
21
|
+
ccgo/utils/cmd/__init__.py
|
|
22
|
+
ccgo/utils/cmd/cmd_util.py
|
|
23
|
+
ccgo/utils/context/__init__.py
|
|
24
|
+
ccgo/utils/context/command.py
|
|
25
|
+
ccgo/utils/context/context.py
|
|
26
|
+
ccgo/utils/context/namespace.py
|
|
27
|
+
ccgo/utils/context/result.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ccgo
|
ccgo-1.0.0/setup.cfg
ADDED
ccgo-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2024 ccgo Project. All rights reserved.
|
|
3
|
+
# Use of this source code is governed by a MIT-style
|
|
4
|
+
# license that can be found at
|
|
5
|
+
#
|
|
6
|
+
# https://opensource.org/license/MIT
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission
|
|
9
|
+
# notice shall be included in all copies or
|
|
10
|
+
# substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
|
|
14
|
+
from setuptools import setup, find_packages
|
|
15
|
+
|
|
16
|
+
ALL_PROGRAM_ENTRIES = ['ccgo = ccgo.main:main']
|
|
17
|
+
|
|
18
|
+
with open("README.md", "r") as f:
|
|
19
|
+
long_description = f.read()
|
|
20
|
+
|
|
21
|
+
setup(
|
|
22
|
+
name='ccgo',
|
|
23
|
+
version='1.0.0',
|
|
24
|
+
description='A C++ cross-platform build system.',
|
|
25
|
+
long_description=long_description,
|
|
26
|
+
author='zhlinh',
|
|
27
|
+
author_email='zhlinhng@gmail.com',
|
|
28
|
+
url='https://github.com/zhlinh/ccgo',
|
|
29
|
+
package_dir={"./": "ccgo"},
|
|
30
|
+
packages=find_packages(),
|
|
31
|
+
include_package_data = True,
|
|
32
|
+
install_requires=[
|
|
33
|
+
"copier>=9.2.0",
|
|
34
|
+
"copier-templates-extensions>=0.3.0",
|
|
35
|
+
],
|
|
36
|
+
classifiers=[
|
|
37
|
+
'Development Status :: 3 - Alpha',
|
|
38
|
+
'Intended Audience :: Developers',
|
|
39
|
+
'License :: OSI Approved :: MIT License',
|
|
40
|
+
'Programming Language :: Python :: 3',
|
|
41
|
+
'Programming Language :: Python :: 3.6',
|
|
42
|
+
'Programming Language :: Python :: 3.7',
|
|
43
|
+
'Programming Language :: Python :: 3.8',
|
|
44
|
+
'Programming Language :: Python :: 3.9',
|
|
45
|
+
'Programming Language :: Python :: Implementation :: CPython',
|
|
46
|
+
"Operating System :: POSIX :: Linux",
|
|
47
|
+
"Operating System :: MacOS :: MacOS X",
|
|
48
|
+
"Operating System :: Microsoft :: Windows"
|
|
49
|
+
],
|
|
50
|
+
zip_safe=False,
|
|
51
|
+
entry_points = {
|
|
52
|
+
'console_scripts': ALL_PROGRAM_ENTRIES
|
|
53
|
+
}
|
|
54
|
+
)
|