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

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
wrmswindmill committed Jul 24, 2019
2 parents ce436aa + 5ea0466 commit ddd48f7
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 1,262 deletions.
11 changes: 6 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ All PRs should be submitted to master branch -->
<!-- Please follow the template below:
* If you are going to fix a bug of Weex, check whether it already exists in [Github Issue](https://github.com/apache/incubator-weex/issues). If it exists, make sure to write down the link to the corresponding Github issue in the PR you are going to create.
* If you are going to add a feature for weex, reference the following recommend procedure:
1. Writing a email to [mailing list](https://weex.io/guide/contribute/how-to-contribute.html#mailing-list) to talk about what you'd like to do.
1. Write the corresponding [document](https://weex.io/guide/contribute/how-to-contribute.html#contribute-code-or-document) -->
1. Writing a email to [mailing list](https://github.com/apache/incubator-weex/blob/master/CONTRIBUTING.md#mailing-list) to talk about what you'd like to do.
1. Write the corresponding [Documentation](https://github.com/apache/incubator-weex/blob/master/CONTRIBUTING.md#contribute-documentation)
1. Write the corresponding Changelogs at the end of changelog.md -->


# Brief Description of the PR

# Checklist
* [] Demo
* [] Document
* Demo:
* Documentation:

<!-- # Additional content -->
<!-- # Additional content -->
154 changes: 117 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,134 @@
# Join Weex community

> Community over code
Weex project belongs to Apache Software Foundation and Weex community respects and fulfills the Apache rule, which is **Community over code** .

## Code of Conduct

To make an open and friendly community, Weex community adopt [Contributor Covenant](https://www.contributor-covenant.org/version/1/4/code-of-conduct) as the code of conduct.

## Mailing List
# Contributing to Weex
Weex community respects all kinds of contributing, including but not limited to code, documentation, mailing list.
## Table of Content
* [Code of Conduct](#code-of-conduct)
* [Mailing List](#mailing-list)
* [Ask or Answer Questions](#mailing-list)
* [Contribute Code or document](#contribute-code-or-document)
* [Contribute Documentation](contribute-documentation)
* [Contribute Code](#contribute-code)

# Code of Conduct
To make an open and friendly community, Weex community adopt [Contributor Covenant](./CODE_OF_CONDUCT.md) as the code of conduct.

# Mailing List
> If it didn't happen on a mailing list, it didn't happen.
**Subscribing mailing list of weex is necessary to join weex community.**
In Weex community, feature requests, discussions and decisions happen on the mailing list, which is open to the whole world. Ref our [website](https://weex.apache.org/guide/contribute/how-to-contribute.html#mailing-list) to see more.

In Weex community, feature requests, discussions and decisions happen on the mailing list, which is open to the whole world.
# Ask or Answer Questions
Weex Community [Github Issue](https://github.com/apache/incubator-weex/issues) to report and track bugs 。The more information provided in a Github issue, the sooner it get solved.

`dev@weex.incubator.apache.org` is the mailing list's address. Developers can subscribe this list to know what is happening in weex community and express his/her idea. Send an email to [subscription](mailto:dev-subscribe@weex.incubator.apache.org?subject=%28send%20this%20email%20to%20subscribe%29) then you will receive a confirmation email. Once you reply the confirmation email, the subscription is done.
*Tip*:
> * Avoid duplicated: Always search on Github before you fire a new one.
> * Always run with the latest version before you fire a bug
> * Only report one bug in one Github Issue.
If you want to unsubscribe, send an email to [Canceling subscription](mailto:dev-unsubscribe@weex.incubator.apache.org?subject=%28send%20this%20email%20to%20unsubscribe%29)
## Format of Github issue
Please use the [Bug Report](https://github.com/apache/incubator-weex/issues/new/choose) template when firing a bug. All the information needed to solve a bug is listed in the Bug report template , please fill it out as much as you can. **The more information provided in a Github issue, the sooner it get solved.**

Read [Apache mailing list](https://apache.org/foundation/mailinglists.html) to have a deeper view of mailing list.
*Tip*:
> Report bug with fact and expected behavior, not complaint or emotional words.
## Be patient
Compared to the amount of issues, Weex community may not response to your issues in time, please be patient.

## Ask or Answer Questions
* You ask questions on [stackoverflow.com](http://stackoverflow.com/questions/tagged/weex) for basic use problems and concepts.
* You can report a bug through Github Issue as mention in [bug report](https://weex.io/guide/contribute/bug-report-guidelines.html).
*Tip*:
> If your Github issue doesn't get any response over a week, you can ask developers through [weex mailing list](https://weex.apache.org/guide/contribute/how-to-contribute.html#mailing-list).
**Tip**:
> Formally speaking, StackOverflow is not part of Weex community though developers around the world continually contribute to it. If your question on StackOverflow doesn't get response within 96 hours, you can fire a [Github Issue](https://github.com/apache/incubator-weex/issues) with link to your question on StackOverflow.
**Warning**:
> Only the following types of issues are valid Github issues, for other problem, ask it in the mailing list.
> * Bug
> * StackOverflow questions, which doesn't get response over 96 hours.

## Contribute Code or document
# Contribute Code or document
In Weex community, **Documentation is as important as code**, and Weex community respects all the contribution of documentation or code.

**Tip**:
*Tip*:
> Weex adopts [Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/) as its open source license. Make sure your contribution obeys the requirement of Apache License 2.0.
### Contribute documentation
Documentation with good quality is a great help to developers. If there is a powerful API that is not easy to use, it becomes useless. So, we welcome any contributions to help Weex's documents become precise and easy to read.
## Contribute documentation
Documentation with good quality is a great help to developers. If there is a powerful API that is not easy to use, it becomes useless. So, we welcome contributions to help documentation of Weex become precise and easy to read.

You can contribute to a document through the following ways:
* Click **Edit this page** on the bottom of website, and you will be navigated to a new Github PR.

**Tip**
> PR about documentation should be fired based on **draft** branch currently, which will be merged master branch automatically later when all things are settled.
### Contribute code
You can fix a bug or develop a new feature when contributing code, ref [Contribution of Code](https://weex.io/guide/contribute/contribute-code.html) to see more detail.
## Contribute code
### Before Coding
#### Use master branch
The development of Weex is on master branch, you should write your code based on master branch.

#### Check License
Weex adopts [Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/) as its open source license. Make sure your potential contribution obeys the requirement of Apache License 2.0.

#### Bug or Feature ?
* If you are going to fix a bug of Weex, check whether it already exists in [Github Issue](https://github.com/apache/incubator-weex/issues). If it exists, make sure to write down the link of the corresponding Github issue in the PR you are going to create.
* If you are going to add a feature for weex, reference the following recommend procedure:
1. Writing a email to [mailing list](https://weex.apache.org/guide/contribute/how-to-contribute.html#mailing-list) to talk about what you'd like to do.
1. Write the corresponding [document](#contribute-documentation)

### Coding
1. [Fork](https://help.github.com/articles/fork-a-repo/) the Github repository at [https://github.com/apache/incubator-weex](https://github.com/apache/incubator-weex).
1. Clone the forked repository and create a new branch from `master` to push your commits to.
1. Develop your feature or bug fix in your new branch. Make sure your code meets the [style guidelines](#code-style-guidelines).
1. Add the **License** below to the top of any new file(s) you've added.

/*
* 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.
*/

1. Commit all the changes to your branch.

*Tip*:
> If you are writing Java or C++ with Android Studio, **License** will be added to the head of the file automatically.
#### Code Style Guidelines

##### Objective-C

* Tabs should be used for indentation. Please do not use spaces.
* `*` operator goes with the variable name (e.g. Type *variable;)
* For function definitions, place each brace on its own line.
* For all the other braces, place the open brace on the line preceding the code block and place the close brace on its own line.
* Use `#pragma marks` to categorize methods into functional groupings and protocol implementations
* Follow other guidelines on [GitHub Objective-C Style Guide](https://github.com/github/objective-c-style-guide)

##### Java & Android
* Use [Google Java Style](https://google.github.io/styleguide/javaguide.html) as basic guidelines of java code.
* Follow [AOSP Code Style](https://source.android.com/source/code-style.html) for rest of android related code style.

##### C & C++
* Use [Google C++ Style ](https://google.github.io/styleguide/cppguide.html) as basic guidelines of C++ code
* Weex defines [a subset of the Google C++ development specification](https://github.com/jianhan-he/C-Style-Guide/blob/master/C%2B%2B_Style_Guide_en.md) that covers some of the major C++ scenario usage specifications.

### Publish your Change
[Open a pull request](https://help.github.com/articles/using-pull-requests/) against the `master` branch of `apache/incubator-weex`. Make sure following guidelines are considered when creating a pull request.

1. One PR should solve only one problem.
1. The PR title should be the form of `[COMPONENT] Summary`:
* `COMPONENT` is one of the mentioned PR categories (android, iOS, JsFm, web, test, etc..).
* `Summary` should be a brief description of your change within one sentence.
1. Content description of PR
* If the PR is about fixing a bug *excluding crash*, a [demo](http://editor.weex.io/) is necessary in code's description.
* If the PR is about adding a new feature, another [PR for documentation](#contribute-documentation) is necessary in codes' PR description.
* *Optional* If the PR fixes an existing Github issue, you may add the link to the corresponding issue in the PR.

There will be a static check program when you submit a PR,and the following rules will be checked:
1. Check if your PR is submitted to master branch, if not, you will failed.
1. Check if your PR is bounded with a milestone, if not, you will receive a warning message.
1. Check if your PR description contains keywords `Documentation` and it's corresponding http links. if not, you will receive a warning message.
1. Check if your PR description contains keywords `Demo` and it's corresponding http links. if not, you will receive a warning message.
1. Check if your PR modify the changelog.md, if not,you will receive a warning message.

*Tip*:
> Reviewing PR may take a great deal of time, please be patient. If your PR doesn't get response over 96 hours, you might send an email to [mailing list](https://weex.apache.org/guide/contribute/how-to-contribute.html#mailing-list) to ask the progress.
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ public void setUseScroller(boolean use) {
public void setInstanceViewPortWidth(int instanceViewPortWidth) {
this.mInstanceViewPortWidth = instanceViewPortWidth;
this.mAutoAdjustDeviceWidth = false;
WXBridgeManager.getInstance().setViewPortWidth(getInstanceId(),mInstanceViewPortWidth);
}

public void setAutoAdjustDeviceWidth(boolean autoAdjustViewPort){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public class WXBridge implements IWXBridge {
* */
public native void nativeUpdateGlobalConfig(String config);

private native void nativeSetViewPortWidth(String instanceId, float viewPortWidth);

public static final boolean MULTIPROCESS = true;


Expand Down Expand Up @@ -765,6 +767,10 @@ public void setInstanceRenderType(String instanceId, String renderType){
nativeSetInstanceRenderType(instanceId, renderType);
}

@Override
public void setViewPortWidth(String instanceId,float viewPortWidth){
nativeSetViewPortWidth(instanceId,viewPortWidth);
}

@Override
public void removeInstanceRenderType(String instanceId){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3338,6 +3338,11 @@ public void markDirty(String instanceId, String ref, boolean dirty) {
mWXBridge.markDirty(instanceId, ref, dirty);
}
}
public void setViewPortWidth(String instanceId,float viewPortWidth){
if (isSkipFrameworkInit(instanceId) || isJSFrameworkInit()) {
mWXBridge.setViewPortWidth(instanceId,viewPortWidth);
}
}

public int callHasTransitionPros(String instanceId, String ref, HashMap<String, String> styles) {
WXComponent component = WXSDKManager.getInstance().getWXRenderManager().getWXComponent(instanceId, ref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,6 @@ int callUpdateAttrs(String instanceId, String ref,

void setPageArgument(String instanceId, String key, String value);

void setViewPortWidth(String instanceId,float viewPortWidth);

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public WXComponent createInstance(WXSDKInstance instance, WXVContainer parent, B
*/
protected WXCirclePageAdapter mAdapter;

protected boolean mShowIndicators;
protected boolean mShowIndicators = true;

protected OnPageChangeListener mPageChangeListener = new SliderPageChangeListener();

Expand Down Expand Up @@ -264,6 +264,7 @@ public void addIndicator(WXIndicator indicator) {
return;
}
mIndicator = indicator;
mIndicator.setShowIndicators(mShowIndicators);
WXCircleIndicator indicatorView = indicator.getHostView();
if (indicatorView != null) {
indicatorView.setCircleViewPager(mViewPager);
Expand Down
53 changes: 51 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,64 @@
* specific language governing permissions and limitations
* under the License.
*/
import { schedule, danger, fail, warn, message, markdown } from "danger";
// Removed import
import fs from "fs";
import path from 'path';
import GitHubApi from 'github';
import parseDiff from 'parse-diff';

// check if pr submitted to master branch
console.log("checkMasterBranch")
const isMergeRefMaster = danger.github.pr.base.ref === 'master';
if(!isMergeRefMaster){
warn("You'd better to submit PR to master branch as the development of Weex is on master branch.");
}

// match regex line by line
function matchRegex(pr_body,regex){
const lines = pr_body.split("\n");
for (let i = 0; i < lines.length; i++) {
if(lines[i].match(regex)){
return true;
}
}
return false;
}

var pr_body = danger.github.pr.body.toLowerCase();
// Because Pr description template include the following line:
// 1. Write the corresponding [documentation](https://github.com/apache/incubator-weex/blob/master/CONTRIBUTING.md#contribute-code-or-document)
// so we should check the documentation below the ### checklist
console.log("checkDocumentation");
const index = pr_body.indexOf("checklist")
const includeChecklist = (index!=-1)
if(includeChecklist && !matchRegex(pr_body.substring(index),/documentation.*http/)){
const msg = "If you update the code, "+
"maybe you should update the documentation and add the documentation link in the PR description. \n" +
"here is the guide about how to contribute documentation:https://github.com/apache/incubator-weex/blob/master/CONTRIBUTING.md#contribute-code-or-document \n";
warn(msg);
}

// check if pr contains a demo link
console.log("checkDemo");
if(!matchRegex(pr_body,/demo.*http/)){
const msg = "If your PR is about fixing a bug excluding crash the code,"+
"you should add the demo link in the PR description. \n "+
"here is a demo link:http://dotwe.org/vue?spm=a2c7j.-guide-contribute-contribute-code.0.0.3e93748cmxz3yt";
warn(msg);
}

// check if pr bind the github milestone
console.log("checkMileStone");
if(!danger.github.pr.milestone){
warn("Current pr not bind the milestone");
}

// Make sure there are changelog entries
const hasChangelog = danger.git.modified_files.includes("changelog.md")
if (!hasChangelog) { warn("No Changelog changes!") }
if (!hasChangelog) {
warn(`No Changelog changes! - <i>Can you add a Changelog? To do so,append your changes to the changelog.md</i>`);
}

const jsFiles = danger.git.created_files.filter(path => path.endsWith("js"));

Expand Down
Loading

0 comments on commit ddd48f7

Please sign in to comment.