Skip to content

Commit

Permalink
Merge branch 'fork_master' into TIMOB-24308
Browse files Browse the repository at this point in the history
  • Loading branch information
gimdongwoo committed Jan 25, 2017
2 parents 79cb731 + 168f2cb commit 08fd7e5
Show file tree
Hide file tree
Showing 14 changed files with 253 additions and 30 deletions.
190 changes: 190 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#!groovy

node('node-4 && android-emulator && npm && git && android-sdk && android-ndk && ant && gperf && osx') {
currentBuild.result = 'SUCCESS'

// Wrap in timestamper
timestamps {
try {
def gitCommit = ''
stage('Checkout') {
// checkout scm
// Hack for JENKINS-37658 - see https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '', shallow: true, depth: 30, timeout: 30]],
userRemoteConfigs: scm.userRemoteConfigs
])
// FIXME: Workaround for missing env.GIT_COMMIT: http://stackoverflow.com/questions/36304208/jenkins-workflow-checkout-accessing-branch-name-and-git-commit
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
}

def basename = ''
def vtag = ''
def isPR = env.BRANCH_NAME.startsWith('PR-')
timeout(45) {
ansiColor('xterm') {
stage('Build') {
// Skip the Windows SDK portion on PR builds?
if (!isPR) {
// Grab Windows SDK piece
def windowsBranch = env.BRANCH_NAME.replaceAll(/_/, ".")
step ([$class: 'CopyArtifact',
projectName: "titanium_mobile_windows_${windowsBranch}",
filter: 'dist/windows/']);
sh 'rm -rf windows; mv dist/windows/ windows/; rm -rf dist'
}

// Normal build, pull out the version
def version = sh(returnStdout: true, script: 'sed -n \'s/^ *"version": *"//p\' package.json | tr -d \'"\' | tr -d \',\'').trim()
echo "VERSION: ${version}"
// Create a timestamp
def timestamp = sh(returnStdout: true, script: 'date +\'%Y%m%d%H%M%S\'').trim()
echo "TIMESTAMP: ${timestamp}"
vtag = "${version}.v${timestamp}"
echo "VTAG: ${vtag}"
basename = "dist/mobilesdk-${vtag}"
echo "BASENAME: ${basename}"
// TODO parallelize the iOS/Android/Mobileweb/Windows portions!
dir('build') {
sh 'npm install .'
sh 'node scons.js build --android-ndk /opt/android-ndk-r11c --android-sdk /opt/android-sdk'
if (isPR) {
// For PR builds, just package android and iOS for osx
sh "node scons.js package android ios --version-tag ${vtag}"
} else {
// For non-PR builds, do all platforms for all OSes
sh "node scons.js package --version-tag ${vtag} --all"
}
}
// Stash the zip for later, so we can parallelize the tests
//stash includes: "${basename}-*.zip", name: 'zip'
}

// TODO Separate out the node requirements for test vs build.
// Specifically, for build we need:
// node-4 && npm && git && android-sdk && android-ndk && ant && gperf && (osx || linux)
// For test we need:
// node-4 && android-emulator && npm && git && android-sdk && osx
stage('Test') {
// TODO Unstash the SDK zip and run tests in parallel for android/ios on separate nodes!
dir('titanium-mobile-mocha-suite') {
// TODO Do a shallow clone, using same credentials as above
git credentialsId: 'd05dad3c-d7f9-4c65-9cb6-19fef98fc440', url: 'https://github.com/appcelerator/titanium-mobile-mocha-suite.git'
}
sh 'cp -R tests/ titanium-mobile-mocha-suite'
dir('titanium-mobile-mocha-suite/scripts') {
sh 'npm install .'
sh "node test.js -b ../../${basename}-osx.zip -p android,ios"
junit 'junit.*.xml'
}
}
}
}

stage('Deploy') {
// Push to S3 if not PR
if (!isPR) {
def indexJson = []
try {
sh "wget http://builds.appcelerator.com.s3.amazonaws.com/mobile/${env.BRANCH_NAME}/index.json"
indexJson = new groovy.json.JsonSlurperClassic().parseText(readFile('index.json'))
} catch (err) {
// ignore? Not able to grab the index.json, so assume it means it's a new branch
}

// Have to use Java-style loop for now: https://issues.jenkins-ci.org/browse/JENKINS-26481
def oses = ['osx', 'linux', 'win32']
for (int i = 0; i < oses.size(); i++) {
def os = oses[i]
def sha1 = sh(returnStdout: true, script: "shasum ${basename}-${os}.zip").trim().split()[0]
def filesize = Long.valueOf(sh(returnStdout: true, script: "wc -c < ${basename}-${os}.zip").trim())
step([
$class: 'S3BucketPublisher',
consoleLogLevel: 'INFO',
entries: [[
bucket: "builds.appcelerator.com/mobile/${env.BRANCH_NAME}",
gzipFiles: false,
selectedRegion: 'us-east-1',
sourceFile: "${basename}-${os}.zip",
uploadFromSlave: true,
userMetadata: [[key: 'sha1', value: sha1]]
]],
profileName: 'builds.appcelerator.com',
pluginFailureResultConstraint: 'FAILURE',
userMetadata: [
[key: 'build_type', value: 'mobile'],
[key: 'git_branch', value: env.BRANCH_NAME],
[key: 'git_revision', value: gitCommit],
[key: 'build_url', value: env.BUILD_URL]]
])

// Add the entry to index json!
indexJson << [
'filename': "mobilesdk-${vtag}-${os}.zip",
'git_branch': env.BRANCH_NAME,
'git_revision': gitCommit,
'build_url': env.BUILD_URL,
'build_type': 'mobile',
'sha1': sha1,
'size': filesize
]
}

// Update the index.json on S3
echo "updating mobile/${env.BRANCH_NAME}/index.json..."
writeFile file: "index.json", text: new groovy.json.JsonBuilder(indexJson).toPrettyString()
step([
$class: 'S3BucketPublisher',
consoleLogLevel: 'INFO',
entries: [[
bucket: "builds.appcelerator.com/mobile/${env.BRANCH_NAME}",
gzipFiles: false,
selectedRegion: 'us-east-1',
sourceFile: 'index.json',
uploadFromSlave: true,
userMetadata: []
]],
profileName: 'builds.appcelerator.com',
pluginFailureResultConstraint: 'FAILURE',
userMetadata: []])

// Upload the parity report
sh "mv dist/parity.html ${basename}-parity.html"
step([
$class: 'S3BucketPublisher',
consoleLogLevel: 'INFO',
entries: [[
bucket: "builds.appcelerator.com/mobile/${env.BRANCH_NAME}",
gzipFiles: false,
selectedRegion: 'us-east-1',
sourceFile: "${basename}-parity.html",
uploadFromSlave: true,
userMetadata: []
]],
profileName: 'builds.appcelerator.com',
pluginFailureResultConstraint: 'FAILURE',
userMetadata: []])
}
}

stage('Results') {
archive 'dist/*.zip'
}
}
catch (err) {
currentBuild.result = 'FAILURE'

office365ConnectorSend(message: 'Build failed', status: currentBuild.result, webhookUrl: 'https://outlook.office.com/webhook/ba1960f7-fcca-4b2c-a5f3-095ff9c87b22@300f59df-78e6-436f-9b27-b64973e34f7d/JenkinsCI/1e4f6c138db84aeca1b55a0340750b55/72931ee3-e99d-4daf-84d2-1427168af2d9')

mail body: "project build error is here: ${env.BUILD_URL}",
from: 'hudson@appcelerator.com',
replyTo: 'no-reply@appcelerator.com',
subject: 'project build failed',
to: 'eng-platform@appcelerator.com'

throw err
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicLong;

import android.graphics.drawable.ColorDrawable;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.common.Log;
Expand Down Expand Up @@ -334,6 +335,9 @@ public void addTab(TabProxy tabProxy) {
pendingDisableTabs = true;
checkAndDisableTabsIfRequired();
}
ColorDrawable drawable = (tabProxy.getProperty(TiC.PROPERTY_BACKGROUND_COLOR) != null) ? TiConvert.toColorDrawable((String) tabProxy.getProperty(TiC.PROPERTY_BACKGROUND_COLOR)) : TiConvert.toColorDrawable((String) tabProxy.getTabGroup().getProperty(TiC.PROPERTY_TABS_BACKGROUND_COLOR));
actionBar.setStackedBackgroundDrawable(drawable);
actionBar.setBackgroundDrawable(drawable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public void onBackPressed()
KrollFunction onBackCallback = (KrollFunction) topWindow.getProperty(TiC.PROPERTY_ON_BACK);
onBackCallback.callAsync(activityProxy.getKrollObject(), new Object[] {});
}
if (!topWindow.hasProperty(TiC.PROPERTY_ON_BACK) && !topWindow.hasListeners(TiC.EVENT_ANDROID_BACK)) {
if (topWindow == null || (!topWindow.hasProperty(TiC.PROPERTY_ON_BACK) && !topWindow.hasListeners(TiC.EVENT_ANDROID_BACK))) {
// there are no parent activities to return to
// override back press to background the activity
// note: 2 since there should always be TiLaunchActivity and TiActivity
Expand Down
28 changes: 18 additions & 10 deletions iphone/Classes/MediaModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,10 @@ -(void)destroyPicker
#ifdef USE_TI_MEDIAOPENMUSICLIBRARY
RELEASE_TO_NIL(musicPicker);
#endif
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY)
RELEASE_TO_NIL(picker);
#endif
#if defined(USE_TI_MEDIASTARTVIDEOEDITING) || defined(USE_TI_MEDIASTOPVIDEOEDITING)
RELEASE_TO_NIL(editor);
#endif
RELEASE_TO_NIL(pickerSuccessCallback);
Expand All @@ -1381,13 +1383,17 @@ -(void)destroyPicker

-(void)dispatchCallback:(NSArray*)args
{
NSString *type = [args objectAtIndex:0];
id object = [args objectAtIndex:1];
id listener = [args objectAtIndex:2];

TiThreadPerformOnMainThread(^{
[self _fireEventToListener:type withObject:object listener:listener thisObject:nil];
}, YES);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *type = [args objectAtIndex:0];
id object = [args objectAtIndex:1];
id listener = [args objectAtIndex:2];
// we have to give our modal picker view time to
// dismiss with animation or if you do anything in a callback that
// attempt to also touch a modal controller, you'll get into deep doodoo
// wait for the picker to dismiss with animation
[NSThread sleepForTimeInterval:0.5];
[self _fireEventToListener:type withObject:object listener:listener thisObject:nil];
[pool release];
}

-(void)sendPickerError:(int)code
Expand Down Expand Up @@ -1837,7 +1843,7 @@ -(void)saveCompletedForVideo:(NSString*)path error:(NSError*)error contextInfo:(
}
#endif

#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING) || defined(USE_TI_MEDIAOPENMUSICLIBRARY)
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
-(void)handleTrimmedVideo:(NSURL*)theURL withDictionary:(NSDictionary*)dictionary
{
TiBlob* media = [[[TiBlob alloc] _initWithPageContext:[self pageContext] andFile:[theURL path]] autorelease];
Expand All @@ -1850,6 +1856,7 @@ -(void)handleTrimmedVideo:(NSURL*)theURL withDictionary:(NSDictionary*)dictionar

[self sendPickerSuccess:eventDict];
}
#endif

#pragma mark UIPopoverControllerDelegate
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
Expand Down Expand Up @@ -1924,6 +1931,7 @@ - (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationCon

#pragma mark UIImagePickerControllerDelegate

#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY)
- (void)imagePickerController:(UIImagePickerController *)picker_ didFinishPickingMediaWithInfo:(NSDictionary *)editingInfo
{
if (autoHidePicker) {
Expand Down Expand Up @@ -2132,7 +2140,7 @@ - (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker_

#pragma mark UIVideoEditorControllerDelegate

#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
#ifdef USE_TI_MEDIASTARTVIDEOEDITING
- (void)videoEditorController:(UIVideoEditorController *)editor_ didSaveEditedVideoToPath:(NSString *)editedVideoPath
{
id listener = [[editorSuccessCallback retain] autorelease];
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiAppiOSSearchQueryProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifdef USE_TI_APPIOSSEARCHQUERY
#import "TiAppiOSSearchQueryProxy.h"
#import "TiAppiOSSearchableItemProxy.h"
#import "TiAppiOSSearchableItemAttributeSetProxy.h"
#import "TiUtils.h"

@implementation TiAppiOSSearchQueryProxy
Expand Down Expand Up @@ -74,7 +73,6 @@ - (CSSearchQuery*)query
}, NO);
}
}];

}

return query;
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/TiAppiOSSearchableItemAttributeSetProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_APPIOSSEARCHABLEITEMATTRIBUTESET
#if defined(USE_TI_APPIOSSEARCHQUERY) || defined(USE_TI_APPIOSSEARCHABLEITEMATTRIBUTESET)

#import "TiProxy.h"
#import <CoreSpotlight/CoreSpotlight.h>

Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiAppiOSSearchableItemAttributeSetProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_APPIOSSEARCHABLEITEMATTRIBUTESET
#if defined(USE_TI_APPIOSSEARCHQUERY) || defined(USE_TI_APPIOSSEARCHABLEITEMATTRIBUTESET)
#import "TiAppiOSSearchableItemAttributeSetProxy.h"
#import "TiUtils.h"

Expand Down
4 changes: 2 additions & 2 deletions iphone/Classes/TiAppiOSSearchableItemProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_APPIOSSEARCHABLEITEM
#if defined(USE_TI_APPIOSSEARCHQUERY) || defined(USE_TI_APPIOSSEARCHABLEITEM)
#import "TiProxy.h"
#import <CoreSpotlight/CoreSpotlight.h>

Expand All @@ -18,4 +18,4 @@
@property(nonatomic,retain) CSSearchableItem *item;

@end
#endif
#endif
2 changes: 1 addition & 1 deletion iphone/Classes/TiAppiOSSearchableItemProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifdef USE_TI_APPIOSSEARCHABLEITEM
#if defined(USE_TI_APPIOSSEARCHQUERY) || defined(USE_TI_APPIOSSEARCHABLEITEM)
#import "TiAppiOSSearchableItemProxy.h"
#import "TiAppiOSSearchableItemAttributeSetProxy.h"
#import "TiUtils.h"
Expand Down
16 changes: 8 additions & 8 deletions iphone/Classes/TiCalendarEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ -(void) setValue:(id)value forUndefinedKey:(NSString*)key
else if ([key isEqualToString:@"recurrenceRules"]) {
ENSURE_TYPE_OR_NIL(value,NSArray);
NSMutableArray * rules = [NSMutableArray arrayWithCapacity:[value count]];
for (TiCalendarRecurrenceRule *recurranceRule_ in value) {
EKRecurrenceRule * ruleToBeAdded = [recurranceRule_ ruleForRecurrence];
for (TiCalendarRecurrenceRule *recurrenceRule_ in value) {
EKRecurrenceRule * ruleToBeAdded = [recurrenceRule_ ruleForRecurrence];
[rules addObject:ruleToBeAdded];
}
currEvent.recurrenceRules = rules;
Expand Down Expand Up @@ -393,28 +393,28 @@ -(TiCalendarRecurrenceRule*) createRecurrenceRule:(id)arg
setPositions:setPositions
end:end] autorelease];
if (rule == NULL) {
[self throwException:@"Error while trying to create recurrance rule."
[self throwException:@"Error while trying to create recurrence rule."
subreason:nil
location:CODELOCATION];

return NULL;
}
TiCalendarRecurrenceRule* recurranceRule = [[[TiCalendarRecurrenceRule alloc] _initWithPageContext:[self executionContext]
TiCalendarRecurrenceRule* recurrenceRule = [[[TiCalendarRecurrenceRule alloc] _initWithPageContext:[self executionContext]
rule:rule] autorelease];
return recurranceRule;
return recurrenceRule;
} /*endof if (frequency != EKRecurrenceFrequencyDaily)*/
else {
EKRecurrenceRule* rule = [[[EKRecurrenceRule alloc] initRecurrenceWithFrequency:frequency interval:interval end:end] autorelease];
if (rule == NULL) {
[self throwException:@"Error while trying to create recurrance rule."
[self throwException:@"Error while trying to create recurrence rule."
subreason:nil
location:CODELOCATION];

return NULL;
}
TiCalendarRecurrenceRule* recurranceRule = [[[TiCalendarRecurrenceRule alloc] _initWithPageContext:[self executionContext]
TiCalendarRecurrenceRule* recurrenceRule = [[[TiCalendarRecurrenceRule alloc] _initWithPageContext:[self executionContext]
rule:rule] autorelease];
return recurranceRule;
return recurrenceRule;
}
}

Expand Down

0 comments on commit 08fd7e5

Please sign in to comment.