Commit bc68adfa by sikang

update script

parent 930a4cb0
......@@ -5,7 +5,7 @@ class ClassBuilder:
__used_names = []
__variables = []
__functions = []
__class_name = ""
def __gen_rand_str(self):
result = ""
while len(result) == 0 or result in self.__used_names:
......@@ -85,10 +85,10 @@ class ClassBuilder:
log_code = ""
for i in range(0, random.randint(0, 5)):
log_code += "Log.%s(\"%s\");\n" % (
log_code += "Log.%s(\"%s\",\"%s\");\n" % (
self.__class_name,
''.join(random.sample("idew", random.randint(1, 1))),
''.join(random.sample(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", random.randint(5, 15)))
''.join(random.sample("ABCDEFGHIJKLMNOPQRSTUVWXYZ", random.randint(5, 15)))
)
fun_content = fun_content.replace(
......@@ -116,6 +116,7 @@ class ClassBuilder:
def new_class(self,class_name,pkg_name):
self.__class_name = class_name
self.__generate_variable()
self.__generate_function("tools/garbel/model/function_model.java")
class_content = self.__generate_class("tools/garbel/model/activity_model.java")
......
......@@ -19,8 +19,8 @@ class ManifestGarble:
for root, dirs, files in os.walk(path):
if len(files) > 0:
for i in range(0,random.randint(3,10)):
act_path = "%s/%s.java"%(root,self.__gen_rand_str())
act_name = self.__gen_rand_str()
act_path = "%s/%s.java"%(root, act_name)
pkg_name = root.split("main/java/")[1].replace("/",".")
act_content = ClassBuilder().new_class(act_name,pkg_name)
with open(act_path, "w+", encoding="utf-8") as fout:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment