/// <summary> /// 添加 plist 信息 /// </summary> /// <param name="mod"></param> /// <param name="key"></param> /// <param name="value"></param> static void AddPlistInfo(this XCMod mod, string key, object value) { if (mod == null) { Debug.LogError("mod is null"); return; } if (mod.plist == null) { mod.plist = new Hashtable(); } mod.plist.Add(key, value); }
/// <summary> /// 修改mod /// </summary> /// <param name="project"></param> /// <param name="pbxmod"></param> static void ApplyMod(XCProject project, string pbxmod) { if (string.IsNullOrEmpty(pbxmod)) { Debug.LogError(" pbxmod is null "); return; } XCMod mod = new XCMod(pbxmod); //添加 plist //mod.AddPlistInfo("NSMicrophoneUsageDescription", "凯瑞利亚需要您的同意,才能访问麦克风"); mod.AddPlistInfo("NSCameraUsageDescription", "App需要您的同意,才能访问相机"); mod.AddPlistInfo("NSPhotoLibraryUsageDescription", "App需要您的同意,才能访问相册"); project.ApplyMod(mod); }
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { if (string.IsNullOrEmpty(s_projModePath)) { return; } Debug.Log("Export Path => " + pathToBuiltProject); if (target != BuildTarget.iOS) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } // Create a new project object from build target XCProject project = new XCProject(pathToBuiltProject); List <string> ListFrameworks = new List <string>(); XCMod mod = new XCMod(s_projModePath); foreach (string folderPath in mod.folders) { ParseFrameWork(folderPath, ListFrameworks); } for (int lCnt = 0; lCnt < ListFrameworks.Count; ++lCnt) { mod.files.Add(ListFrameworks[lCnt]); } project.ApplyMod(mod); // project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release"); project.Save(); s_projModePath = null; }
private void ChangeIOSTargetOSVersion() { // // 仅针对ios渠道 // if (_gameSettingData.platformType != GameSetting.PlatformType.ROOTIOS && // _gameSettingData.platformType != GameSetting.PlatformType.IOS) // { // return; // } var modFolder = Application.dataPath.Replace("/Assets", "/Mods"); var modName = GetChannelProjmods(_gameSettingData.channel); var modPath = string.Format("{0}/{1}", modFolder, modName); if (string.IsNullOrEmpty(modName) || !File.Exists(modPath)) { return; } var mod = new XCMod(modPath); PlayerSettings.iOS.targetOSVersion = mod.IOSTargetOSVersion >= iOSTargetOSVersion.iOS_6_0 ? mod.IOSTargetOSVersion : iOSTargetOSVersion.iOS_6_0; }
public void ApplyMod( XCMod mod ) { PBXGroup modGroup = this.GetGroup( mod.group ); Debug.Log( "Adding libraries..." ); foreach( XCModFile libRef in mod.libs ) { string completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath ); Debug.Log ("Adding library " + completeLibPath); this.AddFile( completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak ); } Debug.Log( "Adding frameworks..." ); PBXGroup frameworkGroup = this.GetGroup( "Frameworks" ); foreach( string framework in mod.frameworks ) { string[] filename = framework.Split( ':' ); bool isWeak = ( filename.Length > 1 ) ? true : false; string completePath = System.IO.Path.Combine( "System/Library/Frameworks", filename[0] ); this.AddFile( completePath, frameworkGroup, "SDKROOT", true, isWeak ); } Debug.Log( "Adding files..." ); foreach( string filePath in mod.files ) { string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath ); this.AddFile( absoluteFilePath, modGroup ); } Debug.Log( "Adding folders..." ); foreach( string folderPath in mod.folders ) { string absoluteFolderPath = System.IO.Path.Combine( Application.dataPath, folderPath ); Debug.Log ("Adding folder " + absoluteFolderPath); this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ) ); } Debug.Log( "Adding headerpaths..." ); foreach( string headerpath in mod.headerpaths ) { if (headerpath.Contains("$(inherited)")) { Debug.Log ("not prepending a path to " + headerpath); this.AddHeaderSearchPaths( headerpath ); } else { string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath ); this.AddHeaderSearchPaths( absoluteHeaderPath ); } } Debug.Log( "Adding compiler flags..." ); //foreach( string flag in mod.compiler_flags ) { // this.AddOtherCFlags( flag ); //} Debug.Log( "Adding linker flags..." ); foreach( string flag in mod.linker_flags ) { this.AddOtherLinkerFlags( flag ); } this.Consolidate(); }
public void ApplyMod( string pbxmod ) { XCMod mod = new XCMod( pbxmod ); foreach(var lib in mod.libs){ Debug.Log("Library: "+lib); } ApplyMod( mod ); }
public void ApplyMod( XCMod mod ) { PBXGroup modGroup = this.GetGroup( mod.group ); Debug.Log( "Adding libraries..." ); PBXGroup librariesGroup = this.GetGroup( "Libraries" ); foreach( XCModFile libRef in mod.libs ) { string completeLibPath = System.IO.Path.Combine( "usr/lib", libRef.filePath ); this.AddFile( completeLibPath, modGroup, "SDKROOT", true, libRef.isWeak ); } Debug.Log( "Adding frameworks..." ); PBXGroup frameworkGroup = this.GetGroup( "Frameworks" ); foreach( string framework in mod.frameworks ) { string[] filename = framework.Split( ':' ); bool isWeak = ( filename.Length > 1 ) ? true : false; string completePath = System.IO.Path.Combine( "System/Library/Frameworks", filename[0] ); this.AddFile( completePath, frameworkGroup, "SDKROOT", true, isWeak ); } Debug.Log( "Adding localizations..." ); PBXVariantGroup localizationGroup = this.GetVariantGroup( "Localizations" ); foreach( string filePath in mod.localizations ) { string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath ); this.AddLocalization( absoluteFilePath, localizationGroup, "GROUP", true, false); } //TODO: Implement the Embed Binary Feature /* Debug.Log( "Adding Embed Binary..." ); PBXGroup embedBinaryGroup = this.GetGroup( "EmbedBinary" ); foreach( XCModFile libRef in mod.embedBinaries ) { string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath ); this.AddEmbedFramework( absoluteFilePath); } */ Debug.Log( "Adding files..." ); foreach( string filePath in mod.files ) { string absoluteFilePath = System.IO.Path.Combine( mod.path, filePath ); if( filePath.EndsWith(".framework") ) this.AddFile( absoluteFilePath, frameworkGroup, "GROUP", true, false); else this.AddFile( absoluteFilePath, modGroup ); } Debug.Log( "Adding folders..." ); foreach( string folderPath in mod.folders ) { string absoluteFolderPath = System.IO.Path.Combine( mod.path, folderPath ); this.AddFolder( absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray( typeof(string) ) ); } Debug.Log( "Adding headerpaths..." ); foreach( string headerpath in mod.headerpaths ) { string absoluteHeaderPath = System.IO.Path.Combine( mod.path, headerpath ); this.AddHeaderSearchPaths( absoluteHeaderPath ); } Debug.Log( "Configure build settings..." ); Hashtable buildSettings = mod.buildSettings; if( buildSettings.ContainsKey("OTHER_LDFLAGS") ) { Debug.Log( " Adding other linker flags..." ); ArrayList otherLinkerFlags = (ArrayList) buildSettings["OTHER_LDFLAGS"]; foreach( string linker in otherLinkerFlags ) { string _linker = linker; if( !_linker.StartsWith("-") ) _linker = "-" + _linker; this.AddOtherLDFlags( _linker ); } } if( buildSettings.ContainsKey("ENABLE_BITCODE") ) { Debug.Log( " ENABLE_BITCODE = " + buildSettings["ENABLE_BITCODE"] ); this.EnableBitCode( (string) buildSettings["ENABLE_BITCODE"] ); } if( buildSettings.ContainsKey("GCC_ENABLE_CPP_EXCEPTIONS") ) { Debug.Log( " GCC_ENABLE_CPP_EXCEPTIONS = " + buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"] ); this.GccEnableCppExceptions( (string) buildSettings["GCC_ENABLE_CPP_EXCEPTIONS"] ); } if( buildSettings.ContainsKey("GCC_ENABLE_OBJC_EXCEPTIONS") ) { Debug.Log( " GCC_ENABLE_OBJC_EXCEPTIONS = " + buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"] ); this.GccEnableObjCExceptions( (string) buildSettings["GCC_ENABLE_OBJC_EXCEPTIONS"] ); } this.Consolidate(); }
public void ApplyMod( string pbxmod ) { XCMod mod = new XCMod( pbxmod ); ApplyMod( mod ); }