Skip to content

Commit

Permalink
测试发布github
Browse files Browse the repository at this point in the history
  • Loading branch information
uni-cstar committed Jul 8, 2021
1 parent 1c4d469 commit c2ec2b0
Show file tree
Hide file tree
Showing 12 changed files with 451 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@
/build
/captures
.externalNativeBuild
.cxx
gradlew
gradlew.bat
/gradle
.cxx
1 change: 0 additions & 1 deletion app/src/main/java/andme/sample/arch/BackpressedDemo.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package andme.sample.arch

import andme.arch.activity.AMBackPressedOwner
import andme.arch.app.AMFragment
import andme.arch.app.AMViewModel
import andme.arch.app.tryUi
Expand Down
10 changes: 10 additions & 0 deletions arch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ dependencies {

compileOnly 'com.aliyun.dpa:oss-android-sdk:2.9.5'
}


/*以下配置顺序不能改变*/
apply from: "../doc/jitpack/config.gradle"

ext {
PUBLISH_ARTIFACT_ID = artifactId("arch")
}

apply from: "../doc/jitpack/publish.gradle"
11 changes: 10 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,13 @@ dependencies {

//permission: 个人权限处理框架
api('halo.android:permission:1.0.5-rc')
}
}

/*以下配置顺序不能改变*/
apply from: "../doc/jitpack/config.gradle"

ext {
PUBLISH_ARTIFACT_ID = artifactId("core")
}

apply from: "../doc/jitpack/publish.gradle"
84 changes: 84 additions & 0 deletions doc/jitpack.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apply plugin: 'maven-publish'

static def artifactId(name) {
return "$name"
}


ext {
PUBLISH_GROUP_ID = "com.github.qiushui95.MyArchitecture"
PUBLISH_VERSION = "0.0.1-alpha"
artifactId = this.&artifactId
}

//编译groovy代码时采用 UTF-8
tasks.withType(GroovyCompile) {
groovyOptions.encoding = "UTF-8"
}
//编译JAVA文件时采用UTF-8
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

tasks.withType(Javadoc) {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
options {
encoding "UTF-8"
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
addStringOption('Xdoclint:none', '-quiet') // 忽略检查@params 和 @return
}
}


afterEvaluate { project ->

publishing {
def isAndroidProject = project.plugins.hasPlugin('com.android.library')

publications {
release(MavenPublication) {
// groupId 等信息
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

if (isAndroidProject) {
// 移除R文件,移除BuildConfig文件
generateReleaseBuildConfig.enabled = false
generateDebugBuildConfig.enabled = false
generateReleaseResValues.enabled = false
generateDebugResValues.enabled = false
// 使用了这个组件,就不需要自己aar、pom.withxml了
from components.release

task androidSourcesJar(type: Jar) {
getArchiveClassifier().set('sources')
from project.android.sourceSets.main.java.source

exclude "**/R.class"
exclude "**/BuildConfig.class"
}
artifact androidSourcesJar

} else if (project.plugins.hasPlugin('java')) {
from components.java

task sourcesJar(type: Jar, dependsOn: classes) {
getArchiveClassifier().set('sources')

from sourceSets.main.allSource
}

artifact sourcesJar
}
}
}

repositories {
mavenLocal()
}
}
}
9 changes: 9 additions & 0 deletions doc/jitpack/config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
static def artifactId(name) {
return "$name"
}

ext {
PUBLISH_GROUP_ID = "com.github.qiushui95.MyArchitecture"
PUBLISH_VERSION = "0.0.1-alpha"
artifactId = this.&artifactId
}
74 changes: 74 additions & 0 deletions doc/jitpack/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apply plugin: 'maven-publish'
//apply from: "./config.gradle"

//编译groovy代码时采用 UTF-8
tasks.withType(GroovyCompile) {
groovyOptions.encoding = "UTF-8"
}
//编译JAVA文件时采用UTF-8
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

tasks.withType(Javadoc) {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
options {
encoding "UTF-8"
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
addStringOption('Xdoclint:none', '-quiet') // 忽略检查@params 和 @return
}
}


afterEvaluate { project ->

publishing {
def isAndroidProject = project.plugins.hasPlugin('com.android.library')

publications {
release(MavenPublication) {
// groupId 等信息
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

if (isAndroidProject) {
// 移除R文件,移除BuildConfig文件
generateReleaseBuildConfig.enabled = false
generateDebugBuildConfig.enabled = false
generateReleaseResValues.enabled = false
generateDebugResValues.enabled = false
// 使用了这个组件,就不需要自己aar、pom.withxml了
from components.release

task androidSourcesJar(type: Jar) {
getArchiveClassifier().set('sources')
from project.android.sourceSets.main.java.source

exclude "**/R.class"
exclude "**/BuildConfig.class"
}
artifact androidSourcesJar

} else if (project.plugins.hasPlugin('java')) {
from components.java

task sourcesJar(type: Jar, dependsOn: classes) {
getArchiveClassifier().set('sources')

from sourceSets.main.allSource
}

artifact sourcesJar
}
}
}

repositories {
mavenLocal()
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sun Nov 01 09:49:20 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
Loading

0 comments on commit c2ec2b0

Please sign in to comment.