Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wrmswindmill committed Jul 18, 2019
1 parent 2a2e998 commit 1c99e59
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 20 deletions.
42 changes: 25 additions & 17 deletions .travis.yml
Expand Up @@ -82,6 +82,10 @@ install:
;;
esac
if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
npm install
fi
script:
- |
case $TEST_SUITE in
Expand Down Expand Up @@ -119,28 +123,32 @@ script:
hasIosFile=$(npm run danger -- run --dangerfile ./dangerfile-ios.js)
echo "The value of hasIosFile is ${hasIosFile}"
if [[ "$hasIosFile" =~ "hasIosFile" ]]; then
xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6"
xcodebuild -workspace WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6"
fi
;;
esac
if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
oclint-json-compilation-database oclint_args -- \
-disable-rule=ShortVariableName \
-disable-rule=LongLine \
-disable-rule=LongMethod \
-disable-rule=HighNcssMethod \
-disable-rule=LongVariableName \
-disable-rule=HighCyclomaticComplexity \
-disable-rule=HighNPathComplexity \
-disable-rule=UnusedLocalVariable \
-disable-rule=DoubleNegative \
-disable-rule=MultipleUnaryOperator \
-disable-rule=DeepNestedBlock \
-max-priority-1=15000 \
-max-priority-2=15000 \
-max-priority-3=15000
hasCFile=$(npm run danger -- run --dangerfile ./dangerfile-static-check.js)
echo "The value of hasIosFile is ${hasIosFile}"
if [[ "$hasCFile" =~ "hasCFile" ]]; then
cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
oclint-json-compilation-database oclint_args -- \
-disable-rule=ShortVariableName \
-disable-rule=LongLine \
-disable-rule=LongMethod \
-disable-rule=HighNcssMethod \
-disable-rule=LongVariableName \
-disable-rule=HighCyclomaticComplexity \
-disable-rule=HighNPathComplexity \
-disable-rule=UnusedLocalVariable \
-disable-rule=DoubleNegative \
-disable-rule=MultipleUnaryOperator \
-disable-rule=DeepNestedBlock \
-max-priority-1=15000 \
-max-priority-2=15000 \
-max-priority-3=15000
fi
fi
notifications:
webhooks:
Expand Down
95 changes: 95 additions & 0 deletions dangerfile-static-check.js
@@ -0,0 +1,95 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { schedule, danger, fail, warn, message, markdown } from "danger";
import fs from "fs";
import path from 'path';
import GitHubApi from 'github';
import parseDiff from 'parse-diff';
import shell from "shelljs";

const type_unknown = 0;
const type_c = 1;
const type_android = 2;
const type_js = 3;

const getFileType = file => {
if (file.match(/\.(m|h|mm|cpp|cc)/)) {
return type_c;
} else if (file.match(/\.java/)) {
return type_android;
} else if (file.match(/\.js/)) {
return type_js;
}else{
return type_unknown;
}
}

var hasCFile = false;
var hasAndroidFile = false;
var hasJsFile = false;

function check(file_type){
has_file_type = false;
if (!has_file_type && danger.git.created_files) {
danger.git.created_files.some(file => {
var f = checkFileType(file)
if(getFileType(file)==file_type){
has_file_type =f;
}
return f;
});
}

if (!has_file_type && danger.git.modified_files) {
danger.git.created_files.some(file => {
var f = checkFileType(file)
if(getFileType(file)==file_type){
has_file_type =f;
}
return f;
});
}

if (!has_file_type && danger.git.deleted_files) {
danger.git.created_files.some(file => {
var f = checkFileType(file)
if(getFileType(file)==file_type){
has_file_type =f;
}
return f;
});
}

return has_file_type
}

hasCFile = check(type_c)
hasAndroidFile = check(type_android)
hasJsFile = check(type_js)

if(hasCFile){
console.log('hasIosFile');
}
if(hasAndroidFile){
console.log('hasAndroidFile');
}
if(hasJsFile){
console.log('hasJsFile');
}

4 changes: 2 additions & 2 deletions ios/sdk/WeexSDK/Sources/Utility/WXVersion.m
Expand Up @@ -20,8 +20,8 @@
#import "WXVersion.h"
#import "WXDefine.h"

static const char* WeexSDKBuildTime = "2019-07-16 07:08:34 UTC";
static const unsigned long WeexSDKBuildTimestamp = 1563260914;
static const char* WeexSDKBuildTime = "2019-07-18 12:09:09 UTC";
static const unsigned long WeexSDKBuildTimestamp = 1563451749;

NSString* GetWeexSDKVersion(void)
{
Expand Down
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/compile_commands.json
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions ios/sdk/compile_commands.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion weex-playground

0 comments on commit 1c99e59

Please sign in to comment.