Beispiel #1
0
    def apk(self, toolchain, writer, module, archbins, javasources, outpath,
            binname, basepath, config, implicit_deps, resources):
        buildpath = os.path.join('$buildpath', config, 'apk', binname)
        baseapkname = binname + ".base.apk"
        unsignedapkname = binname + ".unsigned.apk"
        unalignedapkname = binname + ".unaligned.apk"
        apkname = binname + ".apk"
        apkfiles = []
        libfiles = []
        locallibs = []
        resfiles = []
        manifestfile = []

        writer.comment('Make APK')
        for _, value in archbins.iteritems():
            for archbin in value:
                archpair = os.path.split(archbin)
                libname = archpair[1]
                arch = os.path.split(archpair[0])[1]
                locallibpath = os.path.join('lib', self.archpath[arch],
                                            libname)
                archpath = os.path.join(buildpath, locallibpath)
                locallibs += [locallibpath + ' ']
                libfiles += toolchain.copy(writer, archbin, archpath)
        for resource in resources:
            filename = os.path.split(resource)[1]
            if filename == 'AndroidManifest.xml':
                manifestfile = toolchain.copy(
                    writer, os.path.join(basepath, module, resource),
                    os.path.join(buildpath, 'AndroidManifest.xml'))
            else:
                restype = os.path.split(os.path.split(resource)[0])[1]
                if restype == 'asset':
                    pass  #todo: implement
                else:
                    resfiles += toolchain.copy(
                        writer, os.path.join(basepath, module, resource),
                        os.path.join(buildpath, 'res', restype, filename))

        #Make directories
        gendir = toolchain.mkdir(writer, os.path.join(buildpath, 'gen'))
        bindir = toolchain.mkdir(writer, os.path.join(buildpath, 'bin'))
        binresdir = toolchain.mkdir(writer,
                                    os.path.join(buildpath, 'bin', 'res'),
                                    order_only=bindir)
        alldirs = gendir + bindir + binresdir

        aaptvars = [('apkbuildpath', buildpath), ('apk', baseapkname)]
        aaptout = os.path.join(buildpath, baseapkname)
        if config == 'deploy':
            baseapkfile = writer.build(aaptout,
                                       'aaptdeploy',
                                       manifestfile,
                                       variables=aaptvars,
                                       implicit=manifestfile + resfiles,
                                       order_only=alldirs)
        else:
            baseapkfile = writer.build(aaptout,
                                       'aapt',
                                       manifestfile,
                                       variables=aaptvars,
                                       implicit=manifestfile + resfiles,
                                       order_only=alldirs)

        #Compile java code
        javafiles = []
        localjava = []
        if javasources != []:
            #self.javaccmd = '$javac -d $outpath -classpath $outpath -sourcepath $sourcepath -target 1.5 -bootclasspath $androidjar -g -source 1.5 -Xlint:-options $in'
            #self.dexcmd = '$dex --dex --output $out $in'
            javasourcepath = '.'
            if self.host.is_windows():
                javasourcepath += ';'
            else:
                javasourcepath += ':'
            javasourcepath += os.path.join(buildpath, 'gen')
            classpath = os.path.join(buildpath, 'classes')
            javavars = [('outpath', classpath), ('sourcepath', javasourcepath)]
            javaclasses = writer.build(classpath,
                                       'javac',
                                       javasources,
                                       variables=javavars,
                                       implicit=baseapkfile)
            localjava += ['classes.dex']
            javafiles += writer.build(os.path.join(buildpath, 'classes.dex'),
                                      'dex', classpath)

        #Add native libraries and java classes to apk
        aaptvars = [('apkbuildpath', buildpath), ('apk', unsignedapkname),
                    ('apksource', baseapkname),
                    ('apkaddfiles',
                     toolchain.paths_forward_slash(locallibs + localjava))]
        unsignedapkfile = writer.build(os.path.join(buildpath,
                                                    unsignedapkname),
                                       'aaptadd',
                                       baseapkfile,
                                       variables=aaptvars,
                                       implicit=libfiles + javafiles,
                                       order_only=alldirs)

        #Sign the APK
        codesignvars = [('config', config)]
        unalignedapkfile = writer.build(os.path.join(buildpath,
                                                     unalignedapkname),
                                        'codesign',
                                        unsignedapkfile,
                                        variables=codesignvars)

        #Run zipalign
        outfile = writer.build(os.path.join(outpath, config, apkname),
                               'zipalign', unalignedapkfile)
        return outfile
Beispiel #2
0
  def app(self, toolchain, writer, module, archbins, outpath, binname, basepath, config, implicit_deps, resources, codesign):
    #Outputs
    builtbin = []
    builtres = []
    builtsym = []

    #Paths
    builddir = os.path.join('$buildpath', config, 'app', binname)
    configpath = os.path.join(outpath, config)
    apppath = os.path.join(configpath, binname + '.app')
    dsympath = os.path.join(outpath, config, binname + '.dSYM')

    #Extract debug symbols from universal binary
    dsymcontentpath = os.path.join(dsympath, 'Contents')
    builtsym = writer.build([os.path.join(dsymcontentpath, 'Resources', 'DWARF', binname), os.path.join(dsymcontentpath, 'Resources', 'DWARF' ), os.path.join(dsymcontentpath, 'Resources'), os.path.join(dsymcontentpath, 'Info.plist'), dsymcontentpath, dsympath], 'dsymutil', archbins[config], variables = [('outpath', dsympath)])

    #Copy final universal binary
    if self.target.is_ios():
      builtbin = toolchain.copy(writer, archbins[config], os.path.join(apppath, toolchain.binprefix + binname + toolchain.binext))
    else:
      builtbin = toolchain.copy(writer, archbins[config], os.path.join(apppath, 'Contents', 'MacOS', toolchain.binprefix + binname + toolchain.binext))

    #Build resources
    if resources:
      has_resources = False

      #Lists of input plists and partial plist files produced by resources
      plists = []
      assetsplists = []
      xibplists = []

      #All resource output files
      outfiles = []

      #First build everything except plist inputs
      for resource in resources:
        if resource.endswith('.xcassets'):
          if self.target.is_macosx():
            assetsvars = [('outpath', os.path.join(apppath, 'Contents', 'Resources'))]
          else:
            assetsvars = [('outpath', apppath)]
          outplist = os.path.join(builddir, os.path.splitext(os.path.basename(resource))[0] + '-xcassets.plist')
          assetsvars += [('outplist', outplist)]
          outfiles = [outplist]
          if self.target.is_macosx():
            outfiles += [os.path.join(apppath, 'Contents', 'Resources', 'AppIcon.icns')]
          elif self.target.is_ios():
            pass #TODO: Need to list all icon and launch image files here
          assetsplists += writer.build(outfiles, 'xcassets', os.path.join(basepath, module, resource), variables = assetsvars)
          has_resources = True
        elif resource.endswith('.xib'):
          xibmodule = binname.replace('-', '_').replace('.', '_')
          if self.target.is_macosx():
            nibpath = os.path.join(apppath, 'Contents', 'Resources', os.path.splitext(os.path.basename(resource))[0] + '.nib')
          else:
            nibpath = os.path.join(apppath, os.path.splitext(os.path.basename(resource))[0] + '.nib')
          plistpath = os.path.join(builddir, os.path.splitext(os.path.basename(resource))[0] + '-xib.plist')
          xibplists += [plistpath]
          outfiles = []
          if self.target.is_ios():
            outfiles += [os.path.join(nibpath, 'objects.nib'), os.path.join(nibpath, 'objects-8.0+.nib'), os.path.join(nibpath, 'runtime.nib')]
          outfiles += [nibpath, plistpath]
          builtres += writer.build(outfiles, 'xib', os.path.join(basepath, module, resource), variables = [('outpath', nibpath), ('outplist', plistpath), ('module', xibmodule)])
          has_resources = True
        elif resource.endswith('.plist'):
          plists += [os.path.join(basepath, module, resource)]

      #Extra output files/directories
      outfiles = []
      if has_resources and self.target.is_macosx():
        outfiles += [os.path.join(apppath, 'Contents', 'Resources')]

      #Now build input plists appending partial plists created by previous resources
      if self.target.is_macosx():
        plistpath = os.path.join(apppath, 'Contents', 'Info.plist')
        pkginfopath = os.path.join(apppath, 'Contents', 'PkgInfo')
      else:
        plistpath = os.path.join(apppath, 'Info.plist')
        pkginfopath = os.path.join(apppath, 'PkgInfo')
      plistvars = [('exename', binname), ('prodname', binname), ('outpath', plistpath)]
      bundleidentifier = self.make_bundleidentifier(binname)
      if bundleidentifier != '':
        plistvars += [('bundleidentifier', bundleidentifier)]
      outfiles += [plistpath, pkginfopath]
      builtres += writer.build(outfiles, 'plist', plists + assetsplists + xibplists, implicit = [os.path.join( 'build', 'ninja', 'plist.py')], variables = plistvars)

    #Do code signing (might modify binary, but does not matter, nothing should have final binary as input anyway)
    if codesign:
      codesignvars = [('builddir', builddir), ('binname', binname), ('outpath', apppath), ('config', config)]
      if self.target.is_ios():
        if self.provisioning != '':
          codesignvars += [('provisioning', self.provisioning)]
        writer.build([os.path.join(apppath, '_CodeSignature', 'CodeResources'), os.path.join(apppath, '_CodeSignature'), apppath], 'codesign', builtbin, implicit = builtres + [os.path.join('build', 'ninja', 'codesign.py')], variables = codesignvars)
      elif self.target.is_macosx():
        if self.provisioning != '':
          codesignvars += [('provisioning', self.provisioning)]
        writer.build([os.path.join(apppath, 'Contents', '_CodeSignature', 'CodeResources'), os.path.join(apppath, 'Contents', '_CodeSignature'), os.path.join(apppath, 'Contents'), apppath], 'codesign', builtbin, implicit = builtres + [os.path.join('build', 'ninja', 'codesign.py')], variables = codesignvars)

    return builtbin + builtsym + builtres
Beispiel #3
0
  def apk(self, toolchain, writer, module, archbins, javasources, outpath, binname, basepath, config, implicit_deps, resources):
    buildpath = os.path.join('$buildpath', config, 'apk', binname)
    baseapkname = binname + ".base.apk"
    unsignedapkname = binname + ".unsigned.apk"
    unalignedapkname = binname + ".unaligned.apk"
    apkname = binname + ".apk"
    apkfiles = []
    libfiles = []
    locallibs = []
    resfiles = []
    manifestfile = []

    writer.comment('Make APK')
    for _, value in archbins.iteritems():
      for archbin in value:
        archpair = os.path.split(archbin)
        libname = archpair[1]
        arch = os.path.split(archpair[0])[1]
        locallibpath = os.path.join('lib', self.archpath[arch], libname)
        archpath = os.path.join(buildpath, locallibpath)
        locallibs += [locallibpath + ' ']
        libfiles += toolchain.copy(writer, archbin, archpath)
    for resource in resources:
      filename = os.path.split(resource)[1]
      if filename == 'AndroidManifest.xml':
        manifestfile = toolchain.copy(writer, os.path.join(basepath, module, resource), os.path.join(buildpath, 'AndroidManifest.xml'))
      else:
        restype = os.path.split(os.path.split(resource)[0])[1]
        if restype == 'asset':
          pass #todo: implement
        else:
          resfiles += toolchain.copy(writer, os.path.join(basepath, module, resource), os.path.join(buildpath, 'res', restype, filename))

    #Make directories
    gendir = toolchain.mkdir(writer, os.path.join(buildpath, 'gen'))
    bindir = toolchain.mkdir(writer, os.path.join(buildpath, 'bin'))
    binresdir = toolchain.mkdir(writer, os.path.join(buildpath, 'bin', 'res'), order_only = bindir)
    alldirs = gendir + bindir + binresdir

    aaptvars = [('apkbuildpath', buildpath), ('apk', baseapkname)]
    aaptout = os.path.join(buildpath, baseapkname)
    if config == 'deploy':
      baseapkfile = writer.build(aaptout, 'aaptdeploy', manifestfile, variables = aaptvars, implicit = manifestfile + resfiles, order_only = alldirs)
    else:
      baseapkfile = writer.build(aaptout, 'aapt', manifestfile, variables = aaptvars, implicit = manifestfile + resfiles, order_only = alldirs)

    #Compile java code
    javafiles = []
    localjava = []
    if javasources != []:
      #self.javaccmd = '$javac -d $outpath -classpath $outpath -sourcepath $sourcepath -target 1.5 -bootclasspath $androidjar -g -source 1.5 -Xlint:-options $in'
      #self.dexcmd = '$dex --dex --output $out $in'
      javasourcepath = '.'
      if self.host.is_windows():
        javasourcepath += ';'
      else:
        javasourcepath += ':'
      javasourcepath += os.path.join(buildpath, 'gen')
      classpath = os.path.join(buildpath, 'classes')
      javavars = [('outpath', classpath), ('sourcepath', javasourcepath)]
      javaclasses = writer.build(classpath, 'javac', javasources, variables = javavars)
      localjava += ['classes.dex']
      javafiles += writer.build(os.path.join(buildpath, 'classes.dex'), 'dex', classpath)

    #Add native libraries and java classes to apk
    aaptvars = [('apkbuildpath', buildpath), ('apk', unsignedapkname), ('apksource', baseapkname), ('apkaddfiles', toolchain.paths_forward_slash(locallibs + localjava))]
    unsignedapkfile = writer.build(os.path.join(buildpath, unsignedapkname), 'aaptadd', baseapkfile, variables = aaptvars, implicit = libfiles + javafiles, order_only = alldirs)

    #Sign the APK
    jarsignervars = []
    if self.tsacert != '':
      jarsignervars += [('timestamp', '-tsacert ' + self.tsacert)]
    elif self.tsa != '':
      jarsignervars += [('timestamp', '-tsa ' + self.tsa)]
    unalignedapkfile = writer.build(os.path.join(buildpath, unalignedapkname), 'jarsigner', unsignedapkfile, variables = jarsignervars)

    #Run zipalign
    outfile = writer.build(os.path.join(outpath, config, apkname), 'zipalign', unalignedapkfile)
    return outfile
Beispiel #4
0
    def app(self, toolchain, writer, module, archbins, outpath, binname,
            basepath, config, implicit_deps, resources, codesign):
        #Outputs
        builtbin = []
        builtres = []
        builtsym = []

        #Paths
        builddir = os.path.join('$buildpath', config, 'app', binname)
        configpath = os.path.join(outpath, config)
        apppath = os.path.join(configpath, binname + '.app')
        dsympath = os.path.join(outpath, config, binname + '.dSYM')

        #Extract debug symbols from universal binary
        dsymcontentpath = os.path.join(dsympath, 'Contents')
        builtsym = writer.build([
            os.path.join(dsymcontentpath, 'Resources', 'DWARF', binname),
            os.path.join(dsymcontentpath, 'Resources', 'DWARF'),
            os.path.join(dsymcontentpath, 'Resources'),
            os.path.join(dsymcontentpath, 'Info.plist'), dsymcontentpath,
            dsympath
        ],
                                'dsymutil',
                                archbins[config],
                                variables=[('outpath', dsympath)])

        #Copy final universal binary
        if self.target.is_ios():
            builtbin = toolchain.copy(
                writer, archbins[config],
                os.path.join(apppath,
                             toolchain.binprefix + binname + toolchain.binext))
        else:
            builtbin = toolchain.copy(
                writer, archbins[config],
                os.path.join(apppath, 'Contents', 'MacOS',
                             toolchain.binprefix + binname + toolchain.binext))

        #Build resources
        if resources:
            has_resources = False

            #Lists of input plists and partial plist files produced by resources
            plists = []
            assetsplists = []
            xibplists = []

            #All resource output files
            outfiles = []

            #First build everything except plist inputs
            for resource in resources:
                if resource.endswith('.xcassets'):
                    if self.target.is_macosx():
                        assetsvars = [('outpath',
                                       os.path.join(apppath, 'Contents',
                                                    'Resources'))]
                    else:
                        assetsvars = [('outpath', apppath)]
                    outplist = os.path.join(
                        builddir,
                        os.path.splitext(os.path.basename(resource))[0] +
                        '-xcassets.plist')
                    assetsvars += [('outplist', outplist)]
                    outfiles = [outplist]
                    if self.target.is_macosx():
                        outfiles += [
                            os.path.join(apppath, 'Contents', 'Resources',
                                         'AppIcon.icns')
                        ]
                    elif self.target.is_ios():
                        pass  #TODO: Need to list all icon and launch image files here
                    assetsplists += writer.build(outfiles,
                                                 'xcassets',
                                                 os.path.join(
                                                     basepath, module,
                                                     resource),
                                                 variables=assetsvars)
                    has_resources = True
                elif resource.endswith('.xib'):
                    xibmodule = binname.replace('-', '_').replace('.', '_')
                    if self.target.is_macosx():
                        nibpath = os.path.join(
                            apppath, 'Contents', 'Resources',
                            os.path.splitext(os.path.basename(resource))[0] +
                            '.nib')
                    else:
                        nibpath = os.path.join(
                            apppath,
                            os.path.splitext(os.path.basename(resource))[0] +
                            '.nib')
                    plistpath = os.path.join(
                        builddir,
                        os.path.splitext(os.path.basename(resource))[0] +
                        '-xib.plist')
                    xibplists += [plistpath]
                    outfiles = []
                    if self.target.is_ios():
                        outfiles += [
                            os.path.join(nibpath, 'objects.nib'),
                            os.path.join(nibpath, 'objects-8.0+.nib'),
                            os.path.join(nibpath, 'runtime.nib')
                        ]
                    outfiles += [nibpath, plistpath]
                    builtres += writer.build(
                        outfiles,
                        'xib',
                        os.path.join(basepath, module, resource),
                        variables=[('outpath', nibpath),
                                   ('outplist', plistpath),
                                   ('module', xibmodule)])
                    has_resources = True
                elif resource.endswith('.plist'):
                    plists += [os.path.join(basepath, module, resource)]

            #Extra output files/directories
            outfiles = []
            if has_resources and self.target.is_macosx():
                outfiles += [os.path.join(apppath, 'Contents', 'Resources')]

            #Now build input plists appending partial plists created by previous resources
            if self.target.is_macosx():
                plistpath = os.path.join(apppath, 'Contents', 'Info.plist')
                pkginfopath = os.path.join(apppath, 'Contents', 'PkgInfo')
            else:
                plistpath = os.path.join(apppath, 'Info.plist')
                pkginfopath = os.path.join(apppath, 'PkgInfo')
            plistvars = [('exename', binname), ('prodname', binname),
                         ('outpath', plistpath)]
            bundleidentifier = self.make_bundleidentifier(binname)
            if bundleidentifier != '':
                plistvars += [('bundleidentifier', bundleidentifier)]
            outfiles += [plistpath, pkginfopath]
            builtres += writer.build(
                outfiles,
                'plist',
                plists + assetsplists + xibplists,
                implicit=[os.path.join('build', 'ninja', 'plist.py')],
                variables=plistvars)

        #Do code signing (might modify binary, but does not matter, nothing should have final binary as input anyway)
        if codesign:
            codesignvars = [('builddir', builddir), ('binname', binname),
                            ('outpath', apppath), ('config', config)]
            if self.target.is_ios():
                if self.provisioning != '':
                    codesignvars += [('provisioning', self.provisioning)]
                writer.build([
                    os.path.join(apppath, '_CodeSignature', 'CodeResources'),
                    os.path.join(apppath, '_CodeSignature'), apppath
                ],
                             'codesign',
                             builtbin,
                             implicit=builtres +
                             [os.path.join('build', 'ninja', 'codesign.py')],
                             variables=codesignvars)
            elif self.target.is_macosx():
                if self.provisioning != '':
                    codesignvars += [('provisioning', self.provisioning)]
                writer.build([
                    os.path.join(apppath, 'Contents', '_CodeSignature',
                                 'CodeResources'),
                    os.path.join(apppath, 'Contents', '_CodeSignature'),
                    os.path.join(apppath, 'Contents'), apppath
                ],
                             'codesign',
                             builtbin,
                             implicit=builtres +
                             [os.path.join('build', 'ninja', 'codesign.py')],
                             variables=codesignvars)

        return builtbin + builtsym + builtres
Beispiel #5
0
    def app(
        self,
        toolchain,
        writer,
        module,
        archbins,
        outpath,
        binname,
        basepath,
        config,
        implicit_deps,
        resources,
        codesign,
    ):
        # Outputs
        builtbin = []
        builtres = []
        builtsym = []

        # Paths
        builddir = os.path.join("$buildpath", config, "app", binname)
        configpath = os.path.join(outpath, config)
        apppath = os.path.join(configpath, binname + ".app")
        dsympath = os.path.join(outpath, config, binname + ".dSYM")

        # Extract debug symbols from universal binary
        dsymcontentpath = os.path.join(dsympath, "Contents")
        builtsym = writer.build(
            [
                os.path.join(dsymcontentpath, "Resources", "DWARF", binname),
                os.path.join(dsymcontentpath, "Resources", "DWARF"),
                os.path.join(dsymcontentpath, "Resources"),
                os.path.join(dsymcontentpath, "Info.plist"),
                dsymcontentpath,
                dsympath,
            ],
            "dsymutil",
            archbins[config],
            variables=[("outpath", dsympath)],
        )

        # Copy final universal binary
        if self.target.is_ios():
            builtbin = toolchain.copy(
                writer, archbins[config], os.path.join(apppath, toolchain.binprefix + binname + toolchain.binext)
            )
        else:
            builtbin = toolchain.copy(
                writer,
                archbins[config],
                os.path.join(apppath, "Contents", "MacOS", toolchain.binprefix + binname + toolchain.binext),
            )

        # Build resources
        if resources:
            has_resources = False

            # Lists of input plists and partial plist files produced by resources
            plists = []
            assetsplists = []
            xibplists = []

            # All resource output files
            outfiles = []

            # First build everything except plist inputs
            for resource in resources:
                if resource.endswith(".xcassets"):
                    if self.target.is_macosx():
                        assetsvars = [("outpath", os.path.join(os.getcwd(), apppath, "Contents", "Resources"))]
                    else:
                        assetsvars = [("outpath", apppath)]
                    outplist = os.path.join(
                        os.getcwd(), builddir, os.path.splitext(os.path.basename(resource))[0] + "-xcassets.plist"
                    )
                    assetsvars += [("outplist", outplist)]
                    outfiles = [outplist]
                    if self.target.is_macosx():
                        outfiles += [os.path.join(os.getcwd(), apppath, "Contents", "Resources", "AppIcon.icns")]
                    elif self.target.is_ios():
                        pass  # TODO: Need to list all icon and launch image files here
                    assetsplists += writer.build(
                        outfiles,
                        "xcassets",
                        os.path.join(os.getcwd(), basepath, module, resource),
                        variables=assetsvars,
                    )
                    has_resources = True
                elif resource.endswith(".xib"):
                    xibmodule = binname.replace("-", "_").replace(".", "_")
                    if self.target.is_macosx():
                        nibpath = os.path.join(
                            apppath, "Contents", "Resources", os.path.splitext(os.path.basename(resource))[0] + ".nib"
                        )
                    else:
                        nibpath = os.path.join(apppath, os.path.splitext(os.path.basename(resource))[0] + ".nib")
                    plistpath = os.path.join(builddir, os.path.splitext(os.path.basename(resource))[0] + "-xib.plist")
                    xibplists += [plistpath]
                    outfiles = []
                    if self.target.is_ios():
                        outfiles += [
                            os.path.join(nibpath, "objects.nib"),
                            os.path.join(nibpath, "objects-8.0+.nib"),
                            os.path.join(nibpath, "runtime.nib"),
                        ]
                    outfiles += [nibpath, plistpath]
                    builtres += writer.build(
                        outfiles,
                        "xib",
                        os.path.join(basepath, module, resource),
                        variables=[("outpath", nibpath), ("outplist", plistpath), ("module", xibmodule)],
                    )
                    has_resources = True
                elif resource.endswith(".plist"):
                    plists += [os.path.join(basepath, module, resource)]

            # Extra output files/directories
            outfiles = []
            if has_resources and self.target.is_macosx():
                outfiles += [os.path.join(apppath, "Contents", "Resources")]

            # Now build input plists appending partial plists created by previous resources
            if self.target.is_macosx():
                plistpath = os.path.join(apppath, "Contents", "Info.plist")
                pkginfopath = os.path.join(apppath, "Contents", "PkgInfo")
            else:
                plistpath = os.path.join(apppath, "Info.plist")
                pkginfopath = os.path.join(apppath, "PkgInfo")
            plistvars = [("exename", binname), ("prodname", binname), ("outpath", plistpath)]
            bundleidentifier = self.make_bundleidentifier(binname)
            if bundleidentifier != "":
                plistvars += [("bundleidentifier", bundleidentifier)]
            outfiles += [plistpath, pkginfopath]
            builtres += writer.build(
                outfiles,
                "plist",
                plists + assetsplists + xibplists,
                implicit=[os.path.join("build", "ninja", "plist.py")],
                variables=plistvars,
            )

        # Do code signing (might modify binary, but does not matter, nothing should have final binary as input anyway)
        if codesign:
            codesignvars = [("builddir", builddir), ("binname", binname), ("outpath", apppath), ("config", config)]
            if self.target.is_ios():
                if self.provisioning != "":
                    codesignvars += [("provisioning", self.provisioning)]
                writer.build(
                    [
                        os.path.join(apppath, "_CodeSignature", "CodeResources"),
                        os.path.join(apppath, "_CodeSignature"),
                        apppath,
                    ],
                    "codesign",
                    builtbin,
                    implicit=builtres + [os.path.join("build", "ninja", "codesign.py")],
                    variables=codesignvars,
                )
            elif self.target.is_macosx():
                if self.provisioning != "":
                    codesignvars += [("provisioning", self.provisioning)]
                writer.build(
                    [
                        os.path.join(apppath, "Contents", "_CodeSignature", "CodeResources"),
                        os.path.join(apppath, "Contents", "_CodeSignature"),
                        os.path.join(apppath, "Contents"),
                        apppath,
                    ],
                    "codesign",
                    builtbin,
                    implicit=builtres + [os.path.join("build", "ninja", "codesign.py")],
                    variables=codesignvars,
                )

        return builtbin + builtsym + builtres