I love it when I catch you looking at me then you smile and look away.
我喜欢这样的时刻:我抓到你正在看我,你笑了,害羞地别过脸去。
I
I can believe fly.
Option | Description |
-o | Target directory for HTML report files. Subdirectories will be created as needed to represent separate "runs" of the analyzer. If this option is not specified, a directory is created in /tmp to store the reports. |
-h (or no arguments) | Display all scan-build options. |
-k --keep-going | Add a "keep on going" option to the specified build command.This option currently supports make and xcodebuild.
This is a convenience option; one can specify this behavior directly using build options. |
-v | Verbose output from scan-build and the analyzer. A second and third "-v" increases verbosity, and is useful for filing bug reports against the analyzer. |
-V | View analysis results in a web browser when the build command completes. |
--use-analyzer Xcode or --use-analyzer [path to clang] | scan-build uses the 'clang' executable relative to itself for static analysis. One can override this behavior with this option by using the 'clang' packaged with Xcode (on OS X) or from the PATH. |
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = "" config.build_settings['CODE_SIGNING_REQUIRED'] = "NO" config.build_settings['CODE_SIGNING_ALLOWED'] = "NO" end end end
Gradle 基于DSL(领域特定语言)语法的自动化构建工具。其所有task可由Groovy代码控制,因此相对Maven那套标准性的流程或模板来说,Gradle会更加灵活,扩展性更强。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
}
安装完后,在项目的当前目录下执行 gradle init wrapper
如果是在已有maven配置的项目,gradle会自动识别转换,但部分配置还需要自行修改。
负责人使用wrapper初始化环境,开发团员的其它成员就可以不用自己安装了。
自动生成gradlew,build.gradle,settings.gradle等文件和相关目录
$ ./gradlew build
Downloading https://services.gradle.org/distributions/gradle-2.3-bin.zip
建议:在gradle项目里,尽量使用gradlew来编译,它会自动下载对应的版本,这样团队的其他成员就不需要手动安装了且可以保持大家使用的版本一致。
如果你的工程是Eclipse 结构,那在build.gradle需要映射目录处理
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
androidTest.setRoot('tests')
}
}
repositories {
maven {
url "http://127.0.0.1/nexus/content/groups/public"
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name:'cards', ext:'aar')
}
dependencies {
compile group: 'com.duowan.mobile.uauth', name: 'yyauth', version:'1.7'
}
}
dependencies {
classpath 'com.nabilhachicha:android-native-dependencies:0.1+'
}
native_dependencies {
artifact 'com.duowan.mobile.uauth:yyauth:1.7:armeabi'
artifact 'com.duowan.mobile.uauth:yyauth:1.7:armeabi-v7a'
}
lintOptions {
abortOnError false
}
defaultConfig {
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 0 // 如果环境变量BUILD_NUMBER存在则读取,否则取0
versionName version // version是gradle.propertise定义的属性
}
defaultConfig {
project.ext.set("archivesBaseName", "myAPP-" + versionName + "-" + versionCode);
}
defaultConfig {
applicationVariants.all {
variant -> changeApkName(variant)
}
def changeApkName(variant) {
def apk = variant.outputs[0].outputFile
def newName = ""
newName = apk.name.replace(project.name, project.name + "-" + android.defaultConfig.versionName + "-" + android.defaultConfig.versionCode)
if (variant.buildType.name == "release") {
newName = newName.replace("-" + variant.buildType.name, "")
}
variant.outputs[0].outputFile = new File(apk.parentFile, newName)
if (variant.outputs[0].zipAlign) {
variant.outputs[0].zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""))
}
}
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
File signFile = file(System.getenv('HOME') + "/.android/sign.properties")
if( signFile.canRead() ) {
Properties p = new Properties()
p.load(new FileInputStream(signFile))
if( p!=null
&& p.containsKey('key.store')
&& p.containsKey('key.store.password')
&& p.containsKey('key.alias')
&& p.containsKey('key.alias.password')
) {
println "RELEASE_BUILD: Signing..."
android.signingConfigs.release.storeFile = file( p['key.store'] )
android.signingConfigs.release.storePassword = p['key.store.password']
android.signingConfigs.release.keyAlias = p['key.alias']
android.signingConfigs.release.keyPassword = p['key.alias.password']
} else {
println "RELEASE_BUILD: Required properties in signing.properties are missing"
android.buildTypes.release.signingConfig = null
}
} else {
println "RELEASE_BUILD: signing.properties not found"
android.buildTypes.release.signingConfig = null
}
defaultConfig {
sourceSets {
main {
jni.srcDirs = []
}
}
ndk {
moduleName "singalsdk"
abiFilter "armeabi-v7a,x86,armeabi"
stl "stlport_shared"
}
}
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
def androidMKfile = "$projectDir/jni/Android.mk"
def applicationMKfile = "$projectDir/jni/Application.mk"
def ndkDir = System.env.ANDROID_NDK_HOME
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
def ndkbuildcmd = $ndkDir/ndk-build.cmd
} else {
def ndkbuildcmd = $ndkDir/ndk-build
}
def execmd = ["$ndkbuildcmd","-j16","NDK_PROJECT_PATH=$buildDir",
"APP_BUILD_SCRIPT=$androidMKfile", "NDK_APPLICATION_MK=$applicationMKfile"]
println(execmd)
commandLine execmd
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
初始化渠道包列表./../markets.list
productFlavors {
def path="./../markets.list"
file(path).eachLine { line->
def channel = line
if (!channel.trim().equals("")) {
"$channel" {
manifestPlaceholders=[channelname: channel]
}
}
}
}
apply plugin: 'maven-publish'
apply plugin: 'signing'
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
group = GROUP
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
exclude '**/*.so'
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
task androidNativeJar(type: Jar) {
classifier = 'so'
from(new File(buildDir, 'libs'))
include("**/*.so")
}
task androidNativeZip(type: Zip) {
classifier = 'so'
from(new File(buildDir, 'libs'))
include("**/*.so")
}
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact bundleRelease
artifact androidJavadocsJar
}
}
}
publishing {
repositories {
maven {
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
if(isReleaseBuild()) {
url getReleaseRepositoryUrl()
} else {
url getSnapshotRepositoryUrl()
}
}
}
}
task clearJar(type: Delete) {
delete 'build/libs/' + POM_ARTIFACT_ID + '_' + VERSION_NAME + '.jar'
}
task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
rename ('classes.jar', POM_ARTIFACT_ID + '_' + VERSION_NAME + '.jar')
}
makeJar.dependsOn(clearJar, build)
from 'build/outputs/apk'
exclude '**/*-unaligned.apk'
into 'target'
gradle --help
gradle tasks //列出task列表
gradle asD (gradle assembleDebug) //编译debug打包
gradle asR (gradle assembleRelease) //编译release打包
gradle asD --refresh-dependencies //强制刷新依赖
gradle asD --parallel //并行编译
gradle asD --parallel-threads 3
gradle clean