Skip to content

Commit

Permalink
Cleaning up Android post build processor. (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansligh-nimbus authored Dec 3, 2024
1 parent b89f76c commit 1ab71c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
21 changes: 4 additions & 17 deletions com.adsbynimbus.nimbus/Editor/AndroidBuildDependencies.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
using System.Text;

namespace Nimbus.Editor {
public static class AndroidBuildDependencies {
private const string SdkVersion = "2.23.0";

public static string APSBuildDependencies() {
var builder = new StringBuilder();

builder.AppendLine("");
builder.AppendLine("dependencies {");
builder.AppendLine($@"implementation ""com.adsbynimbus.android:extension-aps:{SdkVersion}""");
builder.AppendLine("}");
return builder.ToString();
return $@"implementation ""com.adsbynimbus.android:extension-aps:{SdkVersion}""";
}

public static string VungleBuildDependencies() {
var builder = new StringBuilder();

builder.AppendLine("");
builder.AppendLine("dependencies {");
builder.AppendLine($@"implementation ""com.adsbynimbus.android:extension-vungle:{SdkVersion}""");
builder.AppendLine("}");
return builder.ToString();
public static string VungleBuildDependencies()
{
return $@"implementation ""com.adsbynimbus.android:extension-vungle:{SdkVersion}""";
}
}
}
25 changes: 13 additions & 12 deletions com.adsbynimbus.nimbus/Editor/AndroidPostBuildProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if UNITY_EDITOR && UNITY_ANDROID
using System.IO;
using System.Text;
using UnityEditor.Android;

namespace Nimbus.Editor {
Expand Down Expand Up @@ -42,22 +43,22 @@ public void OnPostGenerateGradleAndroidProject(string path) {
packagingWriter.Flush();
packagingWriter.Close();

#if NIMBUS_ENABLE_APS
var apsDependencies = AndroidBuildDependencies.APSBuildDependencies();
#if NIMBUS_ENABLE_APS || NIMBUS_ENABLE_VUNGLE
var builder = new StringBuilder();
builder.AppendLine("");
builder.AppendLine("dependencies {");
#if NIMBUS_ENABLE_APS
builder.AppendLine(AndroidBuildDependencies.APSBuildDependencies());
#endif
#if NIMBUS_ENABLE_VUNGLE
builder.AppendLine(AndroidBuildDependencies.VungleBuildDependencies());
#endif
builder.AppendLine("}");
var apsBuildWriter = File.AppendText(path + "/build.gradle");
apsBuildWriter.WriteLine(apsDependencies);
apsBuildWriter.WriteLine(builder.ToString());
apsBuildWriter.Flush();
apsBuildWriter.Close();
#endif

#if NIMBUS_ENABLE_VUNGLE
var vungleDependencies = AndroidBuildDependencies.VungleBuildDependencies();
var vunlgeBuildWriter = File.AppendText(path + "/build.gradle");
vunlgeBuildWriter.WriteLine(vungleDependencies);
vunlgeBuildWriter.Flush();
vunlgeBuildWriter.Close();
#endif

}
}
}
Expand Down

0 comments on commit 1ab71c2

Please sign in to comment.