diff --git a/.travis.yml b/.travis.yml index 6f1b214807..5d45b3a3fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,12 +71,12 @@ before_install: bundle install fi - # # install oclint - # if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then - # brew cask uninstall oclint - # brew tap oclint/formulae - # brew install oclint - # fi + # install oclint + if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then + brew cask uninstall oclint + brew tap oclint/formulae + brew install oclint + fi @@ -101,112 +101,106 @@ install: export ANDROID_NDK_HOME=$HOME/android-ndk-r18b export PATH=$PATH:$ANDROID_NDK_HOME echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties - # elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${OCLINT}" = "true") ]]; then - # curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash - # nvm install 12.6.0 - # npm install - # elif [[ ("$TEST_SUITE" = "ios") ]]; then - # curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash - # nvm install 12.6.0 + elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${OCLINT}" = "true") ]]; then + curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash + nvm install 12.6.0 + npm install + elif [[ ("$TEST_SUITE" = "ios") ]]; then + curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash + nvm install 12.6.0 - # git submodule update --init --remote - # cd weex-playground/ios && bash update_podfile_for_travisci.sh - # cd ../../ && npm install - # cd weex-playground/ios && pod install --repo-update - # cd ../../ - # elif [[ ("$TEST_SUITE" = "code_format") ]]; then - # bundle install + git submodule update --init --remote + cd weex-playground/ios && bash update_podfile_for_travisci.sh + cd ../../ && npm install + cd weex-playground/ios && pod install --repo-update + cd ../../ + elif [[ ("$TEST_SUITE" = "code_format") ]]; then + bundle install fi script: - | - # case $TEST_SUITE in - # "android") - # case $ABI in - # "armeabi-v7a" ) - # GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false" - # ;; - # "arm64-v8a" ) - # GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false" - # ;; - # "x86" ) - # GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true" - # ;; - # "*" ) - # GRADLE_ABI="" - # ;; - # esac - # if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then - # cd android - # ./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info - # ./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info - # fi - # ;; - # "jsfm" ) - # npm run danger -- ci -i jsfm --dangerfile ./dangerfile-jsfm.js - # ;; - # "danger" ) - # npm run danger -- ci -i danger --dangerfile ./dangerfile.js - # ;; - # "ios" ) - # if npm run danger -- ci --dangerfile ./dangerfile-ios.js | grep -q "hasIosFile" ; then - # # build WeexSDK and run WeexSDKTests - # xcodebuild -quiet -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1 - # # build WeexDemo and run WeexDemo test - # cd weex-playground/ios && mkdir tmp && mv * tmp;cd tmp - # xcodebuild -quiet -workspace WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1 - # fi - # ;; - # esac + case $TEST_SUITE in + "android") + case $ABI in + "armeabi-v7a" ) + GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false" + ;; + "arm64-v8a" ) + GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false" + ;; + "x86" ) + GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true" + ;; + "*" ) + GRADLE_ABI="" + ;; + esac + if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then + cd android + ./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info + ./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info + fi + ;; + "jsfm" ) + npm run danger -- ci -i jsfm --dangerfile ./dangerfile-jsfm.js + ;; + "danger" ) + npm run danger -- ci -i danger --dangerfile ./dangerfile.js + ;; + "ios" ) + if npm run danger -- ci --dangerfile ./dangerfile-ios.js | grep -q "hasIosFile" ; then + # build WeexSDK and run WeexSDKTests + xcodebuild -quiet -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1 + # build WeexDemo and run WeexDemo test + cd weex-playground/ios && mkdir tmp && mv * tmp;cd tmp + xcodebuild -quiet -workspace WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1 + fi + ;; + esac - # if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then - # if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasCFile" ; then - # echo "hasCFile" - # 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 \ - # -disable-rule=AssignIvarOutsideAccessors \ - # -max-priority-1=15000 \ - # -max-priority-2=15000 \ - # -max-priority-3=15000 > oclint.log - # export COMMAND="cat ios/sdk/oclint.log | grep -i \"P[1|2]\"" - # cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js - # fi - # fi + if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then + if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasCFile" ; then + echo "hasCFile" + 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 \ + -disable-rule=AssignIvarOutsideAccessors \ + -max-priority-1=15000 \ + -max-priority-2=15000 \ + -max-priority-3=15000 > oclint.log + export TITLE="OCLint Result" + export COMMAND="cat ios/sdk/oclint.log | grep -i \"P[1|2]\"" + cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js + fi + fi if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = "true") ]]; then if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasAndroidFile" ; then echo "hasAndroidFile" cd android - # # use androidLint danger plugin to report android lint information - # # androidLint danger need the project .git directory to get github repo infomation - # # and it read from .git from current directory - # # so temp to mv .git to current directory and mv .git to it's origin directory after exec androidLint plugin - # # mv ../.git ./ && bundle exec danger --danger_id=androidLint --dangerfile=../Dangerfile-android && mv .git ../ - # bundle exec danger --danger_id=androidLint --dangerfile=../Dangerfile-android ./gradlew lint --quiet - export COMMAND="echo AndroidLint" - cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js && cd android + export TITLE="AndroidLint Result" export COMMAND="cat android/sdk/build/reports/lint-results.xml" cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js fi fi - # if [[ ("$TEST_SUITE" = "code_format") ]]; then - # echo "exec code format" - # bundle exec danger --danger_id=codeFormat - # fi + if [[ ("$TEST_SUITE" = "code_format") ]]; then + echo "exec code format" + bundle exec danger --danger_id=codeFormat + fi notifications: webhooks: diff --git a/android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java b/android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java index 5e38d2efdd..7d6a85446e 100644 --- a/android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java +++ b/android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java @@ -52,4 +52,4 @@ public Class getComponentClass(String name, String classN } } -} +} \ No newline at end of file diff --git a/dangerfile-output.js b/dangerfile-output.js index 926e00fd9c..2c70d8eab4 100644 --- a/dangerfile-output.js +++ b/dangerfile-output.js @@ -21,11 +21,14 @@ import { fail, warn } from 'danger' const shell = require('shelljs') const command = process.env.COMMAND +const title = process.env.TITLE const child = shell.exec(command) - + if (child.stdout !== '') { + warn(`## ${title}`) warn(child.stdout) } if (child.stderr !== '') { + fail(`## ${title}`) fail(child.stderr) } diff --git a/ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h b/ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h index f8e6dec0ad..3d1c378481 100644 --- a/ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h +++ b/ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h @@ -24,4 +24,3 @@ @property (nonatomic, strong) NSString *instanceId; @end -