vcs.gotorevision(tag)
# Only process tags where the manifest exists...
- path = common.manifest_path(build_dir, flavour, gradle,
- build_tools, gradle_plugin)
- if path is not None and os.path.exists(path):
+ path = common.manifest_path(build_dir, flavour)
+ if path is not None:
version, vercode, package = common.parse_androidmanifest(path)
print "Manifest exists. Found version %s" % version
if package and package == app['id'] and version and vercode:
if not os.path.isdir(build_dir):
return (None, "Subdir '" + app['builds'][-1]['subdir'] + "'is not a valid directory")
- path = common.manifest_path(build_dir, flavour, gradle, build_tools,
- gradle_plugin)
+ path = common.manifest_path(build_dir, flavour)
if path is None:
- return (None, "Gradle flavour not found")
+ return (None, "No manifest could be found")
version, vercode, package = common.parse_androidmanifest(path)
if not package:
return s.replace("\\'","'")
return ''
-# Find the AM.xml - try the new gradle method first.
-def manifest_path(app_dir, flavour, gradle, build_tools, gradle_plugin):
-
- if flavour is None:
- return os.path.join(app_dir, 'AndroidManifest.xml')
-
- if not os.path.exists(os.path.join(app_dir, 'src', flavour)):
- return None
-
- for line in fileinput.input(os.path.join(app_dir, 'build.gradle'), inplace=True):
- if 'buildToolsVersion' in line:
- print 'buildToolsVersion "%s"' % build_tools,
- elif 'com.android.tools.build:gradle:' in line:
- print "classpath 'com.android.tools.build:gradle:%s'" % gradle_plugin,
- else:
- print line,
-
- subprocess.Popen([gradle, 'process'+flavour+'ReleaseManifest'], cwd=app_dir).communicate()
-
- return os.path.join(app_dir, 'build', 'manifests', flavour, 'release', 'AndroidManifest.xml')
+# Find the AM.xml - try to use new gradle manifest paths
+# TODO: Gradle can use multiple manifests. Return a list of the existing ones
+# and later iterate through them to find the highest vercode.
+def manifest_path(app_dir, flavour):
+
+ root_manifest = os.path.join(app_dir, 'AndroidManifest.xml')
+ if flavour is not None:
+ flavour_manifest = os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml')
+ if os.path.isfile(flavour_manifest):
+ return flavour_manifest
+
+ main_manifest = os.path.join(app_dir, 'src', 'main', 'AndroidManifest.xml')
+ print main_manifest
+ if os.path.isfile(main_manifest):
+ return main_manifest
+
+ if os.path.isfile(root_manifest):
+ return root_manifest
+
+ return None
# Retrieve the package name