Skip to content

Commit

Permalink
Compile to temp folders first
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Sep 30, 2023
1 parent 94956ec commit 55299de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Hackintool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0402;
CURRENT_PROJECT_VERSION = 0403;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -742,7 +742,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 4.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -764,7 +764,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0402;
CURRENT_PROJECT_VERSION = 0403;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -779,7 +779,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 4.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Binary file not shown.
19 changes: 15 additions & 4 deletions Hackintool/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,9 @@ - (void)compileSelectedKexts
NSString *projectUrl = [kextDictionary objectForKey:@"ProjectUrl"];
NSString *projectFileUrl = [kextDictionary objectForKey:@"ProjectFileUrl"];
NSString *outputPath = [buildPath stringByAppendingPathComponent:name];
NSString *tempDebugPath = [tempPath stringByAppendingPathComponent:@"Debug"];
NSString *tempReleasePath = [tempPath stringByAppendingPathComponent:@"Release"];

NSString *projectFileName = (projectFileUrl != nil ? [[projectFileUrl lastPathComponent] stringByRemovingPercentEncoding] : [name stringByAppendingString:@".xcodeproj"]);
NSString *updateGitSubmodules = @"cd $(OUTPUT_PATH) && $(SUBMODULE_UPDATE)";
bool isLilu = [name isEqualToString:@"Lilu"];
Expand All @@ -3020,8 +3023,11 @@ - (void)compileSelectedKexts
updateGitSubmodules = [updateGitSubmodules stringByReplacingOccurrencesOfString:@"$(OUTPUT_PATH)" withString:outputPath];
updateGitSubmodules = [updateGitSubmodules stringByReplacingOccurrencesOfString:@"$(SUBMODULE_UPDATE)" withString:GitSubmoduleUpdate];
launchCommand(@"/bin/bash", @[@"-c", updateGitSubmodules], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/usr/bin/xcodebuild", @[@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Debug", @"clean", @"build", @"ARCHS=x86_64", @"WARNING_CFLAGS=-w", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", debugPath]], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/usr/bin/xcodebuild", @[@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Release", @"clean", @"build", @"ARCHS=x86_64", @"WARNING_CFLAGS=-w", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", releasePath]], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/usr/bin/xcodebuild", @[@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Debug", @"clean", @"build", @"ARCHS=x86_64", @"WARNING_CFLAGS=-w", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", tempDebugPath]], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/usr/bin/xcodebuild", @[@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Release", @"clean", @"build", @"ARCHS=x86_64", @"WARNING_CFLAGS=-w", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", tempReleasePath]], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));

launchCommand(@"/bin/cp", @[@"-r", [tempDebugPath stringByAppendingPathComponent:@"."], debugPath], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/bin/cp", @[@"-r", [tempReleasePath stringByAppendingPathComponent:@"."], releasePath], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));

double progressPercent = (double)++compileIndex / (double)compileCount;

Expand All @@ -3043,6 +3049,8 @@ - (void)compileSelectedKexts
NSString *projectFileUrl = [kextDictionary objectForKey:@"ProjectFileUrl"];
NSString *superseder = [kextDictionary objectForKey:@"Superseder"];
NSString *outputPath = [buildPath stringByAppendingPathComponent:name];
NSString *tempDebugPath = [tempPath stringByAppendingPathComponent:@"Debug"];
NSString *tempReleasePath = [tempPath stringByAppendingPathComponent:@"Release"];
NSString *outputLiluKextPath = [outputPath stringByAppendingPathComponent:@"Lilu.kext"];
NSString *liluKextPath = [debugPath stringByAppendingPathComponent:@"Lilu.kext"];
NSString *projectFileName = (projectFileUrl != nil ? [[projectFileUrl lastPathComponent] stringByRemovingPercentEncoding] : [name stringByAppendingString:@".xcodeproj"]);
Expand Down Expand Up @@ -3092,8 +3100,8 @@ - (void)compileSelectedKexts
launchCommand(@"/bin/bash", @[@"-c", preBuildBash], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
}

NSMutableArray *debugArguments = [NSMutableArray arrayWithObjects:@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Debug", @"clean", @"build", @"ARCHS=x86_64", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", debugPath], nil];
NSMutableArray *releaseArguments = [NSMutableArray arrayWithObjects:@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Release", @"clean", @"build", @"ARCHS=x86_64", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", releasePath], nil];
NSMutableArray *debugArguments = [NSMutableArray arrayWithObjects:@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Debug", @"clean", @"build", @"ARCHS=x86_64", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", tempDebugPath], nil];
NSMutableArray *releaseArguments = [NSMutableArray arrayWithObjects:@"-project", [outputPath stringByAppendingPathComponent:projectFileName], @"-configuration", @"Release", @"clean", @"build", @"ARCHS=x86_64", [NSString stringWithFormat:@"CONFIGURATION_BUILD_DIR=%@", tempReleasePath], nil];

if (scheme != nil)
{
Expand All @@ -3104,6 +3112,9 @@ - (void)compileSelectedKexts
launchCommand(@"/usr/bin/xcodebuild", debugArguments, self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/usr/bin/xcodebuild", releaseArguments, self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));

launchCommand(@"/bin/cp", @[@"-r", [tempDebugPath stringByAppendingPathComponent:@"."], debugPath], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));
launchCommand(@"/bin/cp", @[@"-r", [tempReleasePath stringByAppendingPathComponent:@"."], releasePath], self, @selector(compileOutputNotification:), @selector(compileErrorNotification:), @selector(compileCompleteNotification:));

double progressPercent = (double)++compileIndex / (double)compileCount;

dispatch_async(dispatch_get_main_queue(), ^{
Expand Down

0 comments on commit 55299de

Please sign in to comment.