Skip to content

Commit 17a0875

Browse files
committed
Scripts modified
1 parent eada656 commit 17a0875

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Diff for: Scripts_Data/Build/BuildProjects.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ def build(*args):
2323
#return subprocess.check_output(['mvn'] + list(args),shell=True)
2424

2525
#https://coderwall.com/p/tjc9oa/for-those-who-build-multiple-maven-projects-at-once
26-
def mvnbuild(dir):
27-
os.chdir(dir)
26+
def mvnbuild(cdir):
27+
cwd=os.getcwd()
28+
os.chdir(cdir)
2829
process = subprocess.Popen(
2930
#"mvn clean install -DskipTests=true"
3031
"mvn clean install",
@@ -34,6 +35,7 @@ def mvnbuild(dir):
3435
#log(out, dir)
3536
#print(out)
3637
errcode = process.returncode
38+
os.chdir(cwd)
3739
return (out, err, errcode)
3840

3941

@@ -44,26 +46,26 @@ def mvnbuild(dir):
4446
print(" Plese provide proper arguments in the form python BuildProjects <FOLDE PATH where projects are cloned <MAVEN command to run>")
4547

4648

47-
projectstobuild=os.listdir(clonedprojectfolder)
49+
projectstobuild=[ i for i in os.listdir(clonedprojectfolder) if(os.path.isdir(os.path.join(clonedprojectfolder+i)))]
4850
logfile=open('Build_log_'+str(datetime.datetime.now()),'a')
4951

5052
print("Processing projects in folder ::" + clonedprojectfolder)
5153
projcount=len(projectstobuild)
5254
failedprojcount=0
5355
processedprojcount=0
54-
#print("Total projects to build "+ str(projcount))
56+
print("Total projects to build "+ str(projcount))
5557
#logfile.write("Total projects to build "+ str(projcount)+"\n")
5658

5759

58-
for dir in projectstobuild:
59-
path=dir
60+
for p in projectstobuild:
61+
path=p
6062
fullpath=os.path.join(clonedprojectfolder+path)
6163
#print(fullpath)
6264
if(os.path.isdir(fullpath)):
6365
currfilelog=open('path.log','a')
6466
try:
6567
#https://stackoverflow.com/questions/21377520/do-a-maven-build-in-a-python-script
66-
if(not(dir.startswith('.'))):
68+
if(not(p.startswith('.'))):
6769
print("Procesiing " + path)
6870
opofbuild=mvnbuild(fullpath)
6971
if("BUILD SUCCESS" in opofbuild[0]):
@@ -72,6 +74,7 @@ def mvnbuild(dir):
7274
else:
7375
print("Build failed for project " + path+"\n")
7476
logfile.write("Build failed for project " + path+"\n")
77+
#logfile..write(op)
7578
'''
7679
with changeDir(fullpath):
7780
# ****** NOTE ******: using shell=True is strongly discouraged since it possesses security risks

0 commit comments

Comments
 (0)