本文档描述了如何对 Weex 源代码进行更改和提交,以下是建议的步骤:
Weex 采用 Apache License 2.0作为其开源证书,Weex的任何新增改动需要符合该开源证书的要求。
如果你准备为 Weex 修复一个Bug,先在 Github Issues 中查看对应的 Bug 是否存在,如果存在的话,请在提交Pull Request时附上对应的链接。
如果你准备为 Weex 添加一个新的特性,请遵循以下流程:
Fork Weex 的 Github 仓库。
编写需要开发的特性或 bug 修复代码,确保你的更改符合代码风格指南。
复制下面的License注释到你的新文件顶部:
/* * 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. */
提交代码到你的分支上。
:::tip 如果你使用Android Studio开发 Java 或 C++ 代码,License注释会在编译时自动添加到文件头部,无需人工操作。 :::
用 tab 缩进而不是空格
*
操作符靠近变量名(如 Type *variable)
方法定义:大括号需要另起一行
其他大括号:开括号紧跟在代码后面,不另起一行,闭括号单独占一行
使用 #pragma marks
标记将方法分类
遵循 GitHub Objective-C Style Guide 中其他的代码风格指南
创建一个 pull request 并提交到 apache/incubator-weex
的 master
分支,确保它符合这些准则:
[模块] 标题
格式::::tip PR的 Review 需要一定时间,请耐心等待。如果某个 PR 超过96小时无人回复,可向Weex邮件列表发送邮件,询问进展。 :::