Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HZUNITY-72] Rebrand #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@
using System.IO;
using System.Diagnostics;

public class HeyzapPostBuild : MonoBehaviour
{
public class FairBidPostBuild : MonoBehaviour {
[PostProcessBuild(101)]
private static void onPostProcessBuildPlayer( BuildTarget target, string pathToBuiltProject )
{
private static void OnPostProcessBuildPlayer(BuildTarget target, string pathToBuiltProject) {
if (target == BuildTarget.iOS) {
UnityEngine.Debug.Log ("Heyzap: started post-build script");
UnityEngine.Debug.Log ("FairBid: started post-build script");

// grab the path to the postProcessor.py file
var scriptPath = Path.Combine( Application.dataPath, "Editor/Heyzap/HeyzapPostprocessBuildPlayer.py" );
var scriptPath = Path.Combine(Application.dataPath, "Editor/FairBid/PostprocessBuildPlayer.py");

// sanity check
if( !File.Exists( scriptPath ) ) {
UnityEngine.Debug.LogError( "HZ post builder couldn't find python file. Did you accidentally delete it?" );
if (!File.Exists(scriptPath)) {
UnityEngine.Debug.LogError("FairBid post builder couldn't find python file. Did you accidentally delete it?");
return;
} else {
var args = string.Format( "\"{0}\" \"{1}\"", scriptPath, pathToBuiltProject );
var args = string.Format( "\"{0}\" \"{1}\"", scriptPath, pathToBuiltProject);
var proc = new Process
{
StartInfo = new ProcessStartInfo
Expand All @@ -37,14 +35,14 @@ private static void onPostProcessBuildPlayer( BuildTarget target, string pathToB
}
};

UnityEngine.Debug.Log(string.Format("Heyzap: starting HeyzapPostprocessBuildPlayer with args: {0}", args));
UnityEngine.Debug.Log(string.Format("FairBid: starting HeyzapPostprocessBuildPlayer with args: {0}", args));
proc.Start();
proc.WaitForExit();
if (proc.ExitCode > 0) {
UnityEngine.Debug.LogError("Heyzap post-build script had an error(code=" + proc.ExitCode + "). See the editor log for more info & email a copy of it to [email protected] for more help.");
UnityEngine.Debug.LogError("FairBid post-build script had an error(code=" + proc.ExitCode + "). See the editor log for more info & email a copy of it to [email protected] for more help.");
}

UnityEngine.Debug.Log( "Heyzap: Finished post-build script." );
UnityEngine.Debug.Log("FairBid: Finished post-build script.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
import subprocess

from distutils import dir_util
from HZmod_pbxproj import XcodeProject
from FYBmod_pbxproj import XcodeProject

def edit_pbxproj_file():
try:
print "Heyzap: HeyzapPostProcessBuildPlayer started."
print "FairBid: PostProcessBuildPlayer started."
unityProjectTopDirectory = sys.argv[1]
for xcodeproj in os.listdir(unityProjectTopDirectory):
if not re.search('\.xcodeproj', xcodeproj):
continue

xcodeVersionString = subprocess.check_output("xcodebuild -version", shell=True)
print "Heyzap: using xcode version: ", xcodeVersionString
print "FairBid: using xcode version: ", xcodeVersionString

xcodeproj = os.path.join(unityProjectTopDirectory, xcodeproj)
print "Heyzap: found xcode proj: ", xcodeproj
print "FairBid: found xcode proj: ", xcodeproj
for pbxproj in os.listdir(xcodeproj):
if not re.search('project\.pbxproj', pbxproj):
continue
pbxproj = os.path.join(xcodeproj, pbxproj)
print "Heyzap: found pbxproj: ", pbxproj
print "FairBid: found pbxproj: ", pbxproj

# locate the id of the "Frameworks" group of the pbxproj file so that frameworks will go to that group
frameworksGroupID = None
Expand All @@ -34,14 +34,14 @@ def edit_pbxproj_file():
matches = re.findall("([0-9A-F]*) /\* Frameworks \*/ = \{\n\s*isa = PBXGroup;", filetext)
try:
frameworksGroupID = matches[0]
print "Heyzap: found frameworks group: ", frameworksGroupID
print "FairBid: found frameworks group: ", frameworksGroupID
except:
print "Heyzap: did not find frameworks group."
print "FairBid: did not find frameworks group."
pass

print "Heyzap: loading xcode project."
print "FairBid: loading xcode project."
project = XcodeProject.Load(pbxproj)
print "Heyzap: done loading xcode project. Adding libs."
print "FairBid: done loading xcode project. Adding libs."

# the below paths are relative to the SDKROOT, i.e.: `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/`
# Add the Frameworks needed
Expand All @@ -55,7 +55,7 @@ def edit_pbxproj_file():
project.add_file_if_doesnt_exist('System/Library/Frameworks/WebKit.framework', parent=frameworksGroupID, tree='SDKROOT')
project.add_file_if_doesnt_exist('usr/lib/libz.dylib', parent=frameworksGroupID, tree='SDKROOT')

print "Heyzap: done adding libs, adding flags."
print "FairBid: done adding libs, adding flags."
# Add -ObjC for the benefit of AppLovin/FAN
project.add_other_ldflags("-ObjC")

Expand All @@ -64,11 +64,11 @@ def edit_pbxproj_file():
project.add_other_buildsetting("CLANG_ENABLE_MODULES", "YES")

project.save()
print "Heyzap: successfully modified file: ", pbxproj
print "FairBid: successfully modified file: ", pbxproj
return 0
raise FileExistsError("Could not find the 'project.pbxproj' file to edit")
except Exception as e:
print "Heyzap: ERROR modifying 'project.pbxproj', error: ", e
print "FairBid: ERROR modifying 'project.pbxproj', error: ", e
return 1

sys.exit(edit_pbxproj_file())
Binary file modified Assets/Fyber/Editor/Resources/FyberEditorSettings.asset
Binary file not shown.
Loading