chiark / gitweb /
Some build and update system improvements, including the ability to set javac encoding
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 26 Jan 2011 16:02:30 +0000 (16:02 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 26 Jan 2011 16:02:30 +0000 (16:02 +0000)
README
build.py
metadata.py
update.py

diff --git a/README b/README
index b04f183cf83a1f29695f3fb47aeb6572f4905c3f..334b8225c6a4508874497015b8a69ef5c9f74039 100644 (file)
--- a/README
+++ b/README
@@ -164,6 +164,11 @@ configuration to the build. These are:
  submodules=yes    Use if the project (git only) has submodules - causes git
                   submodule init and update to be executed after the source is
                   cloned.
+ encoding=xxxx     Adds a java.encoding property to local.properties with the given
+                   value. Generally the value will be 'utf-8'. This is picked up by
+                  the SDK's ant rules, and forces the Java compiler to interpret
+                  source files with this encoding. If you receive warnings during
+                  the compile about character encodings, you probably need this.
 
 Another example, using extra parameters:
 
index 2710491b1f7a4934b7bbababb7281e63345a7903..3f4bb3dc37a2d7a5773e16a0f3d731577b312983 100644 (file)
--- a/build.py
+++ b/build.py
@@ -222,6 +222,9 @@ for app in apps:
                         props += "\nsdk-location=" + sdkloc + "\n"
                     # Add ndk location...
                     props+= "\nndk.dir=" + ndk_path + "\n"
+                    # Add java.encoding if necessary...
+                    if thisbuild.has_key('encoding'):
+                        props += "\njava.encoding=" + thisbuild['encoding'] + "\n"
                     f = open(locprops, 'w')
                     f.write(props)
                     f.close()
@@ -246,8 +249,8 @@ for app in apps:
 
                 # Run a pre-build command if one is required...
                 if thisbuild.has_key('prebuild'):
-                    if subprocess.call(shlex.split(thisbuild['prebuild']),
-                            cwd=root_dir) != 0:
+                    if subprocess.call(thisbuild['prebuild'],
+                            cwd=root_dir, shell=True) != 0:
                         print "Error running pre-build command"
                         sys.exit(1)
 
index 2d3d3cf49251aabfeb75eff59c9dbf5829cc70e4..8bf114f8555471a9509d037c0149ddcf3bcd5e6f 100644 (file)
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-def read_metadata():
+def read_metadata(verbose=False):
 
     apps = []
 
@@ -26,7 +26,8 @@ def read_metadata():
 
         # Get metadata...
         thisinfo['id'] = metafile[9:-4]
-        print "Reading metadata for " + thisinfo['id']
+        if verbose:
+            print "Reading metadata for " + thisinfo['id']
         thisinfo['description'] = ''
         thisinfo['name'] = None
         thisinfo['summary'] = ''
@@ -82,7 +83,7 @@ def read_metadata():
                                 part != "Tracking" and
                                 part != "NonFreeNet" and
                                 part != "NonFreeAdd"):
-                                print "Unrecognised antifeature '" + part + "'"
+                                print "Unrecognised antifeature '" + part + "' in "+ metafile
                                 sys.exit(1)
                         thisinfo['antifeatures'] = value
                     elif field == 'Market Version':
@@ -96,7 +97,7 @@ def read_metadata():
                     elif field == 'Build Version':
                         parts = value.split(",")
                         if len(parts) < 3:
-                            print "Invalid build format: " + value
+                            print "Invalid build format: " + value + " in " + metafile
                             sys.exit(1)
                         thisbuild = {}
                         thisbuild['version'] = parts[0]
@@ -110,7 +111,7 @@ def read_metadata():
                         if value == "Yes":
                             thisinfo['usebuilt'] = True
                     else:
-                        print "Unrecognised field " + field
+                        print "Unrecognised field " + field + " in " + metafile
                         sys.exit(1)
                 elif mode == 1:
                     if line == '.':
@@ -125,7 +126,7 @@ def read_metadata():
                             thisinfo['description'] += line
 
         if mode == 1:
-            print "Description not terminated"
+            print "Description not terminated in " + metafile
             sys.exit(1)
         if len(thisinfo['description']) == 0:
             thisinfo['description'] = 'No description available'
index a840479496cc977fbc336a8e3e054a3a36a8b1ca..2285a68aed1c540cc19daa0dfb58198ff615881d 100644 (file)
--- a/update.py
+++ b/update.py
@@ -42,6 +42,8 @@ parser.add_option("-c", "--createmeta", action="store_true", default=False,
                   help="Create skeleton metadata files that are missing")
 parser.add_option("-v", "--verbose", action="store_true", default=False,
                   help="Spew out even more information than normal")
+parser.add_option("-q", "--quiet", action = "store_true", default=False,
+                  help="No output, except for warnings and errors")
 parser.add_option("-b", "--buildreport", action="store_true", default=False,
                   help="Report on build data status")
 (options, args) = parser.parse_args()
@@ -64,13 +66,14 @@ if (repo_url is None or repo_name is None or
     sys.exit(1)
 
 # Get all apps...
-apps = read_metadata()
+apps = read_metadata(verbose=options.verbose)
 
 # Copy apks and source tarballs for stuff we've built from source that
 # is flagged to be included in the repo...
 for app in apps:
     if app['usebuilt']:
-        print "Copying built files for " + app['id']
+        if not options.quiet:
+            print "Copying built files for " + app['id']
         src = os.path.join('built', app['id'] + "_*")
         for file in glob.glob(src):
             shutil.copy(file, 'repo/')
@@ -81,7 +84,8 @@ for apkfile in glob.glob(os.path.join('repo','*.apk')):
 
     apkfilename = apkfile[5:]
 
-    print "Processing " + apkfilename
+    if not options.quiet:
+        print "Processing " + apkfilename
     thisinfo = {}
     thisinfo['apkname'] = apkfilename
     thisinfo['size'] = os.path.getsize(apkfile)