Skip to content

Commit

Permalink
Merge pull request #86 from vineetchoudhary/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
vineetchoudhary authored Dec 8, 2017
2 parents 7eed5df + 0e0aacf commit 0f4ff73
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 23 deletions.
65 changes: 50 additions & 15 deletions AppBox/Commands/ProjectBuildScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,66 @@
# Copyright © 2016 Developer Insider. All rights reserved.

#{1} - Project Directory
cd "${1}"

if [[ "${2}" == *"xcodeproj" ]]
then

#Make Archove
#{2} - -workspace VisualStudioMobileCenterDemo.xcworkspace or -project -vsmcd.xcodeproj
#{3} - VisualStudioMobileCenterDemo
#{4} - /Users/emp195/Desktop/VisualStudioMobileCenterDemoGitHub/VisualStudioMobileCenterDemo/build/VSMCD.xcarchive

echo "Building Project..."
xcodebuild clean -project "${2}" -scheme "${3}" archive -archivePath "${4}"

else

echo "Building Workspace..."
xcodebuild clean -workspace "${2}" -scheme "${3}" archive -archivePath "${4}"

fi


#Make IPA
#{5} - "/Users/emp195/Desktop/VisualStudioMobileCenterDemoGitHub/VisualStudioMobileCenterDemo/build/VSMCD.xcarchive"
#{6} - /Users/emp195/Desktop/VisualStudioMobileCenterDemoGitHub/VisualStudioMobileCenterDemo/build/
#{7} - /Users/emp195/Desktop/VisualStudioMobileCenterDemoGitHub/VisualStudioMobileCenterDemo/exportoption.plist


#change directory to project
cd "${1}"

################################################
# Make Archive #
################################################

#check either project is Xcode Project or Xcode Workspace
if [[ "${2}" == *"xcodeproj" ]]
then
echo "Building Project..."

#check either selected xcode is 9 or higher
if [[ "${7}" > "9" || "${7}" == "9" ]]
then
echo "Building Project with Xcode 9"
xcodebuild clean -project "${2}" -scheme "${3}" archive -archivePath "${4}" -allowProvisioningUpdates -allowProvisioningDeviceRegistration
else
echo "Building Project with Xcode 8"
xcodebuild clean -project "${2}" -scheme "${3}" archive -archivePath "${4}"
fi

else
echo "Building Workspace..."

#check either selected xcode is 9 or higher
if [[ "${7}" > "9" || "${7}" == "9" ]]
then
echo "Building Project with Xcode 9"
xcodebuild clean -workspace "${2}" -scheme "${3}" archive -archivePath "${4}"
else
echo "Building Project with Xcode 8"
xcodebuild clean -workspace "${2}" -scheme "${3}" archive -archivePath "${4}"
fi

fi

####################################
# Make IPA #
####################################
echo "Creating IPA..."
xcodebuild -exportArchive -archivePath "${4}" -exportPath "${5}" -exportOptionsPlist "${6}"
#check either selected xcode is 9 or higher
if [[ "${7}" > "9" || "${7}" == "9" ]]
then
echo "Creatomg IPA with Xcode 9"
xcodebuild -exportArchive -archivePath "${4}" -exportPath "${5}" -exportOptionsPlist "${6}" -allowProvisioningUpdates -allowProvisioningDeviceRegistration
else
echo "Creatomg IPA with Xcode 8"
xcodebuild -exportArchive -archivePath "${4}" -exportPath "${5}" -exportOptionsPlist "${6}"
fi
1 change: 1 addition & 0 deletions AppBox/Common/UploadManager/UploadManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ +(void)setupDBClientsManager{
#pragma mark - UnZip IPA File

-(void)uploadIPAFile:(NSURL *)ipaFileURL{
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"\n\n======\n Preparing to Upload IPA - %@\n======\n\n",ipaFileURL]];
NSString *ipaPath = [ipaFileURL.resourceSpecifier stringByRemovingPercentEncoding];
if ([[NSFileManager defaultManager] fileExistsAtPath:ipaPath]) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"\n\n======\nUploading IPA - %@\n======\n\n",ipaPath]];
Expand Down
2 changes: 1 addition & 1 deletion AppBox/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>2.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
1 change: 1 addition & 0 deletions AppBox/Model/ProjectModel/XCProject.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ - (BOOL)createExportOptionPlist{
[exportOption setValue:[NSNumber numberWithBool:[UserData uploadBitcode]] forKey:@"uploadBitcode"];
[exportOption setValue:[NSNumber numberWithBool:[UserData uploadSymbols]] forKey:@"uploadSymbols"];
[exportOption setValue:[NSNumber numberWithBool:[UserData compileBitcode]] forKey:@"compileBitcode"];
[exportOption setValue:@"automatic" forKey:@"signingStyle"];
return [exportOption writeToFile:[self.exportOptionsPlistPath.resourceSpecifier stringByRemovingPercentEncoding] atomically:YES];
}

Expand Down
30 changes: 23 additions & 7 deletions AppBox/ViewController/HomeViewController/HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ - (void)viewDidLoad {
[UserData setXCodeLocation:xcodePath];
[UserData setApplicationLoaderLocation:applicationLoaderPath];
}];

//Get Xcode Version
[XCHandler getXcodeVersionWithCompletion:^(BOOL success, XcodeVersion version, NSString *versionString) {

}];
}

- (void)viewWillAppear{
Expand Down Expand Up @@ -317,8 +312,25 @@ - (void)runBuildScript{
//${6} export options plist Location
[buildArgument addObject:[project.exportOptionsPlistPath.resourceSpecifier stringByRemovingPercentEncoding]];

//Run Task
[self runTaskWithLaunchPath:buildScriptPath andArgument:buildArgument];

//Get Xcode Version
[XCHandler getXcodeVersionWithCompletion:^(BOOL success, XcodeVersion version, NSString *versionString) {
//${7} xcode version
dispatch_async(dispatch_get_main_queue(), ^{
NSString *version;
if (success) {
version = [NSString stringWithFormat:@"%@",[NSNumber numberWithInteger:[versionString integerValue]]];
} else {
version = @"8";
}
[buildArgument addObject:version];

//Run Task
[self runTaskWithLaunchPath:buildScriptPath andArgument:buildArgument];
});

}];

}

- (void)runXcodePathScript{
Expand Down Expand Up @@ -402,6 +414,7 @@ - (void)captureStandardOutputWithTask:(NSTask *)task{
[comboTeamId addItemWithObjectValue:project.teamId];
[comboTeamId selectItemWithObjectValue:project.teamId];
[comboBuildType selectItemWithObjectValue:project.buildType];
[comboBuildScheme selectItemWithObjectValue:project.selectedSchemes];
[textFieldEmail setStringValue:project.emails];
[textFieldMessage setStringValue:project.personalMessage];
if (project.emails.length > 0){
Expand Down Expand Up @@ -570,7 +583,9 @@ -(void)appStoreScriptOutputHandlerWithOutput:(NSString *)output{
#pragma mark - Get IPA Info and Upload -

-(void)checkIPACreated{
[self showStatus:@"Checking IPA File..." andShowProgressBar:YES withProgress:-1];
NSString *ipaPath = [project.ipaFullPath.resourceSpecifier stringByRemovingPercentEncoding];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Finding IPA file at path - %@", ipaPath]];
if ([[NSFileManager defaultManager] fileExistsAtPath:ipaPath]){
if ([comboBuildType.stringValue isEqualToString: BuildTypeAppStore]){
//get required info and upload to appstore
Expand All @@ -580,6 +595,7 @@ -(void)checkIPACreated{
[uploadManager uploadIPAFile:project.ipaFullPath];
}
}else{
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Not able to find IPA file at path - %@", ipaPath]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self checkIPACreated];
});
Expand Down

0 comments on commit 0f4ff73

Please sign in to comment.