|
|
@@ -38,373 +38,391 @@
|
|
|
namespace ToolCore
|
|
|
{
|
|
|
|
|
|
- NETProjectBase::NETProjectBase(Context* context, NETProjectGen* projectGen) :
|
|
|
- Object(context), xmlFile_(new XMLFile(context)), projectGen_(projectGen)
|
|
|
- {
|
|
|
+ NETProjectBase::NETProjectBase(Context* context, NETProjectGen* projectGen) :
|
|
|
+ Object(context), xmlFile_(new XMLFile(context)), projectGen_(projectGen)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETProjectBase::~NETProjectBase()
|
|
|
- {
|
|
|
+ NETProjectBase::~NETProjectBase()
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- void NETProjectBase::ReplacePathStrings(String& path)
|
|
|
- {
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ void NETProjectBase::ReplacePathStrings(String& path)
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
|
|
|
- String atomicRoot = tenv->GetRootSourceDir();
|
|
|
- atomicRoot = RemoveTrailingSlash(atomicRoot);
|
|
|
+ String atomicRoot = tenv->GetRootSourceDir();
|
|
|
+ atomicRoot = RemoveTrailingSlash(atomicRoot);
|
|
|
|
|
|
- path.Replace("$ATOMIC_ROOT$", atomicRoot, false);
|
|
|
+ path.Replace("$ATOMIC_ROOT$", atomicRoot, false);
|
|
|
|
|
|
- String atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
+ String atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
|
|
|
- // TODO: This is the cause of a bunch of "GetSanitizedPath" calls,
|
|
|
- // It should be removed, and the few places in csproj/sln that need backslash
|
|
|
- // adjusted there
|
|
|
- atomicProjectPath.Replace("/", "\\");
|
|
|
+ // TODO: This is the cause of a bunch of "GetSanitizedPath" calls,
|
|
|
+ // It should be removed, and the few places in csproj/sln that need backslash
|
|
|
+ // adjusted there
|
|
|
+ atomicProjectPath.Replace("/", "\\");
|
|
|
|
|
|
- if (atomicProjectPath.Length())
|
|
|
- {
|
|
|
- path.Replace("$ATOMIC_PROJECT_ROOT$", atomicProjectPath, false);
|
|
|
- }
|
|
|
+ if (atomicProjectPath.Length())
|
|
|
+ {
|
|
|
+ path.Replace("$ATOMIC_PROJECT_ROOT$", atomicProjectPath, false);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETCSProject::NETCSProject(Context* context, NETProjectGen* projectGen) : NETProjectBase(context, projectGen),
|
|
|
- androidApplication_(false),
|
|
|
- playerApplication_(false)
|
|
|
- {
|
|
|
+ NETCSProject::NETCSProject(Context* context, NETProjectGen* projectGen) : NETProjectBase(context, projectGen),
|
|
|
+ androidApplication_(false),
|
|
|
+ playerApplication_(false)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETCSProject::~NETCSProject()
|
|
|
- {
|
|
|
+ NETCSProject::~NETCSProject()
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETCSProject::SupportsDesktop() const
|
|
|
- {
|
|
|
- if (!platforms_.Size())
|
|
|
- return true;
|
|
|
+ bool NETCSProject::SupportsDesktop() const
|
|
|
+ {
|
|
|
+ if (!platforms_.Size())
|
|
|
+ return true;
|
|
|
|
|
|
- if (platforms_.Contains("desktop") || platforms_.Contains("windows") || platforms_.Contains("macosx") || platforms_.Contains("linux"))
|
|
|
- return true;
|
|
|
+ if (platforms_.Contains("desktop") || platforms_.Contains("windows") || platforms_.Contains("macosx") || platforms_.Contains("linux"))
|
|
|
+ return true;
|
|
|
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETCSProject::SupportsPlatform(const String& platform, bool explicitCheck) const
|
|
|
- {
|
|
|
- if (!explicitCheck && !platforms_.Size())
|
|
|
- return true;
|
|
|
+ bool NETCSProject::SupportsPlatform(const String& platform, bool explicitCheck) const
|
|
|
+ {
|
|
|
+ if (!explicitCheck && !platforms_.Size())
|
|
|
+ return true;
|
|
|
|
|
|
- if (platforms_.Contains(platform.ToLower()))
|
|
|
- return true;
|
|
|
+ if (platforms_.Contains(platform.ToLower()))
|
|
|
+ return true;
|
|
|
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETCSProject::CreateProjectFolder(const String& path)
|
|
|
- {
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+ bool NETCSProject::CreateProjectFolder(const String& path)
|
|
|
+ {
|
|
|
+ FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+
|
|
|
+ if (fileSystem->DirExists(path))
|
|
|
+ return true;
|
|
|
|
|
|
- if (fileSystem->DirExists(path))
|
|
|
- return true;
|
|
|
+ fileSystem->CreateDirsRecursive(path);
|
|
|
|
|
|
- fileSystem->CreateDirsRecursive(path);
|
|
|
+ if (!fileSystem->DirExists(path))
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("Unable to create dir: %s", path.CString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- if (!fileSystem->DirExists(path))
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("Unable to create dir: %s", path.CString());
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
+ void NETCSProject::CreateCompileItemGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ FileSystem* fs = GetSubsystem<FileSystem>();
|
|
|
|
|
|
- void NETCSProject::CreateCompileItemGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- FileSystem* fs = GetSubsystem<FileSystem>();
|
|
|
+ XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
|
|
|
- XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+ // Compile AssemblyInfo.cs
|
|
|
|
|
|
- // Compile AssemblyInfo.cs
|
|
|
+ if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
|
|
|
+ igroup.CreateChild("Compile").SetAttribute("Include", "Properties\\AssemblyInfo.cs");
|
|
|
|
|
|
- if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
|
|
|
- igroup.CreateChild("Compile").SetAttribute("Include", "Properties\\AssemblyInfo.cs");
|
|
|
+ for (unsigned i = 0; i < sourceFolders_.Size(); i++)
|
|
|
+ {
|
|
|
+ const String& sourceFolder = sourceFolders_[i];
|
|
|
|
|
|
- for (unsigned i = 0; i < sourceFolders_.Size(); i++)
|
|
|
- {
|
|
|
- const String& sourceFolder = sourceFolders_[i];
|
|
|
+ Vector<String> result;
|
|
|
+ fs->ScanDir(result, sourceFolder, "*.cs", SCAN_FILES, true);
|
|
|
|
|
|
- Vector<String> result;
|
|
|
- fs->ScanDir(result, sourceFolder, "*.cs", SCAN_FILES, true);
|
|
|
+ for (unsigned j = 0; j < result.Size(); j++)
|
|
|
+ {
|
|
|
+ XMLElement compile = igroup.CreateChild("Compile");
|
|
|
|
|
|
- for (unsigned j = 0; j < result.Size(); j++)
|
|
|
- {
|
|
|
- XMLElement compile = igroup.CreateChild("Compile");
|
|
|
+ String path = sourceFolder + result[j];
|
|
|
|
|
|
- String path = sourceFolder + result[j];
|
|
|
+ String relativePath;
|
|
|
|
|
|
- String relativePath;
|
|
|
+ if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
+ {
|
|
|
+ path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
+ }
|
|
|
|
|
|
- if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
- {
|
|
|
- path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
- }
|
|
|
+ // IMPORTANT: / Slash direction breaks intellisense :/
|
|
|
+ path.Replace('/', '\\');
|
|
|
|
|
|
- // IMPORTANT: / Slash direction breaks intellisense :/
|
|
|
- path.Replace('/', '\\');
|
|
|
+ compile.SetAttribute("Include", path.CString());
|
|
|
|
|
|
- compile.SetAttribute("Include", path.CString());
|
|
|
+ // put generated files into generated folder
|
|
|
+ if (sourceFolder.Contains("Generated") && sourceFolder.Contains("CSharp") && sourceFolder.Contains("Packages"))
|
|
|
+ {
|
|
|
+ compile.CreateChild("Link").SetValue("Generated\\" + result[j]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ compile.CreateChild("Link").SetValue(result[j]);
|
|
|
+ }
|
|
|
|
|
|
- // put generated files into generated folder
|
|
|
- if (sourceFolder.Contains("Generated") && sourceFolder.Contains("CSharp") && sourceFolder.Contains("Packages"))
|
|
|
- {
|
|
|
- compile.CreateChild("Link").SetValue("Generated\\" + result[j]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- compile.CreateChild("Link").SetValue(result[j]);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ void NETProjectBase::CopyXMLElementRecursive(XMLElement source, XMLElement dest)
|
|
|
+ {
|
|
|
+ Vector<String> attrNames = source.GetAttributeNames();
|
|
|
|
|
|
- void NETProjectBase::CopyXMLElementRecursive(XMLElement source, XMLElement dest)
|
|
|
- {
|
|
|
- Vector<String> attrNames = source.GetAttributeNames();
|
|
|
+ for (unsigned i = 0; i < attrNames.Size(); i++)
|
|
|
+ {
|
|
|
+ String value = source.GetAttribute(attrNames[i]);
|
|
|
+ dest.SetAttribute(attrNames[i], value);
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < attrNames.Size(); i++)
|
|
|
- {
|
|
|
- String value = source.GetAttribute(attrNames[i]);
|
|
|
- dest.SetAttribute(attrNames[i], value);
|
|
|
- }
|
|
|
+ dest.SetValue(source.GetValue());
|
|
|
|
|
|
- dest.SetValue(source.GetValue());
|
|
|
+ XMLElement child = source.GetChild();
|
|
|
|
|
|
- XMLElement child = source.GetChild();
|
|
|
+ while (child.NotNull() && child.GetName().Length())
|
|
|
+ {
|
|
|
+ XMLElement childDest = dest.CreateChild(child.GetName());
|
|
|
+ CopyXMLElementRecursive(child, childDest);
|
|
|
+ child = child.GetNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- while (child.NotNull() && child.GetName().Length())
|
|
|
- {
|
|
|
- XMLElement childDest = dest.CreateChild(child.GetName());
|
|
|
- CopyXMLElementRecursive(child, childDest);
|
|
|
- child = child.GetNext();
|
|
|
- }
|
|
|
- }
|
|
|
+ void NETCSProject::CreateReferencesItemGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
|
|
|
- void NETCSProject::CreateReferencesItemGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ XMLElement xref;
|
|
|
+ XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
|
|
|
- XMLElement xref;
|
|
|
- XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+ for (unsigned i = 0; i < references_.Size(); i++)
|
|
|
+ {
|
|
|
+ String ref = references_[i];
|
|
|
|
|
|
- for (unsigned i = 0; i < references_.Size(); i++)
|
|
|
- {
|
|
|
- String ref = references_[i];
|
|
|
+ // project reference
|
|
|
+ if (projectGen_->GetCSProjectByName(ref))
|
|
|
+ continue;
|
|
|
|
|
|
- // project reference
|
|
|
- if (projectGen_->GetCSProjectByName(ref))
|
|
|
- continue;
|
|
|
+ String platform;
|
|
|
|
|
|
- String platform;
|
|
|
+ if (projectGen_->GetAtomicProjectPath().Length() && ref.StartsWith("AtomicNET"))
|
|
|
+ {
|
|
|
+ if (GetIsPCL())
|
|
|
+ {
|
|
|
+ ref = "AtomicNET";
|
|
|
+ platform = "Portable";
|
|
|
+ }
|
|
|
+ else if (SupportsDesktop())
|
|
|
+ {
|
|
|
+ ref = "AtomicNET";
|
|
|
+ platform = "Desktop";
|
|
|
+ }
|
|
|
+ else if (SupportsPlatform("android"))
|
|
|
+ {
|
|
|
+ if (ref != "AtomicNET.Android.SDL")
|
|
|
+ ref = "AtomicNET";
|
|
|
|
|
|
- if (projectGen_->GetAtomicProjectPath().Length() && ref.StartsWith("AtomicNET"))
|
|
|
- {
|
|
|
- if (GetIsPCL())
|
|
|
- {
|
|
|
- ref = "AtomicNET";
|
|
|
- platform = "Portable";
|
|
|
- }
|
|
|
- else if (SupportsDesktop())
|
|
|
- {
|
|
|
- ref = "AtomicNET";
|
|
|
- platform = "Desktop";
|
|
|
- }
|
|
|
- else if (SupportsPlatform("android"))
|
|
|
- {
|
|
|
- if (ref != "AtomicNET.Android.SDL")
|
|
|
- ref = "AtomicNET";
|
|
|
+ platform = "Android";
|
|
|
+ }
|
|
|
+ else if (SupportsPlatform("ios"))
|
|
|
+ {
|
|
|
+ ref = "AtomicNET";
|
|
|
+ platform = "iOS";
|
|
|
+ }
|
|
|
|
|
|
- platform = "Android";
|
|
|
- }
|
|
|
|
|
|
- if (platform.Length())
|
|
|
- {
|
|
|
- String atomicNETAssembly = tenv->GetAtomicNETCoreAssemblyDir() + ToString("%s/%s.dll", platform.CString(), ref.CString());
|
|
|
- xref = igroup.CreateChild("Reference");
|
|
|
- xref.SetAttribute("Include", atomicNETAssembly);
|
|
|
- }
|
|
|
+ if (platform.Length())
|
|
|
+ {
|
|
|
+ String atomicNETAssembly = tenv->GetAtomicNETCoreAssemblyDir() + ToString("%s/%s.dll", platform.CString(), ref.CString());
|
|
|
+ xref = igroup.CreateChild("Reference");
|
|
|
+ xref.SetAttribute("Include", atomicNETAssembly);
|
|
|
+ }
|
|
|
|
|
|
- continue;
|
|
|
+ continue;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- // NuGet project
|
|
|
- if (ref.StartsWith("<"))
|
|
|
- {
|
|
|
- XMLFile xmlFile(context_);
|
|
|
+ // NuGet project
|
|
|
+ if (ref.StartsWith("<"))
|
|
|
+ {
|
|
|
+ XMLFile xmlFile(context_);
|
|
|
|
|
|
- if (!xmlFile.FromString(ref))
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("NETCSProject::CreateReferencesItemGroup - Unable to parse reference XML");
|
|
|
- }
|
|
|
+ if (!xmlFile.FromString(ref))
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("NETCSProject::CreateReferencesItemGroup - Unable to parse reference XML");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- xref = igroup.CreateChild("Reference");
|
|
|
- CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ xref = igroup.CreateChild("Reference");
|
|
|
+ CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- xref = igroup.CreateChild("Reference");
|
|
|
- xref.SetAttribute("Include", ref);
|
|
|
+ xref = igroup.CreateChild("Reference");
|
|
|
+ xref.SetAttribute("Include", ref);
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- const String atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
+ const String atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
|
|
|
- if (atomicProjectPath.Length())
|
|
|
- {
|
|
|
- String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
|
|
|
+ if (atomicProjectPath.Length())
|
|
|
+ {
|
|
|
+ String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
|
|
|
|
|
|
- Vector<String> result;
|
|
|
- GetSubsystem<FileSystem>()->ScanDir(result, resourceDir , "*.dll", SCAN_FILES, true);
|
|
|
+ Vector<String> result;
|
|
|
+ GetSubsystem<FileSystem>()->ScanDir(result, resourceDir , "*.dll", SCAN_FILES, true);
|
|
|
|
|
|
- for (unsigned j = 0; j < result.Size(); j++)
|
|
|
- {
|
|
|
- String path = resourceDir + result[j];
|
|
|
+ for (unsigned j = 0; j < result.Size(); j++)
|
|
|
+ {
|
|
|
+ String path = resourceDir + result[j];
|
|
|
|
|
|
- String relativePath;
|
|
|
+ String relativePath;
|
|
|
|
|
|
- if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
- {
|
|
|
- if (projectGen_->GetCSProjectByName(GetFileName(path)))
|
|
|
- continue;
|
|
|
+ if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
+ {
|
|
|
+ if (projectGen_->GetCSProjectByName(GetFileName(path)))
|
|
|
+ continue;
|
|
|
|
|
|
- path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
- }
|
|
|
+ path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
+ }
|
|
|
|
|
|
- xref = igroup.CreateChild("Reference");
|
|
|
- xref.SetAttribute("Include", path);
|
|
|
- }
|
|
|
+ xref = igroup.CreateChild("Reference");
|
|
|
+ xref.SetAttribute("Include", path);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- void NETCSProject::CreateProjectReferencesItemGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
+ void NETCSProject::CreateProjectReferencesItemGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
|
|
|
- XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+ XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
|
|
|
- for (unsigned i = 0; i < references_.Size(); i++)
|
|
|
- {
|
|
|
- const String& ref = references_[i];
|
|
|
- NETCSProject* project = projectGen_->GetCSProjectByName(ref);
|
|
|
+ for (unsigned i = 0; i < references_.Size(); i++)
|
|
|
+ {
|
|
|
+ const String& ref = references_[i];
|
|
|
+ NETCSProject* project = projectGen_->GetCSProjectByName(ref);
|
|
|
|
|
|
- if (!project)
|
|
|
- continue;
|
|
|
+ if (!project)
|
|
|
+ continue;
|
|
|
|
|
|
|
|
|
- XMLElement projectRef = igroup.CreateChild("ProjectReference");
|
|
|
- projectRef.SetAttribute("Include", ToString("..\\%s\\%s.csproj", ref.CString(), ref.CString()));
|
|
|
+ XMLElement projectRef = igroup.CreateChild("ProjectReference");
|
|
|
+ projectRef.SetAttribute("Include", ToString("..\\%s\\%s.csproj", ref.CString(), ref.CString()));
|
|
|
|
|
|
- XMLElement xproject = projectRef.CreateChild("Project");
|
|
|
- xproject.SetValue(ToString("{%s}", project->GetProjectGUID().ToLower().CString()));
|
|
|
+ XMLElement xproject = projectRef.CreateChild("Project");
|
|
|
+ xproject.SetValue(ToString("{%s}", project->GetProjectGUID().ToLower().CString()));
|
|
|
|
|
|
- XMLElement xname = projectRef.CreateChild("Name");
|
|
|
- xname.SetValue(project->GetName());
|
|
|
- }
|
|
|
- }
|
|
|
+ XMLElement xname = projectRef.CreateChild("Name");
|
|
|
+ xname.SetValue(project->GetName());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- void NETCSProject::CreatePackagesItemGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- if (!packages_.Size())
|
|
|
- return;
|
|
|
+ void NETCSProject::CreatePackagesItemGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ if (!packages_.Size())
|
|
|
+ return;
|
|
|
|
|
|
- XMLElement xref;
|
|
|
- XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
- xref = igroup.CreateChild("None");
|
|
|
- xref.SetAttribute("Include", "packages.config");
|
|
|
+ XMLElement xref;
|
|
|
+ XMLElement igroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+ xref = igroup.CreateChild("None");
|
|
|
+ xref.SetAttribute("Include", "packages.config");
|
|
|
|
|
|
- XMLFile packageConfig(context_);
|
|
|
+ XMLFile packageConfig(context_);
|
|
|
|
|
|
- XMLElement packageRoot = packageConfig.CreateRoot("packages");
|
|
|
+ XMLElement packageRoot = packageConfig.CreateRoot("packages");
|
|
|
|
|
|
- for (unsigned i = 0; i < packages_.Size(); i++)
|
|
|
- {
|
|
|
- XMLFile xmlFile(context_);
|
|
|
- if (!xmlFile.FromString(packages_[i]))
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("NETCSProject::CreatePackagesItemGroup - Unable to parse package xml");
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < packages_.Size(); i++)
|
|
|
+ {
|
|
|
+ XMLFile xmlFile(context_);
|
|
|
+ if (!xmlFile.FromString(packages_[i]))
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("NETCSProject::CreatePackagesItemGroup - Unable to parse package xml");
|
|
|
+ }
|
|
|
|
|
|
- xref = packageRoot.CreateChild("package");
|
|
|
+ xref = packageRoot.CreateChild("package");
|
|
|
|
|
|
- CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
|
|
|
- }
|
|
|
+ CopyXMLElementRecursive(xmlFile.GetRoot(), xref);
|
|
|
+ }
|
|
|
|
|
|
SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + "packages.config"), FILE_WRITE));
|
|
|
- String source = packageConfig.ToString();
|
|
|
- output->Write(source.CString(), source.Length());
|
|
|
+ String source = packageConfig.ToString();
|
|
|
+ output->Write(source.CString(), source.Length());
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ void NETCSProject::GetAssemblySearchPaths(String& paths)
|
|
|
+ {
|
|
|
+ paths.Clear();
|
|
|
|
|
|
- void NETCSProject::GetAssemblySearchPaths(String& paths)
|
|
|
- {
|
|
|
- paths.Clear();
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ Vector<String> searchPaths;
|
|
|
|
|
|
- Vector<String> searchPaths;
|
|
|
+ if (assemblySearchPaths_.Length())
|
|
|
+ searchPaths.Push(assemblySearchPaths_);
|
|
|
|
|
|
- if (assemblySearchPaths_.Length())
|
|
|
- searchPaths.Push(assemblySearchPaths_);
|
|
|
+ paths.Join(searchPaths, ";");
|
|
|
+ }
|
|
|
|
|
|
- paths.Join(searchPaths, ";");
|
|
|
- }
|
|
|
+ void NETCSProject::ProcessDefineConstants(StringVector& constants)
|
|
|
+ {
|
|
|
+ const Vector<String>& globalConstants = projectGen_->GetGlobalDefineConstants();
|
|
|
+ constants += globalConstants;
|
|
|
|
|
|
- void NETCSProject::CreateReleasePropertyGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
- pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ");
|
|
|
+ if (constants.Contains("ATOMIC_IOS") || constants.Contains("ATOMIC_ANDROID"))
|
|
|
+ constants.Push("ATOMIC_MOBILE");
|
|
|
+ }
|
|
|
|
|
|
- pgroup.CreateChild("Optimize").SetValue("true");
|
|
|
+ void NETCSProject::CreateReleasePropertyGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
|
|
|
- String outputPath = assemblyOutputPath_;
|
|
|
- outputPath.Replace("$ATOMIC_CONFIG$", "Release");
|
|
|
+ if (playerApplication_ && SupportsPlatform("ios"))
|
|
|
+ pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Release|iPhone' ");
|
|
|
+ else
|
|
|
+ pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ");
|
|
|
|
|
|
- pgroup.CreateChild("OutputPath").SetValue(outputPath);
|
|
|
+ pgroup.CreateChild("Optimize").SetValue("true");
|
|
|
|
|
|
- Vector<String> constants;
|
|
|
- constants.Push("TRACE");
|
|
|
+ String outputPath = assemblyOutputPath_;
|
|
|
+ outputPath.Replace("$ATOMIC_CONFIG$", "Release");
|
|
|
|
|
|
- constants += defineConstants_;
|
|
|
+ pgroup.CreateChild("OutputPath").SetValue(outputPath);
|
|
|
|
|
|
- const Vector<String>& globalConstants = projectGen_->GetGlobalDefineConstants();
|
|
|
- constants += globalConstants;
|
|
|
+ Vector<String> constants;
|
|
|
+ constants.Push("TRACE");
|
|
|
|
|
|
- pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
|
|
|
- pgroup.CreateChild("ErrorReport").SetValue("prompt");
|
|
|
- pgroup.CreateChild("WarningLevel").SetValue("4");
|
|
|
- pgroup.CreateChild("ConsolePause").SetValue("false");
|
|
|
- pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
|
|
|
+ constants += defineConstants_;
|
|
|
|
|
|
- if (SupportsDesktop())
|
|
|
- {
|
|
|
- pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
|
|
|
- if (!GetIsPCL())
|
|
|
- pgroup.CreateChild("PlatformTarget").SetValue("x64");
|
|
|
+ ProcessDefineConstants(constants);
|
|
|
+
|
|
|
+ pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
|
|
|
+ pgroup.CreateChild("ErrorReport").SetValue("prompt");
|
|
|
+ pgroup.CreateChild("WarningLevel").SetValue("4");
|
|
|
+ pgroup.CreateChild("ConsolePause").SetValue("false");
|
|
|
+ pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
|
|
|
+
|
|
|
+ if (SupportsDesktop())
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
|
|
|
+ if (!GetIsPCL())
|
|
|
+ pgroup.CreateChild("PlatformTarget").SetValue("x64");
|
|
|
|
|
|
#ifndef ATOMIC_PLATFORM_WINDOWS
|
|
|
|
|
|
@@ -426,59 +444,73 @@ namespace ToolCore
|
|
|
pgroup.CreateChild("Commandlineparameters").SetValue(startArguments);
|
|
|
#endif
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pgroup.CreateChild("DebugType").SetValue("pdbonly");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (SupportsPlatform("android"))
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("DebugType").SetValue("pdbonly");
|
|
|
|
|
|
- if (SupportsPlatform("android"))
|
|
|
- {
|
|
|
- if (outputType_.ToLower() != "library")
|
|
|
- {
|
|
|
- pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
|
|
|
- pgroup.CreateChild("AndroidLinkMode").SetValue("SdkOnly");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (outputType_.ToLower() != "library")
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
|
|
|
+ pgroup.CreateChild("AndroidLinkMode").SetValue("SdkOnly");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (playerApplication_ && SupportsPlatform("ios"))
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("DebugType").SetValue("none");
|
|
|
|
|
|
- }
|
|
|
+ pgroup.CreateChild("MtouchArch").SetValue("ARMv7, ARM64");
|
|
|
+ pgroup.CreateChild("CodesignEntitlements").SetValue(GetSanitizedPath(codesignEntitlements_));
|
|
|
+ pgroup.CreateChild("CodesignKey").SetValue("iPhone Developer");
|
|
|
+ pgroup.CreateChild("MtouchDebug").SetValue("true");
|
|
|
+ pgroup.CreateChild("MtouchOptimizePNGs").SetValue("False");
|
|
|
+ }
|
|
|
|
|
|
- void NETCSProject::CreateDebugPropertyGroup(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
- pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ");
|
|
|
+ }
|
|
|
|
|
|
- pgroup.CreateChild("Optimize").SetValue("false");
|
|
|
+ }
|
|
|
|
|
|
- String outputPath = assemblyOutputPath_;
|
|
|
- outputPath.Replace("$ATOMIC_CONFIG$", "Debug");
|
|
|
+ void NETCSProject::CreateDebugPropertyGroup(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
|
|
|
- pgroup.CreateChild("OutputPath").SetValue(outputPath);
|
|
|
+ if (playerApplication_ && SupportsPlatform("ios"))
|
|
|
+ pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Debug|iPhone' ");
|
|
|
+ else
|
|
|
+ pgroup.SetAttribute("Condition", " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ");
|
|
|
|
|
|
- Vector<String> constants;
|
|
|
- constants.Push("DEBUG");
|
|
|
- constants.Push("TRACE");
|
|
|
|
|
|
- constants += defineConstants_;
|
|
|
+ pgroup.CreateChild("Optimize").SetValue("false");
|
|
|
|
|
|
- const Vector<String>& globalConstants = projectGen_->GetGlobalDefineConstants();
|
|
|
- constants += globalConstants;
|
|
|
+ String outputPath = assemblyOutputPath_;
|
|
|
+ outputPath.Replace("$ATOMIC_CONFIG$", "Debug");
|
|
|
|
|
|
- pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
|
|
|
+ pgroup.CreateChild("OutputPath").SetValue(outputPath);
|
|
|
|
|
|
- pgroup.CreateChild("ErrorReport").SetValue("prompt");
|
|
|
- pgroup.CreateChild("WarningLevel").SetValue("4");
|
|
|
- pgroup.CreateChild("ConsolePause").SetValue("false");
|
|
|
- pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
|
|
|
+ Vector<String> constants;
|
|
|
+ constants.Push("DEBUG");
|
|
|
+ constants.Push("TRACE");
|
|
|
+
|
|
|
+ constants += defineConstants_;
|
|
|
+ ProcessDefineConstants(constants);
|
|
|
+
|
|
|
+ pgroup.CreateChild("DefineConstants").SetValue(String::Joined(constants, ";").CString());
|
|
|
+
|
|
|
+ pgroup.CreateChild("ErrorReport").SetValue("prompt");
|
|
|
+ pgroup.CreateChild("WarningLevel").SetValue("4");
|
|
|
+ pgroup.CreateChild("ConsolePause").SetValue("false");
|
|
|
+ pgroup.CreateChild("AllowUnsafeBlocks").SetValue("true");
|
|
|
|
|
|
pgroup.CreateChild("DebugSymbols").SetValue("true");
|
|
|
|
|
|
- if (SupportsDesktop())
|
|
|
- {
|
|
|
+ if (SupportsDesktop())
|
|
|
+ {
|
|
|
pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
|
|
|
|
|
|
- if (!GetIsPCL())
|
|
|
- pgroup.CreateChild("PlatformTarget").SetValue("x64");
|
|
|
+ if (!GetIsPCL())
|
|
|
+ pgroup.CreateChild("PlatformTarget").SetValue("x64");
|
|
|
|
|
|
#ifndef ATOMIC_PLATFORM_WINDOWS
|
|
|
|
|
|
@@ -500,1200 +532,1302 @@ namespace ToolCore
|
|
|
pgroup.CreateChild("Commandlineparameters").SetValue(startArguments);
|
|
|
#endif
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
pgroup.CreateChild("DebugType").SetValue(GetIsPCL() ? "pdbonly": "full");
|
|
|
|
|
|
- if (androidApplication_)
|
|
|
- {
|
|
|
- pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
|
|
|
- pgroup.CreateChild("AndroidLinkMode").SetValue("None");
|
|
|
- pgroup.CreateChild("EmbedAssembliesIntoApk").SetValue("True");
|
|
|
- pgroup.CreateChild("BundleAssemblies").SetValue("False");
|
|
|
- pgroup.CreateChild("AndroidCreatePackagePerAbi").SetValue("False");
|
|
|
- pgroup.CreateChild("Debugger").SetValue("Xamarin");
|
|
|
- pgroup.CreateChild("AndroidEnableMultiDex").SetValue("False");
|
|
|
- pgroup.CreateChild("AndroidSupportedAbis").SetValue("armeabi-v7a");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- void NETCSProject::CreateApplicationItems(XMLElement &projectRoot)
|
|
|
- {
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
-
|
|
|
- XMLElement itemGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
-
|
|
|
- if (SupportsDesktop())
|
|
|
- {
|
|
|
- // AtomicNETNative
|
|
|
-
|
|
|
- XMLElement atomicNETNativeDLL = itemGroup.CreateChild("None");
|
|
|
+ if (androidApplication_)
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("AndroidUseSharedRuntime").SetValue("False");
|
|
|
+ pgroup.CreateChild("AndroidLinkMode").SetValue("None");
|
|
|
+ pgroup.CreateChild("EmbedAssembliesIntoApk").SetValue("True");
|
|
|
+ pgroup.CreateChild("BundleAssemblies").SetValue("False");
|
|
|
+ pgroup.CreateChild("AndroidCreatePackagePerAbi").SetValue("False");
|
|
|
+ pgroup.CreateChild("Debugger").SetValue("Xamarin");
|
|
|
+ pgroup.CreateChild("AndroidEnableMultiDex").SetValue("False");
|
|
|
+ pgroup.CreateChild("AndroidSupportedAbis").SetValue("armeabi-v7a");
|
|
|
+ }
|
|
|
+ else if (playerApplication_ && SupportsPlatform("ios"))
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("MtouchArch").SetValue("ARMv7, ARM64");
|
|
|
+ pgroup.CreateChild("CodesignEntitlements").SetValue(GetSanitizedPath(codesignEntitlements_));
|
|
|
+ pgroup.CreateChild("CodesignKey").SetValue("iPhone Developer");
|
|
|
+ pgroup.CreateChild("MtouchDebug").SetValue("true");
|
|
|
+ pgroup.CreateChild("MtouchFastDev").SetValue("true");
|
|
|
+ pgroup.CreateChild("IpaPackageName").SetValue("");
|
|
|
+ pgroup.CreateChild("OptimizePNGs").SetValue("false");
|
|
|
+ pgroup.CreateChild("MtouchOptimizePNGs").SetValue("False");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ void NETCSProject::CreateApplicationItems(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+
|
|
|
+ XMLElement itemGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+
|
|
|
+ if (SupportsDesktop())
|
|
|
+ {
|
|
|
+ // AtomicNETNative
|
|
|
+
|
|
|
+ XMLElement atomicNETNativeDLL = itemGroup.CreateChild("None");
|
|
|
|
|
|
#ifdef ATOMIC_DEBUG
|
|
|
- String config = "Debug";
|
|
|
+ String config = "Debug";
|
|
|
#else
|
|
|
- String config = "Release";
|
|
|
+ String config = "Release";
|
|
|
#endif
|
|
|
|
|
|
#ifdef ATOMIC_PLATFORM_WINDOWS
|
|
|
- String platform = "Windows";
|
|
|
- String filename = "AtomicNETNative.dll";
|
|
|
+ String platform = "Windows";
|
|
|
+ String filename = "AtomicNETNative.dll";
|
|
|
#elif defined(ATOMIC_PLATFORM_OSX)
|
|
|
- String platform = "Mac";
|
|
|
+ String platform = "Mac";
|
|
|
String filename = "libAtomicNETNative.dylib";
|
|
|
#elif defined(ATOMIC_PLATFORM_LINUX)
|
|
|
- String platform = "Linux";
|
|
|
- String filename = "libAtomicNETNative.so";
|
|
|
+ String platform = "Linux";
|
|
|
+ String filename = "libAtomicNETNative.so";
|
|
|
#endif
|
|
|
|
|
|
#ifdef ATOMIC_DEV_BUILD
|
|
|
|
|
|
- String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/" + filename;
|
|
|
+ String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/" + filename;
|
|
|
#else
|
|
|
- String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/" + filename;
|
|
|
+ String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/" + filename;
|
|
|
#endif
|
|
|
- atomicNETNativeDLL.SetAttribute("Include", nativePath);
|
|
|
- atomicNETNativeDLL.CreateChild("Link").SetValue(filename);
|
|
|
- atomicNETNativeDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
|
|
|
+ atomicNETNativeDLL.SetAttribute("Include", nativePath);
|
|
|
+ atomicNETNativeDLL.CreateChild("Link").SetValue(filename);
|
|
|
+ atomicNETNativeDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
|
|
|
|
|
|
#ifdef ATOMIC_PLATFORM_WINDOWS
|
|
|
- XMLElement d3dCompilerDLL = itemGroup.CreateChild("None");
|
|
|
- String d3dCompilerPath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/D3DCompiler_47.dll";
|
|
|
- d3dCompilerDLL.SetAttribute("Include", d3dCompilerPath);
|
|
|
- d3dCompilerDLL.CreateChild("Link").SetValue("D3DCompiler_47.dll");
|
|
|
- d3dCompilerDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
|
|
|
+ XMLElement d3dCompilerDLL = itemGroup.CreateChild("None");
|
|
|
+ String d3dCompilerPath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/" + platform + "/D3DCompiler_47.dll";
|
|
|
+ d3dCompilerDLL.SetAttribute("Include", d3dCompilerPath);
|
|
|
+ d3dCompilerDLL.CreateChild("Link").SetValue("D3DCompiler_47.dll");
|
|
|
+ d3dCompilerDLL.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
|
|
|
#endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- const String& projectPath = projectGen_->GetAtomicProjectPath();
|
|
|
- if (!playerApplication_ || !projectPath.Length())
|
|
|
- return;
|
|
|
-
|
|
|
- XMLElement androidAsset = itemGroup.CreateChild("AndroidAsset");
|
|
|
- androidAsset.SetAttribute("Include", projectPath + "AtomicNET/Resources/AtomicResources.pak");
|
|
|
- androidAsset.CreateChild("Link").SetValue("Assets\\AtomicResources.pak");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- void NETCSProject::CreateAndroidItems(XMLElement &projectRoot)
|
|
|
- {
|
|
|
-
|
|
|
- if (!libraryProjectZips_.Size())
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- if (libraryProjectZips_.Size())
|
|
|
- {
|
|
|
- XMLElement libraryGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
-
|
|
|
- for (unsigned i = 0; i < libraryProjectZips_.Size(); i++)
|
|
|
- {
|
|
|
- libraryGroup.CreateChild("LibraryProjectZip").SetAttribute("Include", libraryProjectZips_[i].CString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (transformFiles_.Size())
|
|
|
- {
|
|
|
- XMLElement transformGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
-
|
|
|
- for (unsigned i = 0; i < transformFiles_.Size(); i++)
|
|
|
- {
|
|
|
- transformGroup.CreateChild("TransformFile").SetAttribute("Include", transformFiles_[i].CString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!importProjects_.Size())
|
|
|
- {
|
|
|
- projectRoot.CreateChild("Import").SetAttribute("Project", "$(MSBuildExtensionsPath)\\Xamarin\\Android\\Xamarin.Android.CSharp.targets");
|
|
|
- }
|
|
|
-
|
|
|
- if (androidApplication_)
|
|
|
- {
|
|
|
- // TODO: other abi
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ const String& projectPath = projectGen_->GetAtomicProjectPath();
|
|
|
+ if (!playerApplication_ || !projectPath.Length())
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (androidApplication_)
|
|
|
+ {
|
|
|
+ XMLElement androidAsset = itemGroup.CreateChild("AndroidAsset");
|
|
|
+ androidAsset.SetAttribute("Include", projectPath + "AtomicNET/Resources/AtomicResources.pak");
|
|
|
+ androidAsset.CreateChild("Link").SetValue("Assets\\AtomicResources.pak");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ XMLElement bundleResource = itemGroup.CreateChild("BundleResource");
|
|
|
+ bundleResource.SetAttribute("Include", projectPath + "AtomicNET/Resources/AtomicResources.pak");
|
|
|
+ bundleResource.CreateChild("Link").SetValue("Resources\\AtomicResources.pak");
|
|
|
+ bundleResource.CreateChild("CopyToOutputDirectory").SetValue("PreserveNewest");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ void NETCSProject::CreateIOSItems(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+ XMLElement iosGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+
|
|
|
+ if (objcBindingApiDefinition_.Length())
|
|
|
+ {
|
|
|
+ iosGroup.CreateChild("ObjcBindingApiDefinition").SetAttribute("Include", GetSanitizedPath(objcBindingApiDefinition_));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (name_ == "AtomicNET.iOS")
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
|
|
|
#ifdef ATOMIC_DEBUG
|
|
|
- String config = "Debug";
|
|
|
+ String config = "Debug";
|
|
|
#else
|
|
|
- String config = "Release";
|
|
|
+ String config = "Release";
|
|
|
#endif
|
|
|
|
|
|
- // TODO: more than armeabi-v7a (which this is)
|
|
|
- String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/Android/libAtomicNETNative.so";
|
|
|
-
|
|
|
- XMLElement nativeLibrary = projectRoot.CreateChild("ItemGroup").CreateChild("AndroidNativeLibrary");
|
|
|
- nativeLibrary.SetAttribute("Include", nativePath);
|
|
|
-
|
|
|
- nativeLibrary.CreateChild("Link").SetValue("Libs\\armeabi-v7a\\libAtomicNETNative.so");
|
|
|
-
|
|
|
- XMLElement resourceGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
-
|
|
|
- String relativePath;
|
|
|
-
|
|
|
- if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/values/Strings.xml", projectPath_, relativePath))
|
|
|
- {
|
|
|
- relativePath.Replace("/", "\\");
|
|
|
-
|
|
|
- XMLElement strings = resourceGroup.CreateChild("AndroidResource");
|
|
|
- strings.SetAttribute("Include", relativePath);
|
|
|
- // Link has to exist for manifest to find resource!
|
|
|
- strings.CreateChild("Link").SetValue("Resources\\values\\Strings.xml");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("Unabled to get relative path for Strings.xml");
|
|
|
- }
|
|
|
+ String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/iOS/AtomicNETNative.framework";
|
|
|
+ iosGroup.CreateChild("ObjcBindingNativeFramework").SetAttribute("Include", GetSanitizedPath(nativePath));
|
|
|
+
|
|
|
+ // framework copy
|
|
|
+ XMLElement none = iosGroup.CreateChild("None");
|
|
|
+ none.SetAttribute("Include", nativePath + ".zip");
|
|
|
+ none.CreateChild("Link").SetValue("AtomicNETNative.framework.zip");
|
|
|
+ none.CreateChild("CopyToOutputDirectory").SetValue("Always");
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (playerApplication_)
|
|
|
+ {
|
|
|
+ XMLElement plist = iosGroup.CreateChild("None");
|
|
|
+ plist.SetAttribute("Include", GetSanitizedPath(infoPList_));
|
|
|
+ plist.CreateChild("Link").SetValue("Info.plist");
|
|
|
+
|
|
|
+ XMLElement entitlements = iosGroup.CreateChild("Content");
|
|
|
+ entitlements.SetAttribute("Include", GetSanitizedPath(codesignEntitlements_));
|
|
|
+ entitlements.CreateChild("Link").SetValue("Entitlements.plist");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ void NETCSProject::CreateAndroidItems(XMLElement &projectRoot)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (!libraryProjectZips_.Size())
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (libraryProjectZips_.Size())
|
|
|
+ {
|
|
|
+ XMLElement libraryGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+
|
|
|
+ for (unsigned i = 0; i < libraryProjectZips_.Size(); i++)
|
|
|
+ {
|
|
|
+ libraryGroup.CreateChild("LibraryProjectZip").SetAttribute("Include", libraryProjectZips_[i].CString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (transformFiles_.Size())
|
|
|
+ {
|
|
|
+ XMLElement transformGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
+
|
|
|
+ for (unsigned i = 0; i < transformFiles_.Size(); i++)
|
|
|
+ {
|
|
|
+ transformGroup.CreateChild("TransformFile").SetAttribute("Include", transformFiles_[i].CString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!importProjects_.Size())
|
|
|
+ {
|
|
|
+ projectRoot.CreateChild("Import").SetAttribute("Project", "$(MSBuildExtensionsPath)\\Xamarin\\Android\\Xamarin.Android.CSharp.targets");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (androidApplication_)
|
|
|
+ {
|
|
|
+ // TODO: other abi
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
|
|
|
- if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/drawable/icon.png", projectPath_, relativePath))
|
|
|
- {
|
|
|
- relativePath.Replace("/", "\\");
|
|
|
- XMLElement icon = resourceGroup.CreateChild("AndroidResource");
|
|
|
- icon.SetAttribute("Include", relativePath);
|
|
|
- // Link has to exist for manifest to find resource!
|
|
|
- icon.CreateChild("Link").SetValue("Resources\\drawable\\icon.png");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("Unabled to get relative path for Icon.png");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+#ifdef ATOMIC_DEBUG
|
|
|
+ String config = "Debug";
|
|
|
+#else
|
|
|
+ String config = "Release";
|
|
|
+#endif
|
|
|
|
|
|
- }
|
|
|
+ // TODO: more than armeabi-v7a (which this is)
|
|
|
+ String nativePath = AddTrailingSlash(tenv->GetAtomicNETRootDir()) + config + "/Native/Android/libAtomicNETNative.so";
|
|
|
|
|
|
- void NETCSProject::CreateAssemblyInfo()
|
|
|
- {
|
|
|
+ XMLElement nativeLibrary = projectRoot.CreateChild("ItemGroup").CreateChild("AndroidNativeLibrary");
|
|
|
+ nativeLibrary.SetAttribute("Include", nativePath);
|
|
|
|
|
|
- String info = "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n\n";
|
|
|
- info += ToString("[assembly:AssemblyTitle(\"%s\")]\n", name_.CString());
|
|
|
- info += "[assembly:AssemblyDescription(\"\")]\n";
|
|
|
- info += "[assembly:AssemblyConfiguration(\"\")]\n";
|
|
|
- info += "[assembly:AssemblyCompany(\"\")]\n";
|
|
|
- info += ToString("[assembly:AssemblyProduct(\"%s\")]\n", name_.CString());
|
|
|
+ nativeLibrary.CreateChild("Link").SetValue("Libs\\armeabi-v7a\\libAtomicNETNative.so");
|
|
|
|
|
|
- info += "\n\n\n";
|
|
|
+ XMLElement resourceGroup = projectRoot.CreateChild("ItemGroup");
|
|
|
|
|
|
- info += "[assembly:ComVisible(false)]\n";
|
|
|
+ String relativePath;
|
|
|
|
|
|
- info += "\n\n";
|
|
|
+ if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/values/Strings.xml", projectPath_, relativePath))
|
|
|
+ {
|
|
|
+ relativePath.Replace("/", "\\");
|
|
|
|
|
|
- info += ToString("[assembly:Guid(\"%s\")]\n", projectGuid_.CString());
|
|
|
+ XMLElement strings = resourceGroup.CreateChild("AndroidResource");
|
|
|
+ strings.SetAttribute("Include", relativePath);
|
|
|
+ // Link has to exist for manifest to find resource!
|
|
|
+ strings.CreateChild("Link").SetValue("Resources\\values\\Strings.xml");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("Unabled to get relative path for Strings.xml");
|
|
|
+ }
|
|
|
|
|
|
- info += "\n\n";
|
|
|
+ if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/drawable/icon.png", projectPath_, relativePath))
|
|
|
+ {
|
|
|
+ relativePath.Replace("/", "\\");
|
|
|
+ XMLElement icon = resourceGroup.CreateChild("AndroidResource");
|
|
|
+ icon.SetAttribute("Include", relativePath);
|
|
|
+ // Link has to exist for manifest to find resource!
|
|
|
+ icon.CreateChild("Link").SetValue("Resources\\drawable\\icon.png");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("Unabled to get relative path for Icon.png");
|
|
|
+ }
|
|
|
|
|
|
- info += "[assembly:AssemblyVersion(\"1.0.0.0\")]\n";
|
|
|
- info += "[assembly:AssemblyFileVersion(\"1.0.0.0\")]\n";
|
|
|
+ }
|
|
|
|
|
|
- SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + "Properties/AssemblyInfo.cs"), FILE_WRITE));
|
|
|
- output->Write(info.CString(), info.Length());
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ void NETCSProject::CreateAssemblyInfo()
|
|
|
+ {
|
|
|
|
|
|
- bool NETCSProject::GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output)
|
|
|
- {
|
|
|
- String path = fromPath;
|
|
|
- ReplacePathStrings(path);
|
|
|
- path = GetSanitizedPath(path);
|
|
|
+ String info = "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n\n";
|
|
|
+ info += ToString("[assembly:AssemblyTitle(\"%s\")]\n", name_.CString());
|
|
|
+ info += "[assembly:AssemblyDescription(\"\")]\n";
|
|
|
+ info += "[assembly:AssemblyConfiguration(\"\")]\n";
|
|
|
+ info += "[assembly:AssemblyCompany(\"\")]\n";
|
|
|
+ info += ToString("[assembly:AssemblyProduct(\"%s\")]\n", name_.CString());
|
|
|
|
|
|
- String relativePath;
|
|
|
+ info += "\n\n\n";
|
|
|
|
|
|
- if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
- {
|
|
|
- path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
+ info += "[assembly:ComVisible(false)]\n";
|
|
|
|
|
|
- output = path;
|
|
|
+ info += "\n\n";
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ info += ToString("[assembly:Guid(\"%s\")]\n", projectGuid_.CString());
|
|
|
|
|
|
- output = fromPath;
|
|
|
+ info += "\n\n";
|
|
|
|
|
|
- return false;
|
|
|
+ info += "[assembly:AssemblyVersion(\"1.0.0.0\")]\n";
|
|
|
+ info += "[assembly:AssemblyFileVersion(\"1.0.0.0\")]\n";
|
|
|
|
|
|
- }
|
|
|
+ SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + "Properties/AssemblyInfo.cs"), FILE_WRITE));
|
|
|
+ output->Write(info.CString(), info.Length());
|
|
|
|
|
|
- void NETCSProject::CreateMainPropertyGroup(XMLElement& projectRoot)
|
|
|
- {
|
|
|
- XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
+ }
|
|
|
+
|
|
|
+ bool NETCSProject::GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output)
|
|
|
+ {
|
|
|
+ String path = fromPath;
|
|
|
+ ReplacePathStrings(path);
|
|
|
+ path = GetSanitizedPath(path);
|
|
|
|
|
|
- // Configuration
|
|
|
- XMLElement config = pgroup.CreateChild("Configuration");
|
|
|
- config.SetAttribute("Condition", " '$(Configuration)' == '' ");
|
|
|
- config.SetValue("Debug");
|
|
|
+ String relativePath;
|
|
|
|
|
|
- // Platform
|
|
|
- XMLElement platform = pgroup.CreateChild("Platform");
|
|
|
- platform.SetAttribute("Condition", " '$(Platform)' == '' ");
|
|
|
- platform.SetValue("AnyCPU");
|
|
|
+ if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
+ {
|
|
|
+ path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
|
|
|
- // ProjectGuid
|
|
|
- XMLElement guid = pgroup.CreateChild("ProjectGuid");
|
|
|
- guid.SetValue("{" + projectGuid_ + "}");
|
|
|
-
|
|
|
- // OutputType
|
|
|
- XMLElement outputType = pgroup.CreateChild("OutputType");
|
|
|
- outputType.SetValue(outputType_);
|
|
|
-
|
|
|
- pgroup.CreateChild("AppDesignerFolder").SetValue("Properties");
|
|
|
+ output = path;
|
|
|
|
|
|
- // RootNamespace
|
|
|
- XMLElement rootNamespace = pgroup.CreateChild("RootNamespace");
|
|
|
- rootNamespace.SetValue(rootNamespace_);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- // AssemblyName
|
|
|
- XMLElement assemblyName = pgroup.CreateChild("AssemblyName");
|
|
|
- assemblyName.SetValue(assemblyName_);
|
|
|
+ output = fromPath;
|
|
|
|
|
|
- pgroup.CreateChild("FileAlignment").SetValue("512");
|
|
|
+ return false;
|
|
|
|
|
|
- if (projectTypeGuids_.Size())
|
|
|
- {
|
|
|
- pgroup.CreateChild("ProjectTypeGuids").SetValue(String::Joined(projectTypeGuids_, ";"));
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if (SupportsDesktop())
|
|
|
- {
|
|
|
- pgroup.CreateChild("TargetFrameworkVersion").SetValue("v4.5");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pgroup.CreateChild("ProductVersion").SetValue("8.0.30703");
|
|
|
- pgroup.CreateChild("SchemaVersion").SetValue("2.0");
|
|
|
-
|
|
|
- pgroup.CreateChild("TargetFrameworkVersion").SetValue("v6.0");
|
|
|
-
|
|
|
- if (SupportsPlatform("android"))
|
|
|
- {
|
|
|
-
|
|
|
- if (!projectTypeGuids_.Size())
|
|
|
- {
|
|
|
- pgroup.CreateChild("ProjectTypeGuids").SetValue("{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
|
|
|
- }
|
|
|
-
|
|
|
- pgroup.CreateChild("AndroidUseLatestPlatformSdk").SetValue("True");
|
|
|
+ void NETCSProject::CreateMainPropertyGroup(XMLElement& projectRoot)
|
|
|
+ {
|
|
|
+ XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
|
|
|
|
|
|
- if (!androidApplication_)
|
|
|
- {
|
|
|
- // 10368E6C-D01B-4462-8E8B-01FC667A7035 is a binding library
|
|
|
- if (!projectTypeGuids_.Contains("{10368E6C-D01B-4462-8E8B-01FC667A7035}"))
|
|
|
- pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Android Application
|
|
|
+ // Configuration
|
|
|
+ XMLElement config = pgroup.CreateChild("Configuration");
|
|
|
+ config.SetAttribute("Condition", " '$(Configuration)' == '' ");
|
|
|
+ config.SetValue("Debug");
|
|
|
+
|
|
|
+ // Platform
|
|
|
+ XMLElement platform = pgroup.CreateChild("Platform");
|
|
|
+ platform.SetAttribute("Condition", " '$(Platform)' == '' ");
|
|
|
+ if (playerApplication_ && SupportsPlatform("ios"))
|
|
|
+ platform.SetValue("iPhone");
|
|
|
+ else
|
|
|
+ platform.SetValue("AnyCPU");
|
|
|
+
|
|
|
+ // ProjectGuid
|
|
|
+ XMLElement guid = pgroup.CreateChild("ProjectGuid");
|
|
|
+ guid.SetValue("{" + projectGuid_ + "}");
|
|
|
+
|
|
|
+ // OutputType
|
|
|
+ XMLElement outputType = pgroup.CreateChild("OutputType");
|
|
|
+ outputType.SetValue(outputType_);
|
|
|
+
|
|
|
+ pgroup.CreateChild("AppDesignerFolder").SetValue("Properties");
|
|
|
+
|
|
|
+ // RootNamespace
|
|
|
+ XMLElement rootNamespace = pgroup.CreateChild("RootNamespace");
|
|
|
+ rootNamespace.SetValue(rootNamespace_);
|
|
|
+
|
|
|
+ // AssemblyName
|
|
|
+ XMLElement assemblyName = pgroup.CreateChild("AssemblyName");
|
|
|
+ assemblyName.SetValue(assemblyName_);
|
|
|
+
|
|
|
+ pgroup.CreateChild("FileAlignment").SetValue("512");
|
|
|
+
|
|
|
+ if (projectTypeGuids_.Size())
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("ProjectTypeGuids").SetValue(String::Joined(projectTypeGuids_, ";"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (SupportsDesktop())
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("TargetFrameworkVersion").SetValue("v4.5");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("ProductVersion").SetValue("8.0.30703");
|
|
|
+ pgroup.CreateChild("SchemaVersion").SetValue("2.0");
|
|
|
+
|
|
|
+ if (SupportsPlatform("ios"))
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("IPhoneResourcePrefix").SetValue("Resources");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("TargetFrameworkVersion").SetValue("v6.0");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (SupportsPlatform("android"))
|
|
|
+ {
|
|
|
+
|
|
|
+ if (!projectTypeGuids_.Size())
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("ProjectTypeGuids").SetValue("{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
|
|
|
+ }
|
|
|
+
|
|
|
+ pgroup.CreateChild("AndroidUseLatestPlatformSdk").SetValue("True");
|
|
|
+
|
|
|
+ if (!androidApplication_)
|
|
|
+ {
|
|
|
+ // 10368E6C-D01B-4462-8E8B-01FC667A7035 is a binding library
|
|
|
+ if (!projectTypeGuids_.Contains("{10368E6C-D01B-4462-8E8B-01FC667A7035}"))
|
|
|
+ pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Android Application
|
|
|
+
|
|
|
+ pgroup.CreateChild("AndroidApplication").SetValue("true");
|
|
|
+
|
|
|
+ // AndroidManifest.xml must reside in Properties/AndroidManifest.xml, which introduces sync issues :/
|
|
|
+
|
|
|
+ pgroup.CreateChild("AndroidManifest").SetValue("Properties\\AndroidManifest.xml");
|
|
|
+
|
|
|
+ FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+
|
|
|
+ String manifestSourceFile = "$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Properties/AndroidManifest.xml";
|
|
|
+ ReplacePathStrings(manifestSourceFile);
|
|
|
+ manifestSourceFile = GetSanitizedPath(manifestSourceFile);
|
|
|
+
|
|
|
+ if (fileSystem->FileExists(manifestSourceFile))
|
|
|
+ {
|
|
|
+ String manifestDest = GetSanitizedPath(projectPath_ + "Properties/");
|
|
|
+
|
|
|
+ if (!fileSystem->DirExists(manifestDest))
|
|
|
+ {
|
|
|
+ fileSystem->CreateDirs(GetSanitizedPath(projectGen_->GetAtomicProjectPath()), ToString("/AtomicNET/Solution/%s/Properties/", name_.CString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fileSystem->DirExists(manifestDest))
|
|
|
+ {
|
|
|
+ if (!fileSystem->Copy(manifestSourceFile, manifestDest + "AndroidManifest.xml"))
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("Unable to copy AndroidManifest from %s to %s", manifestSourceFile.CString(), manifestDest.CString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("Unable to create folder %s for AndroidManifest.xml", manifestDest.CString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("No AndroidManifest.xml, project will not deploy (%s)", manifestSourceFile.CString());
|
|
|
+ }
|
|
|
+
|
|
|
+ String relativePath;
|
|
|
+ if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/Resource.Designer.cs", projectPath_, relativePath))
|
|
|
+ {
|
|
|
+ relativePath.Replace("/", "\\");
|
|
|
+ pgroup.CreateChild("AndroidResgenFile").SetValue(relativePath);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("Unabled to get relative path for AndroidResgenFile");
|
|
|
+ }
|
|
|
+
|
|
|
+ pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (targetFrameworkProfile_.Length())
|
|
|
+ {
|
|
|
+ pgroup.CreateChild("TargetFrameworkProfile").SetValue(targetFrameworkProfile_);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ bool NETCSProject::GenerateShared()
|
|
|
+ {
|
|
|
+ // .shproj
|
|
|
+ XMLElement project = xmlFile_->CreateRoot("Project");
|
|
|
+
|
|
|
+ project.SetAttribute("DefaultTargets", "Build");
|
|
|
+ project.SetAttribute("ToolsVersion", "14.0");
|
|
|
+ project.SetAttribute("DefaultTargets", "Build");
|
|
|
+ project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
+
|
|
|
+ // Project Group
|
|
|
+ XMLElement projectGroup = project.CreateChild("PropertyGroup");
|
|
|
+ projectGroup.SetAttribute("Label", "Globals");
|
|
|
+ projectGroup.CreateChild("ProjectGuid").SetValue(projectGuid_);
|
|
|
+ projectGroup.CreateChild("MinimumVisualStudioVersion").SetValue("14.0");
|
|
|
+
|
|
|
+ XMLElement import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
|
|
|
+ import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
|
|
|
+
|
|
|
+ import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.Default.props");
|
|
|
+
|
|
|
+ import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.props");
|
|
|
+
|
|
|
+ import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", ToString("%s.projitems", name_.CString()));
|
|
|
+ import.SetAttribute("Label", "Shared");
|
|
|
+
|
|
|
+ import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.CSharp.targets");
|
|
|
+
|
|
|
+ String projectSource = xmlFile_->ToString();
|
|
|
|
|
|
- pgroup.CreateChild("AndroidApplication").SetValue("true");
|
|
|
+ SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".shproj"), FILE_WRITE));
|
|
|
+ output->Write(projectSource.CString(), projectSource.Length());
|
|
|
|
|
|
- // AndroidManifest.xml must reside in Properties/AndroidManifest.xml, which introduces sync issues :/
|
|
|
+ // projitems
|
|
|
|
|
|
- pgroup.CreateChild("AndroidManifest").SetValue("Properties\\AndroidManifest.xml");
|
|
|
+ SharedPtr<XMLFile> itemsXMLFile(new XMLFile(context_));
|
|
|
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+ XMLElement itemsProject = itemsXMLFile->CreateRoot("Project");
|
|
|
+ itemsProject.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
|
|
|
- String manifestSourceFile = "$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Properties/AndroidManifest.xml";
|
|
|
- ReplacePathStrings(manifestSourceFile);
|
|
|
- manifestSourceFile = GetSanitizedPath(manifestSourceFile);
|
|
|
+ XMLElement propertyGroup = itemsProject.CreateChild("PropertyGroup");
|
|
|
+ propertyGroup.CreateChild("MSBuildAllProjects").SetValue("$(MSBuildAllProjects);$(MSBuildThisFileFullPath)");
|
|
|
+ propertyGroup.CreateChild("HasSharedItems").SetValue("true");
|
|
|
+ propertyGroup.CreateChild("SharedGUID").SetValue(projectGuid_);
|
|
|
|
|
|
- if (fileSystem->FileExists(manifestSourceFile))
|
|
|
- {
|
|
|
- String manifestDest = GetSanitizedPath(projectPath_ + "Properties/");
|
|
|
+ propertyGroup = itemsProject.CreateChild("PropertyGroup");
|
|
|
+ propertyGroup.SetAttribute("Label", "Configuration");
|
|
|
+ propertyGroup.CreateChild("Import_RootNamespace").SetValue("AtomicEngine");
|
|
|
|
|
|
- if (!fileSystem->DirExists(manifestDest))
|
|
|
- {
|
|
|
- fileSystem->CreateDirs(GetSanitizedPath(projectGen_->GetAtomicProjectPath()), ToString("/AtomicNET/Solution/%s/Properties/", name_.CString()));
|
|
|
- }
|
|
|
+ CreateCompileItemGroup(itemsProject);
|
|
|
|
|
|
- if (fileSystem->DirExists(manifestDest))
|
|
|
- {
|
|
|
- if (!fileSystem->Copy(manifestSourceFile, manifestDest + "AndroidManifest.xml"))
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("Unable to copy AndroidManifest from %s to %s", manifestSourceFile.CString(), manifestDest.CString());
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("Unable to create folder %s for AndroidManifest.xml", manifestDest.CString());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("No AndroidManifest.xml, project will not deploy (%s)", manifestSourceFile.CString());
|
|
|
- }
|
|
|
-
|
|
|
- String relativePath;
|
|
|
- if (GetRelativeProjectPath("$ATOMIC_PROJECT_ROOT$/Project/AtomicNET/Platforms/Android/Resources/Resource.Designer.cs", projectPath_, relativePath))
|
|
|
- {
|
|
|
- relativePath.Replace("/", "\\");
|
|
|
- pgroup.CreateChild("AndroidResgenFile").SetValue(relativePath);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("Unabled to get relative path for AndroidResgenFile");
|
|
|
- }
|
|
|
-
|
|
|
- pgroup.CreateChild("GenerateSerializationAssemblies").SetValue("Off");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (targetFrameworkProfile_.Length())
|
|
|
- {
|
|
|
- pgroup.CreateChild("TargetFrameworkProfile").SetValue(targetFrameworkProfile_);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- bool NETCSProject::GenerateShared()
|
|
|
- {
|
|
|
- // .shproj
|
|
|
- XMLElement project = xmlFile_->CreateRoot("Project");
|
|
|
-
|
|
|
- project.SetAttribute("DefaultTargets", "Build");
|
|
|
- project.SetAttribute("ToolsVersion", "14.0");
|
|
|
- project.SetAttribute("DefaultTargets", "Build");
|
|
|
- project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
-
|
|
|
- // Project Group
|
|
|
- XMLElement projectGroup = project.CreateChild("PropertyGroup");
|
|
|
- projectGroup.SetAttribute("Label", "Globals");
|
|
|
- projectGroup.CreateChild("ProjectGuid").SetValue(projectGuid_);
|
|
|
- projectGroup.CreateChild("MinimumVisualStudioVersion").SetValue("14.0");
|
|
|
-
|
|
|
- XMLElement import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
|
|
|
- import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
|
|
|
-
|
|
|
- import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.Default.props");
|
|
|
-
|
|
|
- import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.props");
|
|
|
-
|
|
|
- import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", ToString("%s.projitems", name_.CString()));
|
|
|
- import.SetAttribute("Label", "Shared");
|
|
|
-
|
|
|
- import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.CSharp.targets");
|
|
|
-
|
|
|
- String projectSource = xmlFile_->ToString();
|
|
|
+ String itemSource = itemsXMLFile->ToString();
|
|
|
|
|
|
- SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".shproj"), FILE_WRITE));
|
|
|
- output->Write(projectSource.CString(), projectSource.Length());
|
|
|
+ SharedPtr<File> itemsOutput(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".projitems"), FILE_WRITE));
|
|
|
+ itemsOutput->Write(itemSource.CString(), itemSource.Length());
|
|
|
|
|
|
- // projitems
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- SharedPtr<XMLFile> itemsXMLFile(new XMLFile(context_));
|
|
|
+ bool NETCSProject::GenerateStandard()
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+ NETSolution* solution = projectGen_->GetSolution();
|
|
|
|
|
|
- XMLElement itemsProject = itemsXMLFile->CreateRoot("Project");
|
|
|
- itemsProject.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
+ XMLElement project = xmlFile_->CreateRoot("Project");
|
|
|
|
|
|
- XMLElement propertyGroup = itemsProject.CreateChild("PropertyGroup");
|
|
|
- propertyGroup.CreateChild("MSBuildAllProjects").SetValue("$(MSBuildAllProjects);$(MSBuildThisFileFullPath)");
|
|
|
- propertyGroup.CreateChild("HasSharedItems").SetValue("true");
|
|
|
- propertyGroup.CreateChild("SharedGUID").SetValue(projectGuid_);
|
|
|
+ project.SetAttribute("DefaultTargets", "Build");
|
|
|
+ project.SetAttribute("ToolsVersion", "14.0");
|
|
|
+ project.SetAttribute("DefaultTargets", "Build");
|
|
|
+ project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
|
|
|
- propertyGroup = itemsProject.CreateChild("PropertyGroup");
|
|
|
- propertyGroup.SetAttribute("Label", "Configuration");
|
|
|
- propertyGroup.CreateChild("Import_RootNamespace").SetValue("AtomicEngine");
|
|
|
+ XMLElement import = project.CreateChild("Import");
|
|
|
+ import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
|
|
|
+ import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
|
|
|
|
|
|
- CreateCompileItemGroup(itemsProject);
|
|
|
+ CreateMainPropertyGroup(project);
|
|
|
+ CreateDebugPropertyGroup(project);
|
|
|
+ CreateReleasePropertyGroup(project);
|
|
|
+ CreateReferencesItemGroup(project);
|
|
|
+ CreateProjectReferencesItemGroup(project);
|
|
|
+ CreateCompileItemGroup(project);
|
|
|
+ CreatePackagesItemGroup(project);
|
|
|
|
|
|
- String itemSource = itemsXMLFile->ToString();
|
|
|
+ if (SupportsPlatform("android"))
|
|
|
+ {
|
|
|
+ CreateAndroidItems(project);
|
|
|
+ }
|
|
|
|
|
|
- SharedPtr<File> itemsOutput(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".projitems"), FILE_WRITE));
|
|
|
- itemsOutput->Write(itemSource.CString(), itemSource.Length());
|
|
|
+ if (SupportsPlatform("ios"))
|
|
|
+ {
|
|
|
+ CreateIOSItems(project);
|
|
|
+ }
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
- bool NETCSProject::GenerateStandard()
|
|
|
- {
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
- NETSolution* solution = projectGen_->GetSolution();
|
|
|
+ if (SupportsDesktop() && !GetIsPCL())
|
|
|
+ project.CreateChild("Import").SetAttribute("Project", "$(MSBuildToolsPath)\\Microsoft.CSharp.targets");
|
|
|
|
|
|
- XMLElement project = xmlFile_->CreateRoot("Project");
|
|
|
+ if (outputType_.ToLower() == "exe" || androidApplication_)
|
|
|
+ {
|
|
|
+ CreateApplicationItems(project);
|
|
|
+ }
|
|
|
|
|
|
- project.SetAttribute("DefaultTargets", "Build");
|
|
|
- project.SetAttribute("ToolsVersion", "14.0");
|
|
|
- project.SetAttribute("DefaultTargets", "Build");
|
|
|
- project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
+ if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
|
|
|
+ CreateAssemblyInfo();
|
|
|
|
|
|
- XMLElement import = project.CreateChild("Import");
|
|
|
- import.SetAttribute("Project", "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props");
|
|
|
- import.SetAttribute("Condition", "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')");
|
|
|
+ const String& atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
|
|
|
- CreateMainPropertyGroup(project);
|
|
|
- CreateDebugPropertyGroup(project);
|
|
|
- CreateReleasePropertyGroup(project);
|
|
|
- CreateReferencesItemGroup(project);
|
|
|
- CreateProjectReferencesItemGroup(project);
|
|
|
- CreateCompileItemGroup(project);
|
|
|
- CreatePackagesItemGroup(project);
|
|
|
+ if (atomicProjectPath.Length())
|
|
|
+ {
|
|
|
+ // Create the AtomicProject.csproj.user file if it doesn't exist
|
|
|
|
|
|
- if (SupportsPlatform("android"))
|
|
|
- {
|
|
|
- CreateAndroidItems(project);
|
|
|
- }
|
|
|
+ String userSettingsFilename = projectPath_ + name_ + ".csproj.user";
|
|
|
|
|
|
- if (SupportsDesktop() && !GetIsPCL())
|
|
|
- project.CreateChild("Import").SetAttribute("Project", "$(MSBuildToolsPath)\\Microsoft.CSharp.targets");
|
|
|
+ if (!fileSystem->FileExists(userSettingsFilename))
|
|
|
+ {
|
|
|
+ SharedPtr<XMLFile> userSettings(new XMLFile(context_));
|
|
|
|
|
|
- if (outputType_.ToLower() == "exe" || androidApplication_)
|
|
|
- {
|
|
|
- CreateApplicationItems(project);
|
|
|
- }
|
|
|
+ XMLElement project = userSettings->CreateRoot("Project");
|
|
|
|
|
|
- if (!GetIsPCL() && !sharedReferences_.Size() && outputType_ != "Shared")
|
|
|
- CreateAssemblyInfo();
|
|
|
+ project.SetAttribute("ToolsVersion", "14.0");
|
|
|
+ project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
|
|
|
- const String& atomicProjectPath = projectGen_->GetAtomicProjectPath();
|
|
|
+ StringVector configs;
|
|
|
+ configs.Push("Debug");
|
|
|
+ configs.Push("Release");
|
|
|
|
|
|
- if (atomicProjectPath.Length())
|
|
|
- {
|
|
|
- // Create the AtomicProject.csproj.user file if it doesn't exist
|
|
|
+ for (unsigned i = 0; i < configs.Size(); i++)
|
|
|
+ {
|
|
|
+ String cfg = configs[i];
|
|
|
|
|
|
- String userSettingsFilename = projectPath_ + name_ + ".csproj.user";
|
|
|
+ XMLElement propertyGroup = project.CreateChild("PropertyGroup");
|
|
|
+ propertyGroup.SetAttribute("Condition", ToString("'$(Configuration)|$(Platform)' == '%s|AnyCPU'", cfg.CString()));
|
|
|
|
|
|
- if (!fileSystem->FileExists(userSettingsFilename))
|
|
|
- {
|
|
|
- SharedPtr<XMLFile> userSettings(new XMLFile(context_));
|
|
|
+ String startArguments;
|
|
|
|
|
|
- XMLElement project = userSettings->CreateRoot("Project");
|
|
|
-
|
|
|
- project.SetAttribute("ToolsVersion", "14.0");
|
|
|
- project.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
+#ifndef ATOMIC_DEV_BUILD
|
|
|
+ startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "Resources/").CString());
|
|
|
+#endif
|
|
|
|
|
|
- StringVector configs;
|
|
|
- configs.Push("Debug");
|
|
|
- configs.Push("Release");
|
|
|
+ propertyGroup.CreateChild("StartAction").SetValue("Project");
|
|
|
|
|
|
- for (unsigned i = 0; i < configs.Size(); i++)
|
|
|
- {
|
|
|
- String cfg = configs[i];
|
|
|
+ startArguments += ToString("--project \"%s\"", atomicProjectPath.CString());
|
|
|
|
|
|
- XMLElement propertyGroup = project.CreateChild("PropertyGroup");
|
|
|
- propertyGroup.SetAttribute("Condition", ToString("'$(Configuration)|$(Platform)' == '%s|AnyCPU'", cfg.CString()));
|
|
|
+ propertyGroup.CreateChild("StartArguments").SetValue(startArguments);
|
|
|
|
|
|
- String startArguments;
|
|
|
+ }
|
|
|
|
|
|
-#ifndef ATOMIC_DEV_BUILD
|
|
|
- startArguments += ToString("--resourcePrefix \"%s\" ", (fileSystem->GetProgramDir() + "Resources/").CString());
|
|
|
-#endif
|
|
|
+ String userSettingsSource = userSettings->ToString();
|
|
|
+ SharedPtr<File> output(new File(context_, GetSanitizedPath(userSettingsFilename), FILE_WRITE));
|
|
|
+ output->Write(userSettingsSource.CString(), userSettingsSource.Length());
|
|
|
+ output->Close();
|
|
|
|
|
|
- propertyGroup.CreateChild("StartAction").SetValue("Project");
|
|
|
+ }
|
|
|
|
|
|
- startArguments += ToString("--project \"%s\"", atomicProjectPath.CString());
|
|
|
+ }
|
|
|
|
|
|
- propertyGroup.CreateChild("StartArguments").SetValue(startArguments);
|
|
|
+ for (unsigned i = 0; i < sharedReferences_.Size(); i++)
|
|
|
+ {
|
|
|
+ NETCSProject* sharedProject = projectGen_->GetCSProjectByName(sharedReferences_[i]);
|
|
|
|
|
|
- }
|
|
|
+ if (!sharedProject)
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("Unable to get shared project %s", sharedReferences_[i].CString());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- String userSettingsSource = userSettings->ToString();
|
|
|
- SharedPtr<File> output(new File(context_, GetSanitizedPath(userSettingsFilename), FILE_WRITE));
|
|
|
- output->Write(userSettingsSource.CString(), userSettingsSource.Length());
|
|
|
- output->Close();
|
|
|
+ String path = sharedProject->projectPath_ + sharedReferences_[i] + ".projitems";
|
|
|
+ String relativePath;
|
|
|
+ if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
+ {
|
|
|
+ path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ XMLElement shared = project.CreateChild("Import");
|
|
|
+ shared.SetAttribute("Project", path);
|
|
|
+ shared.SetAttribute("Label", "Shared");
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < importProjects_.Size(); i++)
|
|
|
+ {
|
|
|
+ project.CreateChild("Import").SetAttribute("Project", importProjects_[i].CString());
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < sharedReferences_.Size(); i++)
|
|
|
- {
|
|
|
- NETCSProject* sharedProject = projectGen_->GetCSProjectByName(sharedReferences_[i]);
|
|
|
+ // Have to come after the imports, so AfterBuild exists
|
|
|
|
|
|
- if (!sharedProject)
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("Unable to get shared project %s", sharedReferences_[i].CString());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ String projectName = "AtomicProject";
|
|
|
|
|
|
- String path = sharedProject->projectPath_ + sharedReferences_[i] + ".projitems";
|
|
|
- String relativePath;
|
|
|
- if (GetRelativePath(projectPath_, GetPath(path), relativePath))
|
|
|
- {
|
|
|
- path = relativePath + GetFileName(path) + GetExtension(path);
|
|
|
- }
|
|
|
+ if (projectGen_->GetProjectSettings())
|
|
|
+ projectName = projectGen_->GetProjectSettings()->GetName();
|
|
|
|
|
|
- XMLElement shared = project.CreateChild("Import");
|
|
|
- shared.SetAttribute("Project", path);
|
|
|
- shared.SetAttribute("Label", "Shared");
|
|
|
- }
|
|
|
+ if (name_ == projectName)
|
|
|
+ {
|
|
|
+ XMLElement afterBuild = project.CreateChild("Target");
|
|
|
+ afterBuild.SetAttribute("Name", "AfterBuild");
|
|
|
|
|
|
- for (unsigned i = 0; i < importProjects_.Size(); i++)
|
|
|
- {
|
|
|
- project.CreateChild("Import").SetAttribute("Project", importProjects_[i].CString());
|
|
|
- }
|
|
|
+ XMLElement copy = afterBuild.CreateChild("Copy");
|
|
|
+ copy.SetAttribute("SourceFiles", "$(TargetPath)");
|
|
|
|
|
|
- // Have to come after the imports, so AfterBuild exists
|
|
|
+ String destPath = projectPath_ + "../../../Resources/";
|
|
|
+ String relativePath;
|
|
|
|
|
|
- String projectName = "AtomicProject";
|
|
|
+ String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
|
|
|
|
|
|
- if (projectGen_->GetProjectSettings())
|
|
|
- projectName = projectGen_->GetProjectSettings()->GetName();
|
|
|
+ if (GetRelativePath(projectPath_, resourceDir, relativePath))
|
|
|
+ {
|
|
|
+ destPath = AddTrailingSlash(relativePath);
|
|
|
+ }
|
|
|
|
|
|
- if (name_ == projectName)
|
|
|
- {
|
|
|
- XMLElement afterBuild = project.CreateChild("Target");
|
|
|
- afterBuild.SetAttribute("Name", "AfterBuild");
|
|
|
+ copy.SetAttribute("DestinationFolder", destPath);
|
|
|
|
|
|
- XMLElement copy = afterBuild.CreateChild("Copy");
|
|
|
- copy.SetAttribute("SourceFiles", "$(TargetPath)");
|
|
|
+ }
|
|
|
|
|
|
- String destPath = projectPath_ + "../../../Resources/";
|
|
|
- String relativePath;
|
|
|
|
|
|
- String resourceDir = AddTrailingSlash(atomicProjectPath) + "Resources/";
|
|
|
+ String projectSource = xmlFile_->ToString();
|
|
|
|
|
|
- if (GetRelativePath(projectPath_, resourceDir, relativePath))
|
|
|
- {
|
|
|
- destPath = AddTrailingSlash(relativePath);
|
|
|
- }
|
|
|
+ SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".csproj"), FILE_WRITE));
|
|
|
+ output->Write(projectSource.CString(), projectSource.Length());
|
|
|
|
|
|
- copy.SetAttribute("DestinationFolder", destPath);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ bool NETCSProject::Generate()
|
|
|
+ {
|
|
|
+ FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+ NETSolution* solution = projectGen_->GetSolution();
|
|
|
|
|
|
+ projectPath_ = solution->GetOutputPath() + name_ + "/";
|
|
|
|
|
|
- String projectSource = xmlFile_->ToString();
|
|
|
+ if (!CreateProjectFolder(projectPath_))
|
|
|
+ return false;
|
|
|
|
|
|
- SharedPtr<File> output(new File(context_, GetSanitizedPath(projectPath_ + name_ + ".csproj"), FILE_WRITE));
|
|
|
- output->Write(projectSource.CString(), projectSource.Length());
|
|
|
+ if (!CreateProjectFolder(projectPath_ + "Properties"))
|
|
|
+ return false;
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ if (outputType_ == "Shared")
|
|
|
+ {
|
|
|
+ return GenerateShared();
|
|
|
+ }
|
|
|
|
|
|
- bool NETCSProject::Generate()
|
|
|
- {
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
- NETSolution* solution = projectGen_->GetSolution();
|
|
|
+ return GenerateStandard();
|
|
|
|
|
|
- projectPath_ = solution->GetOutputPath() + name_ + "/";
|
|
|
+ }
|
|
|
|
|
|
- if (!CreateProjectFolder(projectPath_))
|
|
|
- return false;
|
|
|
+ bool NETCSProject::Load(const JSONValue& root)
|
|
|
+ {
|
|
|
+ name_ = root["name"].GetString();
|
|
|
|
|
|
- if (!CreateProjectFolder(projectPath_ + "Properties"))
|
|
|
- return false;
|
|
|
+ projectGuid_ = root["projectGuid"].GetString();
|
|
|
|
|
|
- if (outputType_ == "Shared")
|
|
|
- {
|
|
|
- return GenerateShared();
|
|
|
- }
|
|
|
+ if (!projectGuid_.Length())
|
|
|
+ {
|
|
|
+ ATOMIC_LOGINFOF("GUID not provided for project %s, generating one", name_.CString());
|
|
|
+ projectGuid_ = projectGen_->GenerateUUID();
|
|
|
+ }
|
|
|
|
|
|
- return GenerateStandard();
|
|
|
+ outputType_ = root["outputType"].GetString();
|
|
|
|
|
|
- }
|
|
|
+ androidApplication_ = root["androidApplication"].GetBool();
|
|
|
+ playerApplication_ = root["playerApplication"].GetBool();
|
|
|
|
|
|
- bool NETCSProject::Load(const JSONValue& root)
|
|
|
- {
|
|
|
- name_ = root["name"].GetString();
|
|
|
+ rootNamespace_ = root["rootNamespace"].GetString();
|
|
|
+ assemblyName_ = root["assemblyName"].GetString();
|
|
|
+ assemblyOutputPath_ = root["assemblyOutputPath"].GetString();
|
|
|
+ ReplacePathStrings(assemblyOutputPath_);
|
|
|
+ assemblyOutputPath_ = GetSanitizedPath(assemblyOutputPath_);
|
|
|
|
|
|
- projectGuid_ = root["projectGuid"].GetString();
|
|
|
+ assemblySearchPaths_ = root["assemblySearchPaths"].GetString();
|
|
|
+ ReplacePathStrings(assemblySearchPaths_);
|
|
|
+ assemblySearchPaths_ = GetSanitizedPath(assemblySearchPaths_);
|
|
|
|
|
|
- if (!projectGuid_.Length())
|
|
|
- {
|
|
|
- ATOMIC_LOGINFOF("GUID not provided for project %s, generating one", name_.CString());
|
|
|
- projectGuid_ = projectGen_->GenerateUUID();
|
|
|
- }
|
|
|
+ const JSONArray& platforms = root["platforms"].GetArray();
|
|
|
|
|
|
- outputType_ = root["outputType"].GetString();
|
|
|
+ for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
+ {
|
|
|
+ String platform = platforms[i].GetString();
|
|
|
+ platforms_.Push(platform.ToLower());
|
|
|
+ }
|
|
|
|
|
|
- androidApplication_ = root["androidApplication"].GetBool();
|
|
|
- playerApplication_ = root["playerApplication"].GetBool();
|
|
|
+ const JSONArray& references = root["references"].GetArray();
|
|
|
|
|
|
- rootNamespace_ = root["rootNamespace"].GetString();
|
|
|
- assemblyName_ = root["assemblyName"].GetString();
|
|
|
- assemblyOutputPath_ = root["assemblyOutputPath"].GetString();
|
|
|
- ReplacePathStrings(assemblyOutputPath_);
|
|
|
- assemblyOutputPath_ = GetSanitizedPath(assemblyOutputPath_);
|
|
|
+ for (unsigned i = 0; i < references.Size(); i++)
|
|
|
+ {
|
|
|
+ String reference = references[i].GetString();
|
|
|
+ ReplacePathStrings(reference);
|
|
|
+ references_.Push(reference);
|
|
|
+ }
|
|
|
|
|
|
- assemblySearchPaths_ = root["assemblySearchPaths"].GetString();
|
|
|
- ReplacePathStrings(assemblySearchPaths_);
|
|
|
- assemblySearchPaths_ = GetSanitizedPath(assemblySearchPaths_);
|
|
|
+ const JSONArray& packages = root["packages"].GetArray();
|
|
|
|
|
|
- const JSONArray& platforms = root["platforms"].GetArray();
|
|
|
+ for (unsigned i = 0; i < packages.Size(); i++)
|
|
|
+ {
|
|
|
+ String package = packages[i].GetString();
|
|
|
|
|
|
- for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
- {
|
|
|
- String platform = platforms[i].GetString();
|
|
|
- platforms_.Push(platform.ToLower());
|
|
|
- }
|
|
|
+ if (packages_.Find(package) != packages_.End())
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERRORF("Duplicate package found %s", package.CString());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- const JSONArray& references = root["references"].GetArray();
|
|
|
+ projectGen_->GetSolution()->RegisterPackage(package);
|
|
|
|
|
|
- for (unsigned i = 0; i < references.Size(); i++)
|
|
|
- {
|
|
|
- String reference = references[i].GetString();
|
|
|
- ReplacePathStrings(reference);
|
|
|
- references_.Push(reference);
|
|
|
- }
|
|
|
+ packages_.Push(package);
|
|
|
+ }
|
|
|
|
|
|
- const JSONArray& packages = root["packages"].GetArray();
|
|
|
+ const JSONArray& sources = root["sources"].GetArray();
|
|
|
|
|
|
- for (unsigned i = 0; i < packages.Size(); i++)
|
|
|
- {
|
|
|
- String package = packages[i].GetString();
|
|
|
+ for (unsigned i = 0; i < sources.Size(); i++)
|
|
|
+ {
|
|
|
+ String source = sources[i].GetString();
|
|
|
+ ReplacePathStrings(source);
|
|
|
+ sourceFolders_.Push(AddTrailingSlash(source));
|
|
|
+ }
|
|
|
|
|
|
- if (packages_.Find(package) != packages_.End())
|
|
|
- {
|
|
|
- ATOMIC_LOGERRORF("Duplicate package found %s", package.CString());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ const JSONArray& defineConstants = root["defineConstants"].GetArray();
|
|
|
|
|
|
- projectGen_->GetSolution()->RegisterPackage(package);
|
|
|
+ for (unsigned i = 0; i < defineConstants.Size(); i++)
|
|
|
+ {
|
|
|
+ defineConstants_.Push(defineConstants[i].GetString());
|
|
|
+ }
|
|
|
|
|
|
- packages_.Push(package);
|
|
|
- }
|
|
|
+ const JSONArray& projectTypeGuids = root["projectTypeGuids"].GetArray();
|
|
|
|
|
|
- const JSONArray& sources = root["sources"].GetArray();
|
|
|
+ for (unsigned i = 0; i < projectTypeGuids.Size(); i++)
|
|
|
+ {
|
|
|
+ String guid = projectTypeGuids[i].GetString();
|
|
|
+ projectTypeGuids_.Push(ToString("{%s}", guid.CString()));
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < sources.Size(); i++)
|
|
|
- {
|
|
|
- String source = sources[i].GetString();
|
|
|
- ReplacePathStrings(source);
|
|
|
- sourceFolders_.Push(AddTrailingSlash(source));
|
|
|
- }
|
|
|
+ const JSONArray& importProjects = root["importProjects"].GetArray();
|
|
|
|
|
|
- const JSONArray& defineConstants = root["defineConstants"].GetArray();
|
|
|
+ for (unsigned i = 0; i < importProjects.Size(); i++)
|
|
|
+ {
|
|
|
+ importProjects_.Push(importProjects[i].GetString());
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < defineConstants.Size(); i++)
|
|
|
- {
|
|
|
- defineConstants_.Push(defineConstants[i].GetString());
|
|
|
- }
|
|
|
+ const JSONArray& libraryProjectZips = root["libraryProjectZips"].GetArray();
|
|
|
|
|
|
- const JSONArray& projectTypeGuids = root["projectTypeGuids"].GetArray();
|
|
|
+ for (unsigned i = 0; i < libraryProjectZips.Size(); i++)
|
|
|
+ {
|
|
|
+ String zipPath = libraryProjectZips[i].GetString();
|
|
|
+ ReplacePathStrings(zipPath);
|
|
|
+ libraryProjectZips_.Push(zipPath);
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < projectTypeGuids.Size(); i++)
|
|
|
- {
|
|
|
- String guid = projectTypeGuids[i].GetString();
|
|
|
- projectTypeGuids_.Push(ToString("{%s}", guid.CString()));
|
|
|
- }
|
|
|
+ const JSONArray& transformFiles = root["transformFiles"].GetArray();
|
|
|
|
|
|
- const JSONArray& importProjects = root["importProjects"].GetArray();
|
|
|
+ for (unsigned i = 0; i < transformFiles.Size(); i++)
|
|
|
+ {
|
|
|
+ String transformFile = transformFiles[i].GetString();
|
|
|
+ ReplacePathStrings(transformFile);
|
|
|
+ transformFiles_.Push(transformFile);
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < importProjects.Size(); i++)
|
|
|
- {
|
|
|
- importProjects_.Push(importProjects[i].GetString());
|
|
|
- }
|
|
|
+ const JSONArray& sharedReferences = root["sharedReferences"].GetArray();
|
|
|
|
|
|
- const JSONArray& libraryProjectZips = root["libraryProjectZips"].GetArray();
|
|
|
+ for (unsigned i = 0; i < sharedReferences.Size(); i++)
|
|
|
+ {
|
|
|
+ sharedReferences_.Push(sharedReferences[i].GetString());
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned i = 0; i < libraryProjectZips.Size(); i++)
|
|
|
- {
|
|
|
- String zipPath = libraryProjectZips[i].GetString();
|
|
|
- ReplacePathStrings(zipPath);
|
|
|
- libraryProjectZips_.Push(zipPath);
|
|
|
- }
|
|
|
+ targetFrameworkProfile_ = root["targetFrameworkProfile"].GetString();
|
|
|
|
|
|
- const JSONArray& transformFiles = root["transformFiles"].GetArray();
|
|
|
+ // iOS
|
|
|
+ objcBindingApiDefinition_ = root["objcBindingApiDefinition"].GetString();
|
|
|
+ ReplacePathStrings(objcBindingApiDefinition_);
|
|
|
|
|
|
- for (unsigned i = 0; i < transformFiles.Size(); i++)
|
|
|
- {
|
|
|
- String transformFile = transformFiles[i].GetString();
|
|
|
- ReplacePathStrings(transformFile);
|
|
|
- transformFiles_.Push(transformFile);
|
|
|
- }
|
|
|
+ codesignEntitlements_ = root["codesignEntitlements"].GetString();
|
|
|
+ ReplacePathStrings(codesignEntitlements_);
|
|
|
|
|
|
- const JSONArray& sharedReferences = root["sharedReferences"].GetArray();
|
|
|
+ infoPList_ = root["infoPList"].GetString();
|
|
|
+ ReplacePathStrings(infoPList_);
|
|
|
|
|
|
- for (unsigned i = 0; i < sharedReferences.Size(); i++)
|
|
|
- {
|
|
|
- sharedReferences_.Push(sharedReferences[i].GetString());
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- targetFrameworkProfile_ = root["targetFrameworkProfile"].GetString();
|
|
|
+ NETSolution::NETSolution(Context* context, NETProjectGen* projectGen, bool rewrite) : NETProjectBase(context, projectGen),
|
|
|
+ rewriteSolution_(rewrite)
|
|
|
+ {
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETSolution::NETSolution(Context* context, NETProjectGen* projectGen, bool rewrite) : NETProjectBase(context, projectGen),
|
|
|
- rewriteSolution_(rewrite)
|
|
|
- {
|
|
|
+ NETSolution::~NETSolution()
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETSolution::~NETSolution()
|
|
|
- {
|
|
|
+ bool NETSolution::Generate()
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ String slnPath = outputPath_ + name_ + ".sln";
|
|
|
|
|
|
- bool NETSolution::Generate()
|
|
|
- {
|
|
|
+ GenerateSolution(slnPath);
|
|
|
|
|
|
- String slnPath = outputPath_ + name_ + ".sln";
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- GenerateSolution(slnPath);
|
|
|
+ void NETSolution::GenerateSolution(const String &slnPath)
|
|
|
+ {
|
|
|
+ String source = "Microsoft Visual Studio Solution File, Format Version 12.00\n";
|
|
|
+ source += "# Visual Studio 14\n";
|
|
|
+ source += "VisualStudioVersion = 14.0.25420.1\n";
|
|
|
+ source += "MinimumVisualStudioVersion = 10.0.40219.1\n";
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ solutionGUID_ = projectGen_->GenerateUUID();
|
|
|
|
|
|
- void NETSolution::GenerateSolution(const String &slnPath)
|
|
|
- {
|
|
|
- String source = "Microsoft Visual Studio Solution File, Format Version 12.00\n";
|
|
|
- source += "# Visual Studio 14\n";
|
|
|
- source += "VisualStudioVersion = 14.0.25420.1\n";
|
|
|
- source += "MinimumVisualStudioVersion = 10.0.40219.1\n";
|
|
|
+ PODVector<NETCSProject*> depends;
|
|
|
+ const Vector<SharedPtr<NETCSProject>>& projects = projectGen_->GetCSProjects();
|
|
|
|
|
|
- solutionGUID_ = projectGen_->GenerateUUID();
|
|
|
+ for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
+ {
|
|
|
+ NETCSProject* p = projects.At(i);
|
|
|
|
|
|
- PODVector<NETCSProject*> depends;
|
|
|
- const Vector<SharedPtr<NETCSProject>>& projects = projectGen_->GetCSProjects();
|
|
|
+ const String& projectName = p->GetName();
|
|
|
+ const String& projectGUID = p->GetProjectGUID();
|
|
|
|
|
|
- for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
- {
|
|
|
- NETCSProject* p = projects.At(i);
|
|
|
+ String CSharpProjectGUID = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
|
|
|
+ String ext = "csproj";
|
|
|
|
|
|
- const String& projectName = p->GetName();
|
|
|
- const String& projectGUID = p->GetProjectGUID();
|
|
|
+ if (p->outputType_ == "Shared")
|
|
|
+ {
|
|
|
+ CSharpProjectGUID = "D954291E-2A0B-460D-934E-DC6B0785DB48";
|
|
|
+ ext = "shproj";
|
|
|
+ }
|
|
|
|
|
|
- String CSharpProjectGUID = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
|
|
|
- String ext = "csproj";
|
|
|
+ source += ToString("Project(\"{%s}\") = \"%s\", \"%s\\%s.%s\", \"{%s}\"\n",
|
|
|
+ CSharpProjectGUID.CString(), projectName.CString(), projectName.CString(),
|
|
|
+ projectName.CString(), ext.CString(), projectGUID.CString());
|
|
|
|
|
|
- if (p->outputType_ == "Shared")
|
|
|
- {
|
|
|
- CSharpProjectGUID = "D954291E-2A0B-460D-934E-DC6B0785DB48";
|
|
|
- ext = "shproj";
|
|
|
- }
|
|
|
|
|
|
- source += ToString("Project(\"{%s}\") = \"%s\", \"%s\\%s.%s\", \"{%s}\"\n",
|
|
|
- CSharpProjectGUID.CString(), projectName.CString(), projectName.CString(),
|
|
|
- projectName.CString(), ext.CString(), projectGUID.CString());
|
|
|
+ projectGen_->GetCSProjectDependencies(p, depends);
|
|
|
|
|
|
+ if (depends.Size())
|
|
|
+ {
|
|
|
+ source += "\tProjectSection(ProjectDependencies) = postProject\n";
|
|
|
|
|
|
- projectGen_->GetCSProjectDependencies(p, depends);
|
|
|
+ for (unsigned j = 0; j < depends.Size(); j++)
|
|
|
+ {
|
|
|
+ source += ToString("\t{%s} = {%s}\n",
|
|
|
+ depends[j]->GetProjectGUID().CString(), depends[j]->GetProjectGUID().CString());
|
|
|
+ }
|
|
|
|
|
|
- if (depends.Size())
|
|
|
- {
|
|
|
- source += "\tProjectSection(ProjectDependencies) = postProject\n";
|
|
|
+ source += "\tEndProjectSection\n";
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned j = 0; j < depends.Size(); j++)
|
|
|
- {
|
|
|
- source += ToString("\t{%s} = {%s}\n",
|
|
|
- depends[j]->GetProjectGUID().CString(), depends[j]->GetProjectGUID().CString());
|
|
|
- }
|
|
|
+ source += "EndProject\n";
|
|
|
+ }
|
|
|
|
|
|
- source += "\tEndProjectSection\n";
|
|
|
- }
|
|
|
+ source += "Global\n";
|
|
|
|
|
|
- source += "EndProject\n";
|
|
|
- }
|
|
|
+ // SharedMSBuildProjectFiles
|
|
|
|
|
|
- source += "Global\n";
|
|
|
+ source += " GlobalSection(SharedMSBuildProjectFiles) = preSolution\n";
|
|
|
|
|
|
- // SharedMSBuildProjectFiles
|
|
|
+ for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
+ {
|
|
|
+ NETCSProject* p = projects.At(i);
|
|
|
|
|
|
- source += " GlobalSection(SharedMSBuildProjectFiles) = preSolution\n";
|
|
|
+ if (p->outputType_ == "Shared")
|
|
|
+ {
|
|
|
|
|
|
- for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
- {
|
|
|
- NETCSProject* p = projects.At(i);
|
|
|
+ for (unsigned j = 0; j < projects.Size(); j++)
|
|
|
+ {
|
|
|
+ NETCSProject* p2 = projects.At(j);
|
|
|
|
|
|
- if (p->outputType_ == "Shared")
|
|
|
- {
|
|
|
+ if (p == p2)
|
|
|
+ {
|
|
|
+ source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 13\n", p->name_.CString(), p->name_.CString(), p->projectGuid_.CString());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (p2->sharedReferences_.Contains(p->name_))
|
|
|
+ {
|
|
|
+ source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 4\n", p->name_.CString(), p->name_.CString(), p2->projectGuid_.CString());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- for (unsigned j = 0; j < projects.Size(); j++)
|
|
|
- {
|
|
|
- NETCSProject* p2 = projects.At(j);
|
|
|
+ }
|
|
|
|
|
|
- if (p == p2)
|
|
|
- {
|
|
|
- source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 13\n", p->name_.CString(), p->name_.CString(), p->projectGuid_.CString());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (p2->sharedReferences_.Contains(p->name_))
|
|
|
- {
|
|
|
- source += ToString(" %s\\%s.projitems*{%s}*SharedItemsImports = 4\n", p->name_.CString(), p->name_.CString(), p2->projectGuid_.CString());
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ source += " EndGlobalSection\n";
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ source += " GlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
|
|
+ source += " Debug|Any CPU = Debug|Any CPU\n";
|
|
|
+ source += " Release|Any CPU = Release|Any CPU\n";
|
|
|
+ source += " Debug|iPhone = Debug|iPhone\n";
|
|
|
+ source += " Release|iPhone = Release|iPhone\n";
|
|
|
+ source += " EndGlobalSection\n";
|
|
|
+ source += " GlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
|
|
|
|
|
- source += " EndGlobalSection\n";
|
|
|
+ for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
+ {
|
|
|
+ NETCSProject* p = projects.At(i);
|
|
|
|
|
|
- source += " GlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
|
|
- source += " Debug|Any CPU = Debug|Any CPU\n";
|
|
|
- source += " Release|Any CPU = Release|Any CPU\n";
|
|
|
- source += " EndGlobalSection\n";
|
|
|
- source += " GlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
|
|
+ if (p->outputType_ == "Shared")
|
|
|
+ continue;
|
|
|
|
|
|
- for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
- {
|
|
|
- NETCSProject* p = projects.At(i);
|
|
|
+ String cpu = "Any CPU";
|
|
|
+ if (p->GetIsPlayerApp() && p->SupportsPlatform("ios"))
|
|
|
+ cpu = "iPhone";
|
|
|
|
|
|
- if (p->outputType_ == "Shared")
|
|
|
- continue;
|
|
|
+ source += ToString(" {%s}.Debug|%s.ActiveCfg = Debug|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
|
|
|
+ source += ToString(" {%s}.Debug|%s.Build.0 = Debug|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
|
|
|
+ source += ToString(" {%s}.Release|%s.ActiveCfg = Release|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
|
|
|
+ source += ToString(" {%s}.Release|%s.Build.0 = Release|%s\n", p->GetProjectGUID().CString(), cpu.CString(), cpu.CString());
|
|
|
|
|
|
- source += ToString(" {%s}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
- source += ToString(" {%s}.Debug|Any CPU.Build.0 = Debug|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
- source += ToString(" {%s}.Release|Any CPU.ActiveCfg = Release|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
- source += ToString(" {%s}.Release|Any CPU.Build.0 = Release|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
- }
|
|
|
+ if (cpu != "iPhone" && (p->SupportsPlatform("ios", false)))
|
|
|
+ {
|
|
|
+ source += ToString(" {%s}.Debug|iPhone.ActiveCfg = Debug|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
+ source += ToString(" {%s}.Debug|iPhone.Build.0 = Debug|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
+ source += ToString(" {%s}.Release|iPhone.ActiveCfg = Release|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
+ source += ToString(" {%s}.Release|iPhone.Build.0 = Release|Any CPU\n", p->GetProjectGUID().CString());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- source += " EndGlobalSection\n";
|
|
|
+ source += " EndGlobalSection\n";
|
|
|
|
|
|
- source += "EndGlobal\n";
|
|
|
+ source += "EndGlobal\n";
|
|
|
|
|
|
- if (!rewriteSolution_)
|
|
|
- {
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
- if (fileSystem->Exists(slnPath))
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!rewriteSolution_)
|
|
|
+ {
|
|
|
+ FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
+ if (fileSystem->Exists(slnPath))
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
SharedPtr<File> output(new File(context_, GetSanitizedPath(slnPath), FILE_WRITE));
|
|
|
- output->Write(source.CString(), source.Length());
|
|
|
- output->Close();
|
|
|
- }
|
|
|
+ output->Write(source.CString(), source.Length());
|
|
|
+ output->Close();
|
|
|
+ }
|
|
|
|
|
|
- bool NETSolution::Load(const JSONValue& root)
|
|
|
- {
|
|
|
- FileSystem* fs = GetSubsystem<FileSystem>();
|
|
|
+ bool NETSolution::Load(const JSONValue& root)
|
|
|
+ {
|
|
|
+ FileSystem* fs = GetSubsystem<FileSystem>();
|
|
|
|
|
|
- name_ = root["name"].GetString();
|
|
|
+ name_ = root["name"].GetString();
|
|
|
|
|
|
- outputPath_ = AddTrailingSlash(root["outputPath"].GetString());
|
|
|
+ outputPath_ = AddTrailingSlash(root["outputPath"].GetString());
|
|
|
|
|
|
- ReplacePathStrings(outputPath_);
|
|
|
+ ReplacePathStrings(outputPath_);
|
|
|
|
|
|
- // TODO: use poco mkdirs
|
|
|
- if (!fs->DirExists(outputPath_))
|
|
|
- fs->CreateDirsRecursive(outputPath_);
|
|
|
+ // TODO: use poco mkdirs
|
|
|
+ if (!fs->DirExists(outputPath_))
|
|
|
+ fs->CreateDirsRecursive(outputPath_);
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- bool NETSolution::RegisterPackage(const String& package)
|
|
|
- {
|
|
|
- if (packages_.Find(package) != packages_.End())
|
|
|
- return false;
|
|
|
+ bool NETSolution::RegisterPackage(const String& package)
|
|
|
+ {
|
|
|
+ if (packages_.Find(package) != packages_.End())
|
|
|
+ return false;
|
|
|
|
|
|
- packages_.Push(package);
|
|
|
+ packages_.Push(package);
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- NETProjectGen::NETProjectGen(Context* context) : Object(context),
|
|
|
- rewriteSolution_(false)
|
|
|
- {
|
|
|
+ NETProjectGen::NETProjectGen(Context* context) : Object(context),
|
|
|
+ rewriteSolution_(false)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETProjectGen::~NETProjectGen()
|
|
|
- {
|
|
|
+ NETProjectGen::~NETProjectGen()
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- NETCSProject* NETProjectGen::GetCSProjectByName(const String & name)
|
|
|
- {
|
|
|
+ NETCSProject* NETProjectGen::GetCSProjectByName(const String & name)
|
|
|
+ {
|
|
|
|
|
|
- for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
- {
|
|
|
- if (projects_[i]->GetName() == name)
|
|
|
- return projects_[i];
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
+ {
|
|
|
+ if (projects_[i]->GetName() == name)
|
|
|
+ return projects_[i];
|
|
|
+ }
|
|
|
|
|
|
- return nullptr;
|
|
|
- }
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::GetCSProjectDependencies(NETCSProject* source, PODVector<NETCSProject*>& depends) const
|
|
|
- {
|
|
|
- depends.Clear();
|
|
|
+ bool NETProjectGen::GetCSProjectDependencies(NETCSProject* source, PODVector<NETCSProject*>& depends) const
|
|
|
+ {
|
|
|
+ depends.Clear();
|
|
|
|
|
|
- const Vector<String>& references = source->GetReferences();
|
|
|
+ const Vector<String>& references = source->GetReferences();
|
|
|
|
|
|
- for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
- {
|
|
|
- NETCSProject* pdepend = projects_.At(i);
|
|
|
+ for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
+ {
|
|
|
+ NETCSProject* pdepend = projects_.At(i);
|
|
|
|
|
|
- if (source == pdepend)
|
|
|
- continue;
|
|
|
+ if (source == pdepend)
|
|
|
+ continue;
|
|
|
|
|
|
- for (unsigned j = 0; j < references.Size(); j++)
|
|
|
- {
|
|
|
- if (pdepend->GetName() == references[j])
|
|
|
- {
|
|
|
- depends.Push(pdepend);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ for (unsigned j = 0; j < references.Size(); j++)
|
|
|
+ {
|
|
|
+ if (pdepend->GetName() == references[j])
|
|
|
+ {
|
|
|
+ depends.Push(pdepend);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return depends.Size() != 0;
|
|
|
+ return depends.Size() != 0;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::Generate()
|
|
|
- {
|
|
|
- solution_->Generate();
|
|
|
+ bool NETProjectGen::Generate()
|
|
|
+ {
|
|
|
+ solution_->Generate();
|
|
|
|
|
|
- for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
- {
|
|
|
- if (!projects_[i]->Generate())
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < projects_.Size(); i++)
|
|
|
+ {
|
|
|
+ if (!projects_[i]->Generate())
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- void NETProjectGen::SetRewriteSolution(bool rewrite)
|
|
|
- {
|
|
|
- rewriteSolution_ = rewrite;
|
|
|
+ void NETProjectGen::SetRewriteSolution(bool rewrite)
|
|
|
+ {
|
|
|
+ rewriteSolution_ = rewrite;
|
|
|
|
|
|
- if (solution_.NotNull())
|
|
|
- solution_->SetRewriteSolution(rewrite);
|
|
|
- }
|
|
|
+ if (solution_.NotNull())
|
|
|
+ solution_->SetRewriteSolution(rewrite);
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::IncludeProjectOnPlatform(const JSONValue& projectRoot, const String& platform)
|
|
|
- {
|
|
|
- const JSONArray& platforms = projectRoot["platforms"].GetArray();
|
|
|
+ bool NETProjectGen::IncludeProjectOnPlatform(const JSONValue& projectRoot, const String& platform)
|
|
|
+ {
|
|
|
+ const JSONArray& platforms = projectRoot["platforms"].GetArray();
|
|
|
|
|
|
- if (!platforms.Size())
|
|
|
- return true; // all platforms
|
|
|
+ if (!platforms.Size())
|
|
|
+ return true; // all platforms
|
|
|
|
|
|
- String scriptPlatform = platform.ToLower();
|
|
|
+ String scriptPlatform = platform.ToLower();
|
|
|
|
|
|
- for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
- {
|
|
|
- String platform = platforms[i].GetString().ToLower();
|
|
|
+ for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
+ {
|
|
|
+ String platform = platforms[i].GetString().ToLower();
|
|
|
|
|
|
- if (platform == "desktop")
|
|
|
- {
|
|
|
- if (scriptPlatform == "windows" || scriptPlatform == "macosx" || scriptPlatform == "linux")
|
|
|
- return true;
|
|
|
+ if (platform == "desktop")
|
|
|
+ {
|
|
|
+ if (scriptPlatform == "windows" || scriptPlatform == "macosx" || scriptPlatform == "linux")
|
|
|
+ return true;
|
|
|
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- if (platform == "android" && scriptPlatform != "android")
|
|
|
- return false;
|
|
|
+ if (platform == "android" && scriptPlatform != "android")
|
|
|
+ return false;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- return true;
|
|
|
+ return true;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::LoadProject(const JSONValue &root)
|
|
|
- {
|
|
|
+ bool NETProjectGen::LoadProject(const JSONValue &root)
|
|
|
+ {
|
|
|
|
|
|
- solution_ = new NETSolution(context_, this, rewriteSolution_);
|
|
|
+ solution_ = new NETSolution(context_, this, rewriteSolution_);
|
|
|
|
|
|
- solution_->Load(root["solution"]);
|
|
|
+ solution_->Load(root["solution"]);
|
|
|
|
|
|
- const JSONValue& jprojects = root["projects"];
|
|
|
+ const JSONValue& jprojects = root["projects"];
|
|
|
|
|
|
- if (!jprojects.IsArray() || !jprojects.Size())
|
|
|
- return false;
|
|
|
+ if (!jprojects.IsArray() || !jprojects.Size())
|
|
|
+ return false;
|
|
|
|
|
|
- for (unsigned i = 0; i < jprojects.Size(); i++)
|
|
|
- {
|
|
|
- const JSONValue& jproject = jprojects[i];
|
|
|
+ for (unsigned i = 0; i < jprojects.Size(); i++)
|
|
|
+ {
|
|
|
+ const JSONValue& jproject = jprojects[i];
|
|
|
|
|
|
- if (!jproject.IsObject())
|
|
|
- return false;
|
|
|
+ if (!jproject.IsObject())
|
|
|
+ return false;
|
|
|
|
|
|
- JSONArray platforms = jproject["platforms"].GetArray();
|
|
|
+ JSONArray platforms = jproject["platforms"].GetArray();
|
|
|
|
|
|
- if (platforms.Size())
|
|
|
- {
|
|
|
- bool found = false;
|
|
|
- for (unsigned j = 0; j < platforms.Size(); j++)
|
|
|
- {
|
|
|
- if (GetSupportsPlatform(platforms[j].GetString()))
|
|
|
- {
|
|
|
- found = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (platforms.Size())
|
|
|
+ {
|
|
|
+ bool found = false;
|
|
|
+ for (unsigned j = 0; j < platforms.Size(); j++)
|
|
|
+ {
|
|
|
+ if (GetSupportsPlatform(platforms[j].GetString()))
|
|
|
+ {
|
|
|
+ found = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (!found)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!found)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // HACK! Do not generate AtomicNETService in the AtomicProject solution
|
|
|
- if (jproject["name"].GetString() == "AtomicNETService" && atomicProjectPath_.Length())
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ // HACK! Do not generate AtomicNETService in the AtomicProject solution
|
|
|
+ if (jproject["name"].GetString() == "AtomicNETService" && atomicProjectPath_.Length())
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- SharedPtr<NETCSProject> csProject(new NETCSProject(context_, this));
|
|
|
+ SharedPtr<NETCSProject> csProject(new NETCSProject(context_, this));
|
|
|
|
|
|
- if (!csProject->Load(jproject))
|
|
|
- return false;
|
|
|
+ if (!csProject->Load(jproject))
|
|
|
+ return false;
|
|
|
|
|
|
- projects_.Push(csProject);
|
|
|
+ projects_.Push(csProject);
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::LoadJSONProject(const String& jsonProjectPath)
|
|
|
- {
|
|
|
- SharedPtr<File> file(new File(context_));
|
|
|
+ bool NETProjectGen::LoadJSONProject(const String& jsonProjectPath)
|
|
|
+ {
|
|
|
+ SharedPtr<File> file(new File(context_));
|
|
|
|
|
|
if (!file->Open(GetSanitizedPath(jsonProjectPath)))
|
|
|
- return false;
|
|
|
-
|
|
|
- String json;
|
|
|
- file->ReadText(json);
|
|
|
-
|
|
|
- JSONValue jvalue;
|
|
|
-
|
|
|
- if (!JSONFile::ParseJSON(json, jvalue))
|
|
|
- return false;
|
|
|
-
|
|
|
- return LoadProject(jvalue);
|
|
|
- }
|
|
|
-
|
|
|
- bool NETProjectGen::LoadAtomicProject(const String& atomicProjectPath)
|
|
|
- {
|
|
|
- FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
- ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
- ToolSystem* tsystem = GetSubsystem<ToolSystem>();
|
|
|
-
|
|
|
- String pathname, filename, ext;
|
|
|
- SplitPath(atomicProjectPath, pathname, filename, ext);
|
|
|
-
|
|
|
- if (ext == ".atomic")
|
|
|
- {
|
|
|
- atomicProjectPath_ = AddTrailingSlash(pathname);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- atomicProjectPath_ = AddTrailingSlash(atomicProjectPath);
|
|
|
- }
|
|
|
-
|
|
|
- // Do we have a loaded project?
|
|
|
- if (Project* project = tsystem->GetProject())
|
|
|
- {
|
|
|
- // If so, use loaded project settings
|
|
|
- projectSettings_ = project->GetProjectSettings();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Nope, load them up
|
|
|
- projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
|
|
|
- projectSettings_->Load(atomicProjectPath_ + "Settings/Platforms.json");
|
|
|
- }
|
|
|
+ return false;
|
|
|
+
|
|
|
+ String json;
|
|
|
+ file->ReadText(json);
|
|
|
+
|
|
|
+ JSONValue jvalue;
|
|
|
+
|
|
|
+ if (!JSONFile::ParseJSON(json, jvalue))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ return LoadProject(jvalue);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool NETProjectGen::LoadAtomicProject(const String& atomicProjectPath)
|
|
|
+ {
|
|
|
+ ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
|
|
|
+ ToolSystem* tsystem = GetSubsystem<ToolSystem>();
|
|
|
+
|
|
|
+ String pathname, filename, ext;
|
|
|
+ SplitPath(atomicProjectPath, pathname, filename, ext);
|
|
|
+
|
|
|
+ if (ext == ".atomic")
|
|
|
+ {
|
|
|
+ atomicProjectPath_ = AddTrailingSlash(pathname);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ atomicProjectPath_ = AddTrailingSlash(atomicProjectPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Do we have a loaded project?
|
|
|
+ if (Project* project = tsystem->GetProject())
|
|
|
+ {
|
|
|
+ // If so, use loaded project settings
|
|
|
+ projectSettings_ = project->GetProjectSettings();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Nope, load them up
|
|
|
+ projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
|
|
|
+ projectSettings_->Load(atomicProjectPath_ + "Settings/Project.json");
|
|
|
+ }
|
|
|
|
|
|
#ifdef ATOMIC_DEV_BUILD
|
|
|
|
|
|
- JSONValue netJSON;
|
|
|
+ JSONValue netJSON;
|
|
|
|
|
|
- SharedPtr<File> netJSONFile(new File(context_));
|
|
|
+ SharedPtr<File> netJSONFile(new File(context_));
|
|
|
|
|
|
- String atomicNETProject = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicNETProject.json";
|
|
|
+ String atomicNETProject = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicNETProject.json";
|
|
|
|
|
|
if (!netJSONFile->Open(GetSanitizedPath(atomicNETProject)))
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
|
|
|
- String netJSONString;
|
|
|
- netJSONFile->ReadText(netJSONString);
|
|
|
+ String netJSONString;
|
|
|
+ netJSONFile->ReadText(netJSONString);
|
|
|
|
|
|
- if (!JSONFile::ParseJSON(netJSONString, netJSON))
|
|
|
- return false;
|
|
|
+ if (!JSONFile::ParseJSON(netJSONString, netJSON))
|
|
|
+ return false;
|
|
|
#endif
|
|
|
|
|
|
#ifdef ATOMIC_DEV_BUILD
|
|
|
|
|
|
- String projectPath = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicProject.json";
|
|
|
+ String projectPath = tenv->GetRootSourceDir() + "Script/AtomicNET/AtomicProject.json";
|
|
|
#else
|
|
|
- String projectPath = tenv->GetAtomicNETRootDir() + "Build/Projects/AtomicProject.json";
|
|
|
+ String projectPath = tenv->GetAtomicNETRootDir() + "Build/Projects/AtomicProject.json";
|
|
|
#endif
|
|
|
|
|
|
- SharedPtr<File> file(new File(context_));
|
|
|
+ SharedPtr<File> file(new File(context_));
|
|
|
|
|
|
if (!file->Open(GetSanitizedPath(projectPath)))
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
|
|
|
- String json;
|
|
|
- file->ReadText(json);
|
|
|
+ String json;
|
|
|
+ file->ReadText(json);
|
|
|
|
|
|
- json.Replace("$ATOMIC_PROJECT_NAME$", projectSettings_->GetName());
|
|
|
+ json.Replace("$ATOMIC_PROJECT_NAME$", projectSettings_->GetName());
|
|
|
|
|
|
- JSONValue jvalue;
|
|
|
+ JSONValue jvalue;
|
|
|
|
|
|
- if (!JSONFile::ParseJSON(json, jvalue))
|
|
|
- return false;
|
|
|
+ if (!JSONFile::ParseJSON(json, jvalue))
|
|
|
+ return false;
|
|
|
|
|
|
#ifdef ATOMIC_DEV_BUILD
|
|
|
|
|
|
- // patch projects
|
|
|
- JSONArray netProjects = netJSON["projects"].GetArray();
|
|
|
- JSONArray projects = jvalue["projects"].GetArray();
|
|
|
+ // patch projects
|
|
|
+ JSONArray netProjects = netJSON["projects"].GetArray();
|
|
|
+ JSONArray projects = jvalue["projects"].GetArray();
|
|
|
|
|
|
- for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
- {
|
|
|
- netProjects.Push(JSONValue(projects[i].GetObject()));
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < projects.Size(); i++)
|
|
|
+ {
|
|
|
+ netProjects.Push(JSONValue(projects[i].GetObject()));
|
|
|
+ }
|
|
|
|
|
|
- jvalue["projects"] = netProjects;
|
|
|
+ jvalue["projects"] = netProjects;
|
|
|
|
|
|
- return LoadProject(jvalue);
|
|
|
+ return LoadProject(jvalue);
|
|
|
|
|
|
#else
|
|
|
- return LoadProject(jvalue);
|
|
|
+ return LoadProject(jvalue);
|
|
|
#endif
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- void NETProjectGen::SetSupportedPlatforms(const StringVector& platforms)
|
|
|
- {
|
|
|
- projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
|
|
|
+ void NETProjectGen::SetSupportedPlatforms(const StringVector& platforms)
|
|
|
+ {
|
|
|
+ projectSettings_ = SharedPtr<ProjectSettings>(new ProjectSettings(context_));
|
|
|
|
|
|
- for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
- {
|
|
|
- projectSettings_->AddSupportedPlatform(platforms[i]);
|
|
|
- }
|
|
|
+ for (unsigned i = 0; i < platforms.Size(); i++)
|
|
|
+ {
|
|
|
+ projectSettings_->AddSupportedPlatform(platforms[i]);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::GetSupportsPlatform(const String& platform) const
|
|
|
- {
|
|
|
- // If no project platform settings are loaded, always supports
|
|
|
- if (projectSettings_.Null())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ bool NETProjectGen::GetSupportsPlatform(const String& platform) const
|
|
|
+ {
|
|
|
+ // If no project platform settings are loaded, always supports
|
|
|
+ if (projectSettings_.Null())
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- return projectSettings_->GetSupportsPlatform(platform);
|
|
|
+ return projectSettings_->GetSupportsPlatform(platform);
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bool NETProjectGen::GetRequiresNuGet()
|
|
|
- {
|
|
|
- if (solution_.Null())
|
|
|
- {
|
|
|
- ATOMIC_LOGERROR("NETProjectGen::GetRequiresNuGet() - called without a solution loaded");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ bool NETProjectGen::GetRequiresNuGet()
|
|
|
+ {
|
|
|
+ if (solution_.Null())
|
|
|
+ {
|
|
|
+ ATOMIC_LOGERROR("NETProjectGen::GetRequiresNuGet() - called without a solution loaded");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- return solution_->GetPackages().Size() != 0;
|
|
|
+ return solution_->GetPackages().Size() != 0;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- String NETProjectGen::GenerateUUID()
|
|
|
- {
|
|
|
- Poco::UUIDGenerator& generator = Poco::UUIDGenerator::defaultGenerator();
|
|
|
- Poco::UUID uuid(generator.create()); // time based
|
|
|
- return String(uuid.toString().c_str()).ToUpper();
|
|
|
- }
|
|
|
+ String NETProjectGen::GenerateUUID()
|
|
|
+ {
|
|
|
+ Poco::UUIDGenerator& generator = Poco::UUIDGenerator::defaultGenerator();
|
|
|
+ Poco::UUID uuid(generator.create()); // time based
|
|
|
+ return String(uuid.toString().c_str()).ToUpper();
|
|
|
+ }
|
|
|
|
|
|
}
|