Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more compiler fixes

  • Loading branch information...
commit 9ef9b82e0f48788345433d6ff1647eb27db488ba 1 parent 6234b04
@jhaynie jhaynie authored
View
27 CREDITS
@@ -0,0 +1,27 @@
+Appcelerator Titanium is made possible by a number of contributors.
+
+We would like to thank the following for their contributions:
+
+- Jeff Haynie
+- Nolan Wright
+- Marshall Culpepper
+- Don Thorp
+- Martin Robinson
+- Tyrus Smalley
+- Kevin Whinnery
+- Blain Hamon
+- Rob Brackett
+- Nika Jones
+- Steve Tramer
+- Bill Dawson
+- Josh Roesslein
+- Ben Ramsey
+
+
+If you're interested in contributing to Titanium, please let us know
+by emailing info@appcelerator.com. Or, better yet, fork the Github
+project at start hacking away and let us know!
+
+In addition to the awesome contributors above, we also use a number
+of third-party open source bits. Please see the source code for
+more details and license information.
View
18 README.md
@@ -25,15 +25,14 @@ Titanium writes native code so you don't have to. :)
- Native apps built using web technologies
- Apps are compiled and run locally (offline available)
- Full support for HTML5 and CSS3
-- Ability to mix and match native UI controls with HTML controls (hybrid UIs)
- Support for all native platform UI controls
- Third-party JavaScript support such as jQuery, Dojo, etc.
- Support for in-application SQL database
- Support for Geolocation (compass, geolocation, forward/reverse lookup)
- Support for Camera (taking Photos, playing and recording Video)
- Support for Photo Album (reading and writing)
-- Support for Contacts Database
-- Support for Streaming Audio
+- Support for Contacts Database / Address Book
+- Support for Streaming Audio and Recording Audio, Audio Input Levels, Mic etc
- Support for Vibration
- Support for Social APIs such as Facebook Connect, Twitter, etc
- Support for Yahoo YQL
@@ -56,21 +55,15 @@ Getting Help
There are a number of ways to get help with Titanium.
-### Documentation Wiki
+### Developer Community
-[Codestrong.com](http://www.codestrong.com) is our developer documentation wiki.
+[Appcelerator Developer](http://developer.appcelerator.com) is our developer community.
### Video Tutorials
[Appcelerator Videos](http://www.vimeo.com/appcelerator) is our main video channel
for video tutorials on Titanium.
-### Community Support Forums
-
-[Community Support Forums](http://support.appcelerator.net) are availabel for
-get help from Appcelerator and the community or to share information about
-Titanium development.
-
### IRC
Titanium developers regularly visit `#titanium_app` on irc.freenode.net.
@@ -82,7 +75,8 @@ team for updates.
### Blog
-The Appcelerator blog is called [Appcelerant](http://www.appcelerant.com).
+The Appcelerator corporate blog is called [Appcelerant](http://www.appcelerant.com).
+The Appcelerator developer blog is located at (http://developer.appcelerator.com/blog).
### Commercial Support, Licensing
View
2  iphone/Classes/KrollContext.mm
@@ -170,9 +170,9 @@ -(void)invoke:(KrollContext*)context
{
id excm = [KrollObject toID:context value:exception];
NSLog(@"[ERROR] Script Error = %@",[TiUtils exceptionMessage:excm]);
+ fflush(stderr);
}
- fflush(stderr);
TiStringRelease(js);
}
View
2  iphone/Classes/TiUITextField.h
@@ -4,6 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
+#ifdef USE_TI_UITEXTFIELD
#import "TiUITextWidget.h"
@@ -40,3 +41,4 @@
@end
+#endif
View
4 iphone/Classes/TiUITextField.m
@@ -4,6 +4,8 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
+#ifdef USE_TI_UITEXTFIELD
+
#import "TiUITextField.h"
#import "TiUITextFieldProxy.h"
@@ -492,3 +494,5 @@ -(BOOL)textFieldShouldReturn:(UITextField *)tf
}
@end
+
+#endif
View
4 iphone/Classes/TiUITextFieldProxy.h
@@ -4,6 +4,8 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
+#ifdef USE_TI_UITEXTFIELD
+
#import "TiUITextWidgetProxy.h"
@interface TiUITextFieldProxy : TiUITextWidgetProxy {
@@ -13,3 +15,5 @@
@end
+
+#endif
View
4 iphone/Classes/TiUITextFieldProxy.m
@@ -4,6 +4,8 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
+#ifdef USE_TI_UITEXTFIELD
+
#import "TiUITextFieldProxy.h"
#import "TiUITextField.h"
@@ -39,3 +41,5 @@ @implementation TiUITextFieldProxy
DEFINE_DEF_INT_PROP(autocapitalization,UITextAutocapitalizationTypeNone);
@end
+
+#endif
View
2  iphone/SConstruct
@@ -5,7 +5,7 @@
import os,platform,sys,urllib,gzip
from progressbar import ProgressBar
-ticore_version = '4'
+ticore_version = '5'
# NOTE: this is simply a pre-built version of the source at http://github.com/appcelerator/tijscore
# since this is so freaking complicated to setup and build in an stable environment, and since
View
145 support/iphone/builder.py
@@ -76,6 +76,17 @@ def copy_module_resources(source, target, copy_all=False, force=False):
if not os.path.exists(to_) or os.path.getsize(from_)!=os.path.getsize(to_) or force:
if os.path.exists(to_): os.remove(to_)
shutil.copyfile(from_, to_)
+
+def make_appname(s):
+ r = re.compile('[0-9a-zA-Z_]')
+ buf = ''
+ for i in s:
+ if r.match(i)!=None:
+ buf+=i
+ # if name starts with number, we simply append a k to it
+ if re.match('^[0-9]+',buf):
+ buf = 'k%s' % buf
+ return buf
def main(args):
argc = len(args)
@@ -169,10 +180,12 @@ def main(args):
devicefamily = dequote(args[8].decode("utf-8"))
deploytype = 'test'
- build_dir = os.path.abspath(os.path.join(iphone_dir,'build','%s-iphone%s'%(target,ostype)))
+ build_out_dir = os.path.abspath(os.path.join(iphone_dir,'build'))
+ build_dir = os.path.abspath(os.path.join(build_out_dir,'%s-iphone%s'%(target,ostype)))
app_dir = os.path.abspath(os.path.join(build_dir,name+'.app'))
binary = os.path.join(app_dir,name)
sdk_version = os.path.basename(os.path.abspath(os.path.join(template_dir,'../')))
+ iphone_resources_dir = os.path.join(iphone_dir,'Resources')
version_file = os.path.join(iphone_resources_dir,'.simulator')
force_rebuild = read_project_version(project_xcconfig)!=sdk_version or not os.path.exists(version_file)
infoplist = os.path.join(iphone_dir,'Info.plist')
@@ -227,7 +240,25 @@ def find_depends(config,depends):
print "[INFO] Titanium SDK version: %s" % sdk_version
print "[INFO] iPhone Device family: %s" % devicefamily
print "[INFO] iPhone SDK version: %s" % iphone_version
-
+
+ if devicefamily!=None:
+ xib = 'MainWindow_%s.xib' % devicefamily
+ else:
+ xib = 'MainWindow_iphone.xib'
+ s = os.path.join(template_dir,xib)
+ t = os.path.join(iphone_resources_dir,'MainWindow.xib')
+ xib_out = open(s).read()
+ xib_out = xib_out.replace('Titanium',make_appname(name))
+ xib_f = open(t,'w')
+ xib_f.write(xib_out)
+ xib_f.close()
+
+ if not simulator:
+ version = ti.properties['version']
+ # we want to make sure in debug mode the version always changes
+ version = "%s.%d" % (version,time.time())
+ ti.properties['version']=version
+
# check to see if the appid is different (or not specified) - we need to re-generate
# the Info.plist before we actually invoke the compiler in this case
if read_project_appid(project_xcconfig)!=appid or not infoplist_has_appid(infoplist,appid):
@@ -240,9 +271,7 @@ def find_depends(config,depends):
new_lib_hash = None
lib_hash = None
- if simulator:
- iphone_resources_dir = os.path.join(iphone_dir,'Resources')
-
+
if simulator and force_xcode==False:
if os.path.exists(app_dir):
if os.path.exists(version_file):
@@ -276,7 +305,7 @@ def find_depends(config,depends):
lib_hash=new_lib_hash
if force_rebuild:
- print "[INFO] forcing full rebuild..."
+ print "[INFO] Performing full rebuild. This will take a little bit. Hold tight..."
sys.stdout.flush()
project = Projector(name,sdk_version,template_dir,project_dir,appid)
project.create(template_dir,iphone_dir)
@@ -320,31 +349,57 @@ def find_depends(config,depends):
os.chdir(os.path.join(iphone_dir,'lib'))
os.symlink(libticore,"libTiCore.a")
os.chdir(cwd)
-
+
+ def optimize_build():
+ return run.run(["/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize",app_dir])
+
try:
os.chdir(iphone_dir)
deploy_target = "IPHONEOS_DEPLOYMENT_TARGET=3.1"
device_target = 'TARGETED_DEVICE_FAMILY=iPhone' # this is non-sensical, but you can't pass empty string
+ # write out the build log, useful for debugging
+ if not os.path.exists(build_out_dir): os.makedirs(build_out_dir)
+ o = open(os.path.join(build_out_dir,'build.log'),'w')
+
if devicefamily!=None:
if devicefamily == 'ipad':
device_target=" TARGETED_DEVICE_FAMILY=iPad"
deploy_target = "IPHONEOS_DEPLOYMENT_TARGET=3.2"
- def execute_xcode(sdk,extras):
+ def is_adhoc(uuid):
+ path = "~/Library/MobileDevice/Provisioning Profiles/%s.mobileprovision" % uuid
+ f = os.path.expanduser(path)
+ if os.path.exists(f):
+ c = codecs.open(f,'r','utf-8','replace').read()
+ return c.find("ProvisionedDevices")!=-1
+ return False
+
+ def execute_xcode(sdk,extras,print_output=True):
args = ["xcodebuild","-configuration",target,"-sdk",sdk]
args += extras
args += [deploy_target,device_target]
- print "[DEBUG] compile checkpoint: %0.2f seconds" % (time.time()-start_time)
- print "[INFO] Executing XCode build..."
- print "[BEGIN_VERBOSE] Executing XCode Compiler <span>[toggle output]</span>"
+ o.write("Starting Xcode compile with the following arguments:\n\n")
+ for arg in args: o.write(" %s\n" % arg)
+ o.write("\n\n")
+ o.flush()
+
+ if print_output:
+ print "[DEBUG] compile checkpoint: %0.2f seconds" % (time.time()-start_time)
+ print "[INFO] Executing XCode build..."
+ print "[BEGIN_VERBOSE] Executing XCode Compiler <span>[toggle output]</span>"
+
output = run.run(args)
- print output
- print "[END_VERBOSE]"
- sys.stdout.flush()
+
+ if print_output:
+ print output
+ print "[END_VERBOSE]"
+ sys.stdout.flush()
+
+ o.write(output)
# check to make sure the user doesn't have a custom build location
# configured in Xcode which currently causes issues with titanium
@@ -388,6 +443,8 @@ def execute_xcode(sdk,extras):
# first make sure it's not running
kill_simulator()
+
+ o.close()
# sometimes the simulator doesn't remove old log files
# in which case we get our logging jacked - we need to remove
@@ -488,36 +545,76 @@ def handler(signum, frame):
elif command == 'install':
-
+
args = [
- "CODE_SIGN_ENTITLEMENTS=",
- "GCC_PREPROCESSOR_DEFINITIONS='DEPLOYTYPE=test' TI_VERSION=%s" % sdk_version,
+ "GCC_PREPROCESSOR_DEFINITIONS='DEPLOYTYPE=test'",
"PROVISIONING_PROFILE[sdk=iphoneos*]=%s" % appuuid,
"CODE_SIGN_IDENTITY[sdk=iphoneos*]=iPhone Developer: %s" % dist_name
]
- execute_xcode("iphoneos%s" % iphone_version,args)
+ execute_xcode("iphoneos%s" % iphone_version,args,False)
print "[INFO] Installing application in iTunes ... one moment"
sys.stdout.flush()
+
+ output = run.run(["/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication",app_dir,"-v"])
+ o.write(output)
+
+ # optimize the build
+ output = optimize_build()
+ o.write(output)
# for install, launch itunes with the app
- cmd = "open -b com.apple.itunes \"%s\"" % app_dir
+ ipa = os.path.join(os.path.dirname(app_dir),"%s.ipa" % name)
+ cmd = "open -b com.apple.itunes \"%s\"" % ipa
os.system(cmd)
-
+
# now run our applescript to tell itunes to sync to get
# the application on the phone
ass = os.path.join(template_dir,'itunes_sync.scpt')
cmd = "osascript \"%s\"" % ass
os.system(cmd)
-
+
print "[INFO] iTunes sync initiated"
+
+ o.close()
sys.stdout.flush()
sys.exit(0)
elif command == 'distribute':
- #FIXME
- #FIXME- sdk_version
- pass
+
+ # in this case, we have to do different things based on if it's
+ # an ad-hoc distribution cert or not - in the case of non-adhoc
+ # we don't use the entitlements file but in ad hoc we need to
+ adhoc_line = ""
+ deploytype = "production_adhoc"
+ if not is_adhoc(appuuid):
+ adhoc_line="CODE_SIGN_ENTITLEMENTS = Resources/Entitlements.plist"
+ deploytype = "production"
+
+ # build the final release distribution
+ args = [
+ adhoc_line,
+ "GCC_PREPROCESSOR_DEFINITIONS='DEPLOYTYPE=%s'" % deploytype,
+ "PROVISIONING_PROFILE[sdk=iphoneos*]=%s" % appuuid,
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]=iPhone Distribution: %s" % dist_name
+ ]
+ execute_xcode("iphoneos%s" % iphone_version,args,False)
+
+ # optimize the build
+ output = optimize_build()
+ o.write(output)
+ o.close()
+
+ # switch to app_bundle for zip
+ os.chdir(app_bundle_folder)
+
+ outfile = os.path.join(output_dir,"%s.zip"%app_name)
+ if os.path.exists(outfile): os.remove(outfile)
+
+ # you *must* use ditto here or it won't upload to appstore
+ os.system('ditto -ck --keepParent --sequesterRsrc "%s" "%s"' % (app_name,outfile))
+
+ sys.exit(0)
finally:
os.chdir(cwd)
View
29 support/iphone/compiler.py
@@ -14,7 +14,7 @@
from csspacker import CSSPacker
ignoreFiles = ['.gitignore', '.cvsignore', '.DS_Store'];
-ignoreDirs = ['.git','.svn','_svn', 'CVS'];
+ignoreDirs = ['.git','.svn','_svn','CVS','android','iphone'];
HEADER = """/**
* Appcelerator Titanium Mobile
@@ -52,13 +52,10 @@ def dequote(s):
return s[1:-1]
return s
+#
# TODO/FIXME
#
# - encryptor
-# - modules
-# - iphone dir
-# - info.plist generate and template
-# - remove old files
#
class Compiler(object):
@@ -125,9 +122,9 @@ def __init__(self,project_dir,appid,name,deploytype,xcode,devicefamily,iphone_ve
resources_dir = os.path.join(project_dir,'Resources')
iphone_resources_dir = os.path.join(resources_dir,'iphone')
-
- #FIXME: remove android and iphone Resources
- #FIXME: nib vs. xib in Resources
+
+ xib_file = os.path.join(app_dir,'MainWindow.xib')
+ if os.path.exists(xib_file): os.remove(xib_file)
# write out the updated Info.plist
infoplist_tmpl = os.path.join(self.iphone_dir,'Info.plist.template')
@@ -143,28 +140,18 @@ def __init__(self,project_dir,appid,name,deploytype,xcode,devicefamily,iphone_ve
appicon_path = os.path.join(resources_dir,appicon)
if os.path.exists(appicon_path):
shutil.copy(appicon_path, app_dir)
-
- if devicefamily!=None:
- xib = 'MainWindow_%s.xib' % devicefamily
- else:
- xib = 'MainWindow_iphone.xib'
- s = os.path.join(template_dir,xib)
- t = os.path.join(iphone_resources_dir,'MainWindow.xib')
- shutil.copy(s,t)
-
+
# copy in any resources in our module like icons
project_module_dir = os.path.join(project_dir,'modules','iphone')
if os.path.exists(project_module_dir):
self.copy_resources([project_module_dir],app_dir,False)
- print "[DEBUG] deploytype = %s" % deploytype
-
if deploytype!='development':
self.copy_resources([iphone_resources_dir,resources_dir],app_dir)
defines_header = open(os.path.join(self.classes_dir,'defines.h'),'w')
defines_header.write("// Warning: this is generated file. Do not modify!\n\n")
- defines_header.write("TI_VERSION=%s\n"%sdk_version)
+ defines_header.write("#define TI_VERSION %s\n"%sdk_version)
for sym in self.defines:
defines_header.write("#define %s 1\n"%sym)
defines_header.flush()
@@ -211,7 +198,7 @@ def extract_module_with_token(self,token,line):
def clean_api_symbol(self,line):
if re.match(r'^([a-zA-Z0-9_\.]+)$',line)!=None:
return line
- print "[DEBUG] rejecting API symbol: %s" % line
+ print "[DEBUG] rejecting invalid API symbol: %s" % line
return None
def extract_api_line(self,line):
View
14 support/iphone/pbxproj.py
@@ -102,11 +102,15 @@ def parse(self,f):
libpath = "\"\\\"$(SRCROOT)/lib\\\"\","
begin = contents.find(libpath)
- end = begin + len(libpath)
- line = contents[begin:end]
- line = line.replace(libpath,"\"\\\"%s\\\"\"," % libdir)
- contents = contents[0:end] + '\n ' + line + '\n' + contents[end+1:]
-
+ while begin>0:
+ end = begin + len(libpath)
+ line = contents[begin:end]
+ line = line.replace(libpath,"\"\\\"%s\\\"\"," % libdir)
+ contents = contents[0:end] + '\n ' + line + '\n' + contents[end+1:]
+ begin = contents.find(libpath,end)
+
+ contents = contents.replace('Resources-iPad/MainWindow.xib','Resources/MainWindow.xib')
+ contents = contents.replace('path = MainWindow.xib;','path = Resources/MainWindow.xib;')
return contents
Please sign in to comment.
Something went wrong with that request. Please try again.