chiark / gitweb /
Fix ant builds with recent output changes
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 2 Sep 2013 21:14:12 +0000 (23:14 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 2 Sep 2013 21:14:12 +0000 (23:14 +0200)
fdroidserver/build.py

index d1b6039dc5399ade37b9c5d1e48a43810c9e2477..677579ff834f9f26e770c2fd9e24ee1df39aacc9 100644 (file)
@@ -440,7 +440,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
         if 'mvnflags' in thisbuild:
             mvncmd += thisbuild['mvnflags']
 
-        p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         for line in p.stdout.readlines():
             if verbose:
                 # Output directly to console
@@ -490,7 +490,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
         if verbose:
             print "Running %s on %s" % (" ".join(commands), gradle_dir)
 
-        p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         for line in p.stdout.readlines():
             if verbose:
                 # Output directly to console
@@ -500,14 +500,20 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
 
     else:
         print "Building Ant project..."
+        antcommands = ['ant']
         if install:
-            antcommands = ['debug','install']
+            antcommands += ['debug','install']
         elif 'antcommand' in thisbuild:
-            antcommands = [thisbuild['antcommand']]
+            antcommands += [thisbuild['antcommand']]
         else:
-            antcommands = ['release']
-        p = subprocess.Popen(['ant'] + antcommands, cwd=root_dir, 
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            antcommands += ['release']
+        p = subprocess.Popen(antcommands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        for line in p.stdout.readlines():
+            if verbose:
+                # Output directly to console
+                sys.stdout.write(line)
+                sys.stdout.flush()
+            output += line
     _, error = p.communicate()
     if p.returncode != 0:
         raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())