X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fandroidapplicationcomponent.cpp;h=85873d4024ab46b14f51c6e05196354eb7fed4ff;hb=HEAD;hp=3c07feaad35d88db4358074435893ea727086ee7;hpb=68f084e4ed817da0c25cefa1772cadf97b8cfe5e;p=builder.git diff --git a/source/androidapplicationcomponent.cpp b/source/androidapplicationcomponent.cpp deleted file mode 100644 index 3c07fea..0000000 --- a/source/androidapplicationcomponent.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include "androidapplicationcomponent.h" -#include "androidmanifestfile.h" -#include "androidresourcefile.h" -#include "builder.h" -#include "installedfile.h" -#include "sharedlibrary.h" -#include "sourcepackage.h" -#include "tool.h" -#include "toolchain.h" - -using namespace std; -using namespace Msp; - -AndroidApplicationComponent::AndroidApplicationComponent(SourcePackage &p, const string &n): - Component(p, n) -{ } - -void AndroidApplicationComponent::create_targets() const -{ - Builder &builder = package.get_builder(); - BuildGraph &build_graph = builder.get_build_graph(); - - const BuildGraph::TargetMap &targets = build_graph.get_targets(); - list contents; - for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) - if(i->second->get_package()==&package) - if(InstalledFile *inst = dynamic_cast(i->second)) - contents.push_back(inst->get_real_target()); - - AndroidManifestFile *manifest = new AndroidManifestFile(builder, *this); - - list resource_sources; - resource_sources.push_back(manifest); - - const Toolchain &toolchain = builder.get_toolchain(); - Tool © = toolchain.get_tool("CP"); - SourceList source_filenames = collect_source_files(); - for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) - { - Target *tgt = new AndroidResourceFile(builder, *this, *i); - resource_sources.push_back(copy.create_target(*tgt, "//")); - } - - Tool &aapt = toolchain.get_tool("AAPT"); - Target *resource_bundle = aapt.create_target(resource_sources); - - list apk_sources; - apk_sources.push_back(resource_bundle); - - const Architecture &arch = package.get_builder().get_current_arch(); - string lib_dir = "//"+name+"/lib/"; - if(arch.get_type()=="arm") - { - lib_dir += "armeabi"; - if(arch.get_cpu()=="armv7a") - lib_dir += "-v7a"; - } - else - lib_dir += arch.get_type(); - - string assets_dir = "//"+name+"/assets"; - for(list::const_iterator i=contents.begin(); i!=contents.end(); ++i) - { - Target *staged = 0; - if(SharedLibrary *shlib = dynamic_cast(*i)) - { - manifest->set_native_library(shlib); - staged = copy.create_target(**i, lib_dir); - } - else - staged = copy.create_target(**i, assets_dir); - apk_sources.push_back(staged); - } - - Tool &apk_builder = toolchain.get_tool("APK"); - Target *apk = apk_builder.create_target(apk_sources); - builder.get_build_graph().add_primary_target(*apk); -}