Skip to content

Commit

Permalink
feat: Unity 项目升级 2022.x 版本;优化 google-services.json 拷贝脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
RoongfLee committed Oct 8, 2024
1 parent f162aed commit 0034d8e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Script/Editor/TDSAndroidPostBuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string
{
return;
}

string googleServiceOriginPath = projectPath + "/unityLibrary/src/main/assets/google-services.json";
var parentFolder = Directory.GetParent(Application.dataPath)?.FullName;
var googleJsonPath = parentFolder + "/Assets/Plugins/Android/google-services.json";

string targetServicePath = projectPath + "/launcher/google-services.json";

if (File.Exists(googleServiceOriginPath))
if (File.Exists(googleJsonPath))
{
//copy google-service.json 到目录下
File.Copy(googleServiceOriginPath, targetServicePath, true);
File.Copy(googleJsonPath, targetServicePath, true);
}

string launcherGradle = projectPath + "/launcher/build.gradle";
Expand Down Expand Up @@ -164,9 +164,7 @@ void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string
Debug.Log("write project gradle");
TDSEditor.TDSScriptStreamWriterHelper writerHelper =
new TDSEditor.TDSScriptStreamWriterHelper(baseProjectGradle);
writerHelper.WriteBelow(@"task clean(type: Delete) {
delete rootProject.buildDir
}", @"allprojects {
writerHelper.WriteBelow(@"classpath 'com.android.tools.build:gradle:", @"allprojects {
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.0.2'
Expand Down

0 comments on commit 0034d8e

Please sign in to comment.