[DEV] nearly ready to be tested

This commit is contained in:
Edouard DUPIN 2014-01-14 22:01:53 +01:00
parent 862ab0f7b7
commit 0e6c61e2ed
3 changed files with 172 additions and 190 deletions

View File

@ -1,15 +1,18 @@
#!/usr/bin/python #!/usr/bin/python
import lutinDebug as debug import lutinDebug as debug
import datetime import datetime
import lutinTools import lutinTools as tools
import lutinModule import os
import fnmatch
import lutinExtProjectGenerator import lutinExtProjectGenerator
from collections import defaultdict
# id example : FFBA2F79187F44AE0034CC66 # id example : FFBA2F79187F44AE0034CC66
genericID = 100000 genericID = 100000
def convert_name_in_base_id(name,fill=True): def convert_name_in_base_id(name,fill=True):
out = "" out = "FF"
for element in name.lower(): for element in name.lower():
if element == "a": out += "01" if element == "a": out += "01"
elif element == "b": out += "02" elif element == "b": out += "02"
@ -52,7 +55,7 @@ dictId = {}
def convert_folder_in_base_id(name, package): def convert_folder_in_base_id(name, package):
global dictId global dictId
debug.info(" generate Id for : " + package + ":" + name); debug.verbose(" generate Id for : " + package + ":" + name);
if package not in dictId.keys(): if package not in dictId.keys():
dictId[package] = {"lastID": 100000, "sub":{}} dictId[package] = {"lastID": 100000, "sub":{}}
if name not in dictId[package]["sub"].keys(): if name not in dictId[package]["sub"].keys():
@ -61,12 +64,6 @@ def convert_folder_in_base_id(name, package):
dictId[package]["sub"][name] = {"id":generatedID} dictId[package]["sub"][name] = {"id":generatedID}
return dictId[package]["sub"][name]["id"] return dictId[package]["sub"][name]["id"]
def create_tree(fileList):
tree = {}
##"declare-name"
from collections import defaultdict
FILE_MARKER = '<files>' FILE_MARKER = '<files>'
## ##
@ -158,34 +155,45 @@ def generate_tree(treedata, package, tree = []):
XCodeTypeElements = { XCodeTypeElements = {
'a': ('archive.ar', 'PBXFrameworksBuildPhase'), 'a': ('archive.ar', 'PBXFrameworksBuildPhase', ''),
'app': ('wrapper.application', None), 'xcodeproj': ('wrapper.pb-project', None, '""'),
's': ('sourcecode.asm', 'PBXSourcesBuildPhase'), 'app': ('wrapper.application', None, ''),
'c': ('sourcecode.c.c', 'PBXSourcesBuildPhase'), 'framework': ('wrapper.framework', 'PBXFrameworksBuildPhase', 'SDKROOT'),
'cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase'), 'dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase', '"<group>"'),
'framework': ('wrapper.framework', 'PBXFrameworksBuildPhase'), 'h': ('sourcecode.c.h', None, '"<group>"'),
'h': ('sourcecode.c.h', None), 'H': ('sourcecode.c.h', None, '"<group>"'),
'hpp': ('sourcecode.c.h', None), 'hpp': ('sourcecode.c.h', None, '"<group>"'),
'icns': ('image.icns', 'PBXResourcesBuildPhase'), 'hxx': ('sourcecode.c.h', None, '"<group>"'),
'm': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), 'S': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
'j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), 's': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
'mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase'), 'c': ('sourcecode.c.c', 'PBXSourcesBuildPhase', '"<group>"'),
'nib': ('wrapper.nib', 'PBXResourcesBuildPhase'), 'cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'plist': ('text.plist.xml', 'PBXResourcesBuildPhase'), 'cxx': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'json': ('text.json', 'PBXResourcesBuildPhase'), 'm': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'png': ('image.png', 'PBXResourcesBuildPhase'), 'j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'rtf': ('text.rtf', 'PBXResourcesBuildPhase'), 'mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase', '"<group>"'),
'tiff': ('image.tiff', 'PBXResourcesBuildPhase'), 'icns': ('image.icns', 'PBXResourcesBuildPhase', '"<group>"'),
'txt': ('text', 'PBXResourcesBuildPhase'), 'nib': ('wrapper.nib', 'PBXResourcesBuildPhase', '"<group>"'),
'xcodeproj': ('wrapper.pb-project', None), 'plist': ('text.plist.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'xib': ('file.xib', 'PBXResourcesBuildPhase'), 'json': ('text.json', 'PBXResourcesBuildPhase', '"<group>"'),
'strings': ('text.plist.strings', 'PBXResourcesBuildPhase'), 'rtf': ('text.rtf', 'PBXResourcesBuildPhase', '"<group>"'),
'bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase'), 'png': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase'), 'tiff': ('image.tiff', 'PBXResourcesBuildPhase', '"<group>"'),
'fsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase'), 'txt': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'frag': ('sourcecode.glsl', 'PBXResourcesBuildPhase'), 'fsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase'), 'frag': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vert': ('sourcecode.glsl', 'PBXResourcesBuildPhase') 'vsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vert': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'svg': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'xml': ('sourcecode.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'prog': ('text.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'ttf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'conf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'emf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'xib': ('file.xib', 'PBXResourcesBuildPhase', '"<group>"'),
'strings': ('text.plist.strings', 'PBXResourcesBuildPhase', '"<group>"'),
'bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase', '"<group>"'),
'storyboard':('file.storyboard', 'PBXResourcesBuildPhase', '"<group>"')
} }
class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator): class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
@ -193,17 +201,26 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
lutinExtProjectGenerator.ExtProjectGenerator.__init__(self, "XCode") lutinExtProjectGenerator.ExtProjectGenerator.__init__(self, "XCode")
self.baseId = "FFFFFFFFFFFFFFFFFF" self.baseId = "FFFFFFFFFFFFFFFFFF"
# set default framwork:
self.add_files("Frameworks",
"System/Library/Frameworks",
[ "Foundation.framework",
"CoreGraphics.framework",
"UIKit.framework",
"GLKit.framework",
"OpenGLES.framework",
"XCTest.framework" ]);
def set_project_name(self, name): def set_project_name(self, name):
self.name = name self.name = name
self.baseId = convert_name_in_base_id(name) self.baseId = convert_name_in_base_id(name)
def add_files(self, group, basePath, srcList): def add_files(self, group, basePath, srcList):
genericID = 100001 if group not in self.groups.keys() :
groupBaseID = convert_name_in_base_id(group) self.groups[group] = {
if group in self.groups.keys() : "list-files" : [],
debug.error("use case not manage yet ...") "extra-flags" : []
return }
reworkedListFile = []
for element in srcList: for element in srcList:
debug.info("plop : " + str(element)) debug.info("plop : " + str(element))
debug.info("plop : " + str(basePath)) debug.info("plop : " + str(basePath))
@ -217,17 +234,38 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
if pos >= 0: if pos >= 0:
extention = simpleName[pos+1:] extention = simpleName[pos+1:]
reworkedListFile.append({ "path" : path, self.groups[group]["list-files"].append({
"name" : simpleName, "path" : path,
"extention":extention, "name" : simpleName,
"declare-name":element, "extention":extention,
"id" : groupBaseID + str(genericID)}) "declare-name":element})
genericID += 1
self.groups[group] = { def add_data_file(self, basePath, srcList):
"id" : groupBaseID + str(genericID + 100000), realBasePath = os.path.realpath(basePath)
"list-files" : reworkedListFile, if realBasePath[-1] == "/":
"extra-flags" : [] realBasePath = realBasePath[:-1]
} debug.debug("add data file : " + str(srcList))
for realName,destName in srcList:
tools.copy_file(realBasePath+'/'+realName, 'out/iOs/' + self.name + '.xcodeproj/data/' + destName, force=True)
self.add_files("data", 'out/iOs/' + self.name + 'xcodeprj/data', [destName])
def add_data_folder(self, basePath, srcList):
realBasePath = basePath
if realBasePath[-1] == "/":
realBasePath = realBasePath[:-1]
debug.debug("add data folder : " + str(srcList))
for inputPath,outputPath in srcList:
tmpPath = os.path.dirname(os.path.realpath(realBasePath + '/' + inputPath))
tmpRule = os.path.basename(inputPath)
debug.warning(" add folder : '" + tmpPath + "' rule : '" + tmpRule + "'")
for root, dirnames, filenames in os.walk(tmpPath):
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
self.add_data_file(tmpPath, [[cycleFile, outputPath+cycleFile]])
def generate_project_file(self): def generate_project_file(self):
@ -248,9 +286,15 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
for files in element["list-files"]: for files in element["list-files"]:
debug.debug(" PBXBuildFile ?? " + str(files)) debug.debug(" PBXBuildFile ?? " + str(files))
if files["extention"] in XCodeTypeElements.keys(): if files["extention"] in XCodeTypeElements.keys():
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase": if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase" \
data +=' /* ' + files["name"] + ' */\n' or XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase"\
data +=' ************************ = { isa = PBXBuildFile; fileRef = ' + files["id"] + '; };\n' or XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase"\
or XCodeTypeElements[files["extention"]][1] == "PBXVariantGroup":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + ' */ = {'
data +=' isa = PBXBuildFile;'
data +=' fileRef = ' + convert_folder_in_base_id(files["declare-name"], group) + ';'
data +=' };\n'
data +='/* End PBXBuildFile section */\n' data +='/* End PBXBuildFile section */\n'
data +='\n' data +='\n'
data +='/* Begin PBXContainerItemProxy section */\n' data +='/* Begin PBXContainerItemProxy section */\n'
@ -281,82 +325,19 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
debug.debug(" PBXBuildFile ?? " + str(files)) debug.debug(" PBXBuildFile ?? " + str(files))
data +=' /* ' + files["name"] + ' */\n' data +=' /* ' + files["name"] + ' */\n'
if files["extention"] in XCodeTypeElements.keys(): if files["extention"] in XCodeTypeElements.keys():
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {' data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;' data +=' isa = PBXBuildFile;'
data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';' data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';' data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';' data +=' name = ' + files["name"] + ';'
data +=' sourceTree = "<group>"; };\n' data +=' sourceTree = ' + XCodeTypeElements[files["extention"]][2] + '; };\n'
else: else:
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {' data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;' data +=' isa = PBXBuildFile;'
data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';' #data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';' data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';' data +=' name = ' + files["name"] + ';'
data +=' sourceTree = "<group>"; };\n' data +=' sourceTree = "<group>"; };\n'
"""
data +=' FFBA2F78187F44AE0034CC66 /* Foundation.framework */ = {''
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };\n'
data +=' FFBA2F7A187F44AE0034CC66 /* CoreGraphics.framework */ = {'
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
data +=' FFBA2F7C187F44AE0034CC66 /* UIKit.framework */ = {
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
data +=' FFBA2F7E187F44AE0034CC66 /* GLKit.framework */ = {
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
data +=' FFBA2F80187F44AE0034CC66 /* OpenGLES.framework */ = {
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
data +=' FFBA2F84187F44AE0034CC66 /* edn-Info.plist */ = {
data +=' isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "edn-Info.plist"; sourceTree = "<group>"; };
data +=' FFBA2F86187F44AE0034CC66 /* en */ = {
data +=' isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
data +=' FFBA2F88187F44AE0034CC66 /* main.m */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
data +=' FFBA2F8A187F44AE0034CC66 /* edn-Prefix.pch */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "edn-Prefix.pch"; sourceTree = "<group>"; };
data +=' FFBA2F8B187F44AE0034CC66 /* AppDelegate.h */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
data +=' FFBA2F8C187F44AE0034CC66 /* AppDelegate.m */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
data +=' FFBA2F8F187F44AE0034CC66 /* Base */ = {
data +=' isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = "<group>"; };
data +=' FFBA2F92187F44AE0034CC66 /* Base */ = {
data +=' isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = "<group>"; };
data +=' FFBA2F94187F44AE0034CC66 /* Shader.fsh */ = {
data +=' isa = PBXFileReference;
data +=' lastKnownFileType = sourcecode.glsl;
data +=' name = Shader.fsh;
data +=' path = Shaders/Shader.fsh;
data +=' sourceTree = "<group>";
data +=' };
data +=' FFBA2F96187F44AE0034CC66 /* Shader.vsh */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = "<group>"; };
data +=' FFBA2F98187F44AE0034CC66 /* ViewController.h */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
data +=' FFBA2F99187F44AE0034CC66 /* ViewController.m */ = {
data +=' isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
data +=' FFBA2F9B187F44AE0034CC66 /* Images.xcassets */ = {
data +=' isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
data +=' FFBA2FA1187F44AE0034CC66 /* ednTests.xctest */ = {
data +=' isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ednTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
data +=' FFBA2FA2187F44AE0034CC66 /* XCTest.framework */ = {
data +=' isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
data +=' FFBA2FAA187F44AF0034CC66 /* ednTests-Info.plist */ = {
data +=' isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ednTests-Info.plist"; sourceTree = "<group>"; };
data +=' FFBA2FAC187F44AF0034CC66 /* en */ = {
data +=' isa = PBXFileReference;
data +=' lastKnownFileType = text.plist.strings;
data +=' name = en;
data +=' path = en.lproj/InfoPlist.strings;
data +=' sourceTree = "<group>";
data +=' };
data +=' FFBA2FAE187F44AF0034CC66 /* ednTests.m */ = {\n'
data +=' isa = PBXFileReference;\n'
data +=' lastKnownFileType = sourcecode.c.objc;\n'
data +=' path = ednTests.m;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
"""
data +='/* End PBXFileReference section */\n' data +='/* End PBXFileReference section */\n'
data +='\n' data +='\n'
@ -366,11 +347,14 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' isa = PBXFrameworksBuildPhase;\n' data +=' isa = PBXFrameworksBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n' data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n' data +=' files = (\n'
data +=' FFBA2F81187F44AE0034CC66 /* OpenGLES.framework in Frameworks */,\n' for group in self.groups:
data +=' FFBA2F7B187F44AE0034CC66 /* CoreGraphics.framework in Frameworks */,\n' element = self.groups[group]
data +=' FFBA2F7D187F44AE0034CC66 /* UIKit.framework in Frameworks */,\n' for files in element["list-files"]:
data +=' FFBA2F7F187F44AE0034CC66 /* GLKit.framework in Frameworks */,\n' if files["extention"] not in XCodeTypeElements.keys():
data +=' FFBA2F79187F44AE0034CC66 /* Foundation.framework in Frameworks */,\n' continue
if XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + '*/,\n'
data +=' );\n' data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n' data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n' data +=' };\n'
@ -382,9 +366,8 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ' = {\n' data +=' ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ' = {\n'
data +=' isa = PBXGroup;\n' data +=' isa = PBXGroup;\n'
data +=' children = (\n' data +=' children = (\n'
for group, element in self.groups: for group in self.groups:
data +=' ' + convert_folder_in_base_id("?tree?", group) + ' /* ' + group + ' */,\n' data +=' ' + convert_folder_in_base_id("?tree?", group) + ' /* ' + group + ' */,\n'
data +=' ' + convert_folder_in_base_id("?tree?", "frameworks") + ' /* Frameworks */,\n'
data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */,\n' data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */,\n'
data +=' );\n' data +=' );\n'
data +=' sourceTree = "<group>";\n' data +=' sourceTree = "<group>";\n'
@ -397,55 +380,14 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' name = Products;\n' data +=' name = Products;\n'
data +=' sourceTree = "<group>";\n' data +=' sourceTree = "<group>";\n'
data +=' };\n' data +=' };\n'
data +=' ' + convert_folder_in_base_id("?tree?", "frameworks") + ' /* Frameworks */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
data +=' FFBA2F78187F44AE0034CC66 /* Foundation.framework */,\n'
data +=' FFBA2F7A187F44AE0034CC66 /* CoreGraphics.framework */,\n'
data +=' FFBA2F7C187F44AE0034CC66 /* UIKit.framework */,\n'
data +=' FFBA2F7E187F44AE0034CC66 /* GLKit.framework */,\n'
data +=' FFBA2F80187F44AE0034CC66 /* OpenGLES.framework */,\n'
data +=' FFBA2FA2187F44AE0034CC66 /* XCTest.framework */,\n'
data +=' );\n'
data +=' name = Frameworks;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
# treeview : # treeview :
for group, element in self.groups: for group in self.groups:
element = self.groups[group]
main_dict = defaultdict(dict, ((FILE_MARKER, []),)) main_dict = defaultdict(dict, ((FILE_MARKER, []),))
for line in element["list-files"]: for line in element["list-files"]:
attach(line["declare-name"], main_dict) attach(line["declare-name"], main_dict)
#prettify(main_dict);
data += generate_tree(main_dict, group) data += generate_tree(main_dict, group)
"""
data +=' FFBA2F82187F44AE0034CC66 /* edn */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
data +=' FFBA2F8B187F44AE0034CC66 /* AppDelegate.h */,\n'
data +=' FFBA2F8C187F44AE0034CC66 /* AppDelegate.m */,\n'
data +=' FFBA2F8E187F44AE0034CC66 /* Main_iPhone.storyboard */,\n'
data +=' FFBA2F91187F44AE0034CC66 /* Main_iPad.storyboard */,\n'
data +=' FFBA2F94187F44AE0034CC66 /* Shader.fsh */,\n'
data +=' FFBA2F96187F44AE0034CC66 /* Shader.vsh */,\n'
data +=' FFBA2F98187F44AE0034CC66 /* ViewController.h */,\n'
data +=' FFBA2F99187F44AE0034CC66 /* ViewController.m */,\n'
data +=' FFBA2F9B187F44AE0034CC66 /* Images.xcassets */,\n'
data +=' FFBA2F83187F44AE0034CC66 /* Supporting Files */,\n'
data +=' );\n'
data +=' path = edn;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2F83187F44AE0034CC66 /* Supporting Files */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
data +=' FFBA2F84187F44AE0034CC66 /* edn-Info.plist */,\n'
data +=' FFBA2F85187F44AE0034CC66 /* InfoPlist.strings */,\n'
data +=' FFBA2F88187F44AE0034CC66 /* main.m */,\n'
data +=' FFBA2F8A187F44AE0034CC66 /* edn-Prefix.pch */,\n'
data +=' );\n'
data +=' name = "Supporting Files";\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
"""
data +='/* End PBXGroup section */\n' data +='/* End PBXGroup section */\n'
data +='\n' data +='\n'
@ -509,14 +451,14 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' buildActionMask = 2147483647;\n' data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n' data +=' files = (\n'
# list of all resources to copy # list of all resources to copy
""" for group in self.groups:
data +=' FFBA2F95187F44AE0034CC66 /* Shader.fsh in Resources */,\n' element = self.groups[group]
data +=' FFBA2F93187F44AE0034CC66 /* Main_iPad.storyboard in Resources */,\n' for files in element["list-files"]:
data +=' FFBA2F90187F44AE0034CC66 /* Main_iPhone.storyboard in Resources */,\n' if files["extention"] in XCodeTypeElements.keys():
data +=' FFBA2F9C187F44AE0034CC66 /* Images.xcassets in Resources */,\n' if XCodeTypeElements[files["extention"]][1] == "PBXResourcesBuildPhase":
data +=' FFBA2F87187F44AE0034CC66 /* InfoPlist.strings in Resources */,\n' data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group) + ' = {'
data +=' FFBA2F97187F44AE0034CC66 /* Shader.vsh in Resources */,\n' data +=' /* ' + files["name"] + ' in ' + group + ' */'
""" data +=' ,\n'
data +=' );\n' data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n' data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n' data +=' };\n'
@ -530,11 +472,15 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' buildActionMask = 2147483647;\n' data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n' data +=' files = (\n'
# list of all file to compile ... # list of all file to compile ...
""" # TODO : review this ==> generate to many files ...
data +=' FFBA2F9A187F44AE0034CC66 /* ViewController.m in Sources */,\n' for group in self.groups:
data +=' FFBA2F8D187F44AE0034CC66 /* AppDelegate.m in Sources */,\n' element = self.groups[group]
data +=' FFBA2F89187F44AE0034CC66 /* main.m in Sources */,\n' for files in element["list-files"]:
""" if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + group + " : " + files["name"] + ' */,\n'
data +=' );\n' data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n' data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n' data +=' };\n'
@ -546,6 +492,17 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +='/* End PBXTargetDependency section */\n' data +='/* End PBXTargetDependency section */\n'
data +='\n' data +='\n'
data +='/* Begin PBXVariantGroup section */\n' data +='/* Begin PBXVariantGroup section */\n'
# not really needed, because it is for internal system data position ==> maybe change it if necessary ...
"""
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
"""
""" """
data +=' FFBA2F85187F44AE0034CC66 /* InfoPlist.strings */ = {\n' data +=' FFBA2F85187F44AE0034CC66 /* InfoPlist.strings */ = {\n'
data +=' isa = PBXVariantGroup;\n' data +=' isa = PBXVariantGroup;\n'
@ -707,10 +664,16 @@ class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
data +=' };\n' data +=' };\n'
data +='/* End XCConfigurationList section */\n' data +='/* End XCConfigurationList section */\n'
data +=' };\n' data +=' };\n'
data +=' rootObject = ******************* /* Project object */;\n' data +=' rootObject = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Project object */;\n'
data +='}\n' data +='}\n'
debug.info(data) #debug.info(data)
outName = 'out/iOs/' + self.name + '.xcodeproj/project.pbxproj'
tools.create_directory_of_file(outName)
tools.file_write_data(outName, data)
# TODO : Generate all dependency files ...

View File

@ -668,9 +668,22 @@ class Module:
# TODO : Check values... # TODO : Check values...
self.packageProp[variable].append(value) self.packageProp[variable].append(value)
def ext_project_add_module(self, target, projectMng, addedModule = []):
if self.name in addedModule:
return
addedModule.append(self.name)
debug.verbose("add a module to the project generator :" + self.name)
debug.verbose("local path :" + self.originFolder)
projectMng.add_files(self.name, self.originFolder, self.src)
projectMng.add_data_file(self.originFolder, self.files)
projectMng.add_data_folder(self.originFolder, self.folders)
for depend in self.depends:
target.project_add_module(depend, projectMng, addedModule)
def create_project(self, target, projectMng): def create_project(self, target, projectMng):
projectMng.set_project_name(self.name) projectMng.set_project_name(self.name)
projectMng.add_files(self.name, self.local_path[0], self.src) self.ext_project_add_module(target, projectMng)
projectMng.generate_project_file() projectMng.generate_project_file()

View File

@ -217,6 +217,12 @@ class Target:
for modName in listOfAllTheModule: for modName in listOfAllTheModule:
self.load_if_needed(modName) self.load_if_needed(modName)
def project_add_module(self, name, projectMng, addedModule):
for module in self.moduleList:
if module.name == name:
module.ext_project_add_module(self, projectMng, addedModule)
return
def build(self, name, packagesName=None): def build(self, name, packagesName=None):
if name == "dump": if name == "dump":
debug.info("dump all") debug.info("dump all")