【问题标题】:Where does Appcelerator Titanium Mobile cross-compile JS to native code?Appcelerator Titanium Mobile 在哪里将 JS 交叉编译为本机代码?
【发布时间】:2011-03-12 20:13:00
【问题描述】:

从问题“How Does Appcelerator Titanium Mobile Work?”我知道JS被交叉编译成本机代码。但这是在哪里发生的?我在开源 Titanium 代码中找不到任何代码。 Appcelerator 的网站在交叉编译的过程中也很少见。

【问题讨论】:

    标签: javascript objective-c mobile titanium appcelerator


    【解决方案1】:

    在 Windows/Android 上的 Titanium 1.4 中,查看 C:\ProgramData\Titanium\mobilesdk\win32\1.4.0\android\compiler.py 你会发现:

    def compile_into_bytecode(self,paths):
        jar_path = os.path.join(self.template_dir,"js.jar")
        for package in paths:
            args = [self.java,"-cp",jar_path,"org.mozilla.javascript.tools.jsc.Main","-opt","9","-nosource","-package",package,"-d",self.classes_dir]
            count = 0
            for path in paths[package]:
                # skip any JS found inside HTML <script>
                if path in self.html_scripts: continue
                args.append(path)
                count+=1
                self.compiled_files.append(path)
            if count > 0: run.run(args)
    

    【讨论】:

      【解决方案2】:

      我相信 Titanium Developer 在构建过程中会编译它。如果您查看您的 Project/build/android 或 Project/build/iphone 目录,您将看到代码输出。

      在 Titanium Mobile 1.3 中,他们引入了 XCode 项目生成,因此您现在可以使用 XCode 打开项目。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-01
        • 1970-01-01
        • 2013-11-06
        • 2016-09-21
        • 2015-03-23
        • 2020-04-10
        相关资源
        最近更新 更多