Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory optimization and code upload dependency code repository #31

Merged
merged 8 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions replugin-host-gradle/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (C) 2005-2017 Qihoo 360 Inc.
*
* Licensed 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.
*
*/

// 应用插件
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'


def baseUrl = 'https://github.com/Qihoo360/RePlugin'
def siteUrl = baseUrl
def gitUrl = "${baseUrl}/RePlugin"
def issueUrl = "${gitUrl}/issues"



install {
repositories {
mavenInstaller {
// This generates POM.xml with proper paramters
pom.project {

//添加项目描述
name 'Gradle Plugin for Android'
url siteUrl

//设置开源证书信息
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
//添加开发者信息
developers {
developer {
name 'replugin'
email 'replugin@gmail.com'
}
}

scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}

}
}


//配置上传Bintray相关信息
bintray {
user = ""
key = ""

configurations = ['archives']
pkg {
repo = '' // 上传到中央仓库的名称
name = '' // 上传到jcenter 的项目名称
userOrg = ''
desc = 'RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework' // 项目描述
websiteUrl = siteUrl
issueTrackerUrl = issueUrl
vcsUrl = gitUrl
labels = ['gradle', 'plugin']
licenses = ['Apache-2.0']
publish = true
}
}

94 changes: 51 additions & 43 deletions replugin-host-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,29 @@ apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply from: 'config.gradle'
//apply from: 'config.gradle'

repositories {
maven {
url ''
}
jcenter()
mavenCentral()
}

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.1.0'
// 将项目发布到JCenter 所需要的jar 添加依赖
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}

group = 'com.qihoo360.replugin' // 组名
version = '2.1.0' // 版本

dependencies {
compile 'com.android.tools.build:gradle:2.1.3'
compile 'org.json:json:20160212'
Expand All @@ -43,60 +57,54 @@ dependencies {



// 强制 Java/JavaDoc 等的编码为 UTF-8
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

javadoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
// 强制 Java/JavaDoc 等的编码为 UTF-8
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// 安装到本地 maven 仓库中 (gradle install)
install {
repositories.mavenInstaller {
pom.groupId = config.groupId
pom.artifactId = config.artifactId
pom.version = config.version
pom.packaging = 'jar'
}


// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}

publishing {
repositories {
maven {
url config.repoUrl
credentials {
username = config.username
password = config.password
}
}
}
publications {
maven(MavenPublication) {
groupId config.groupId
artifactId config.artifactId
version config.version

from components.java

artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
mavenJava(MavenPublication) {
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}

artifact sourcesJar
artifact javadocJar
}
}
}

apply from: 'bintray.gradle'

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
}
}

Expand Down
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions replugin-host-library/replugin-host-lib/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

def siteUrl = ''
def gitUrl = ''

version = "2.1.0"
group = 'com.qihoo360.replugin' // 组名


install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
artifactId = ""

project {

packaging 'aar'
// Add your description here
name 'RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework' //项目描述
url siteUrl
// Set your license
licenses {
license {
name 'Apache License 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
}
}
developers {
developer {
id 'qihoo360' //填写的一些基本信息
name 'qihoo360'
email 'replugin@gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
//archives javadocJar
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = ""
key = ""
configurations = ['archives']
pkg {

repo = '' // 上传到中央仓库的名称
name = '' // 上传到jcenter 的项目名称
userOrg = ''
desc = 'RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework' // 项目描述
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'replugin-rules.pro'
minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'replugin-rules.pro'
}
}

Expand All @@ -54,3 +54,5 @@ dependencies {
compile 'commons-io:commons-io:2.5'
compile 'org.apache.commons:commons-lang3:3.5'
}

apply from: 'bintray.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
include ':replugin-library'
include ':replugin-host-lib'
Loading