/// <summary> /// 编译模式 /// </summary> /// <param name="mode"></param> static void RoslynBuild(ScriptBuildTools.BuildMode mode) { //1.build dll var outpath_win = Application.streamingAssetsPath + "/" + BDUtils.GetPlatformPath(Application.platform); ScriptBuildTools.BuildDll(Application.dataPath, outpath_win, mode); //2.同步到其他两个目录 var outpath_android = Application.streamingAssetsPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.Android) + "/hotfix/hotfix.dll"; var outpath_ios = Application.streamingAssetsPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.IPhonePlayer) + "/hotfix/hotfix.dll"; var source = outpath_win + "/hotfix/hotfix.dll"; var bytes = File.ReadAllBytes(source); if (source != outpath_android) { FileHelper.WriteAllBytes(outpath_android, bytes); } if (source != outpath_ios) { FileHelper.WriteAllBytes(outpath_ios, bytes); } //3.生成CLRBinding GenCLRBindingByAnalysis(); AssetDatabase.Refresh(); Debug.Log("脚本打包完毕"); }
/// <summary> /// 编译模式 /// </summary> /// <param name="mode"></param> static public void RoslynBuild(ScriptBuildTools.BuildMode mode, string outpath = null) { var targetPath = "Assets/Code/Game/ILRuntime/Binding/Analysis"; //分析之前先删除,然后生成临时文件防止报错 if (Directory.Exists(targetPath)) { Directory.Delete(targetPath, true); } var fileContent = @" namespace ILRuntime.Runtime.Generated { class CLRBindings { public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) { } } } "; FileHelper.WriteAllText(targetPath + "/CLRBindings.cs", fileContent); AssetDatabase.Refresh(); //这里必须要刷新 //没指定,走默认模式 if (string.IsNullOrEmpty(outpath)) { //1.build dll var outpath_win = Application.streamingAssetsPath + "/" + BApplication.GetPlatformPath(Application.platform); ScriptBuildTools.BuildDll(outpath_win, mode); //2.同步到其他两个目录 var outpath_android = Application.streamingAssetsPath + "/" + BApplication.GetPlatformPath(RuntimePlatform.Android) + DLLPATH; var outpath_ios = Application.streamingAssetsPath + "/" + BApplication.GetPlatformPath(RuntimePlatform.IPhonePlayer) + DLLPATH; var source = outpath_win + DLLPATH; var bytes = File.ReadAllBytes(source); if (source != outpath_android) { FileHelper.WriteAllBytes(outpath_android, bytes); } if (source != outpath_ios) { FileHelper.WriteAllBytes(outpath_ios, bytes); } } else { //指定了直接 build ScriptBuildTools.BuildDll(outpath, mode); } //3.预绑定 GenPreCLRBinding(); //4.生成AnalysisCLRBinding GenCLRBindingByAnalysis(); AssetDatabase.Refresh(); Debug.Log("脚本打包完毕"); }
/// <summary> /// 编译模式 /// </summary> /// <param name="mode"></param> static public void RoslynBuild(ScriptBuildTools.BuildMode mode, string outpath = null) { var targetPath = "Assets/Code/Game/ILRuntime/Binding/Analysis"; //1.分析之前先删除,然后生成临时文件防止报错 if (Directory.Exists(targetPath)) { Directory.Delete(targetPath, true); } var fileContent = @" namespace ILRuntime.Runtime.Generated { class CLRBindings { public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) { } } } "; FileHelper.WriteAllText(targetPath + "/CLRBindings.cs", fileContent); AssetDatabase.Refresh(); //这里必须要刷新 //2.生成DLL if (string.IsNullOrEmpty(outpath)) { //1.build dll var outpath_win = Application.streamingAssetsPath + "/" + BApplication.GetPlatformPath(Application.platform); ScriptBuildTools.BuildDll(outpath_win, mode); } else { //指定了直接 build ScriptBuildTools.BuildDll(outpath, mode); } //3.预绑定 //GenPreCLRBinding(); //4.生成自动分析绑定 GenCLRBindingByAnalysis(); AssetDatabase.Refresh(); Debug.Log("脚本打包完毕"); }
/// <summary> /// 编译模式 /// </summary> /// <param name="outpath"></param> /// <param name="platform"></param> /// <param name="mode"></param> static public void RoslynBuild(string outpath, RuntimePlatform platform, ScriptBuildTools.BuildMode mode, bool isShowTips = true) { //触发bd环境周期 BDFrameworkPipelineHelper.OnBeginBuildHotfixDLL(); var targetPath = "Assets/Code/BDFramework.Game/ILRuntime/Binding/Analysis"; //1.分析之前先删除,然后生成临时文件防止报错 // if (Directory.Exists(targetPath)) // { // Directory.Delete(targetPath, true); // } var fileContent = @" namespace ILRuntime.Runtime.Generated { class CLRBindings { internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder<UnityEngine.Vector2> s_UnityEngine_Vector2_Binding_Binder = null; internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder<UnityEngine.Vector3> s_UnityEngine_Vector3_Binding_Binder = null; internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder<UnityEngine.Vector4> s_UnityEngine_Vector4_Binding_Binder = null; internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder<UnityEngine.Quaternion> s_UnityEngine_Quaternion_Binding_Binder = null; public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) { } } } "; FileHelper.WriteAllText(targetPath + "/CLRBindings.cs", fileContent); AssetDatabase.Refresh(); //这里必须要刷新 //2.生成DLL ScriptBuildTools.BuildDll(outpath, platform, mode, isShowTips); //3.预绑定 //GenPreCLRBinding(); //4.生成自动分析绑定 GenCLRBindingByAnalysis(platform, outpath); //5.拷贝 CopyDLLToOther(outpath, platform); AssetDatabase.Refresh(); //触发bd环境周期 BDFrameworkPipelineHelper.OnEndBuildDLL(outpath); }
/// <summary> /// 构建包体 /// </summary> static private void BuildPackage(RuntimePlatform platform, EditorBuildPackage.BuildMode buildMode) { //1.下载资源已有、Sql var ret = DownloadFormFileServer(platform); //2.打包dll ScriptBuildTools.BuildMode mode = buildMode == EditorBuildPackage.BuildMode.Debug ? ScriptBuildTools.BuildMode.Debug : ScriptBuildTools.BuildMode.Release; EditorWindow_ScriptBuildDll.RoslynBuild(outputPath, platform, mode); //3.构建空包即可 if (!ret) { //构建资源 if (platform == RuntimePlatform.Android) { BuildAssetBundle(RuntimePlatform.Android, BuildTarget.Android); } else if (platform == RuntimePlatform.IPhonePlayer) { BuildAssetBundle(RuntimePlatform.IPhonePlayer, BuildTarget.iOS); } } //加载配置 EditorBuildPackage.LoadConfig(buildMode); // if (platform == RuntimePlatform.Android) { EditorBuildPackage.BuildAPK(buildMode); //上传APK UploadAPK(); } else if (platform == RuntimePlatform.IPhonePlayer) { //测试构建 // BuildTest.BuildIPA(); //EditorBuildPackage.BuildIpa(); } //最后上传 UploadFormFileServer(platform); }
/// <summary> /// 编译模式 /// </summary> /// <param name="outpath"></param> /// <param name="platform"></param> /// <param name="mode"></param> static public void RoslynBuild(string outpath, RuntimePlatform platform, ScriptBuildTools.BuildMode mode) { //触发bd环境周期 BDFrameEditorBehaviorHelper.OnBeginBuildDLL(); var targetPath = "Assets/Code/Game/ILRuntime/Binding/Analysis"; //1.分析之前先删除,然后生成临时文件防止报错 if (Directory.Exists(targetPath)) { Directory.Delete(targetPath, true); } var fileContent = @" namespace ILRuntime.Runtime.Generated { class CLRBindings { public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) { } } } "; FileHelper.WriteAllText(targetPath + "/CLRBindings.cs", fileContent); AssetDatabase.Refresh(); //这里必须要刷新 //2.生成DLL ScriptBuildTools.BuildDll(outpath, platform, mode); //3.预绑定 //GenPreCLRBinding(); //4.生成自动分析绑定 GenCLRBindingByAnalysis(platform, outpath); AssetDatabase.Refresh(); //触发bd环境周期 BDFrameEditorBehaviorHelper.OnEndBuildDLL(outpath); AssetHelper.GenPackageBuildInfo(outpath, platform); Debug.Log("脚本打包完毕"); }