Skip to content
This repository was archived by the owner on Apr 19, 2022. It is now read-only.

Commit b2431c5

Browse files
committed
Add publish.gradle
1 parent c61dd8b commit b2431c5

File tree

3 files changed

+49
-15
lines changed

3 files changed

+49
-15
lines changed

CodeView/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3+
apply from: file('publish.gradle')
34

45
android {
56
compileSdkVersion 30

CodeView/pom.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

CodeView/publish.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apply plugin: 'maven-publish'
2+
3+
def LIB_GROUP_ID = 'me.jackdevey.libraries'
4+
def LIB_ARTIFACT_ID = 'codeview'
5+
def LIB_VERSION = '1.0.0'
6+
7+
task sourceJar(type: Jar) {
8+
from android.sourceSets.main.java.srcDirs
9+
classifier "sources"
10+
}
11+
12+
publishing {
13+
repositories {
14+
maven {
15+
name = "GithubPackages"
16+
url = uri("https://maven.pkg.github.com/chenzhang2006/AndroidLibForArtifactory")
17+
credentials {
18+
username = System.getenv('GITHUB_USER') ?: project.properties['GITHUB_USER']
19+
password = System.getenv('GITHUB_PERSONAL_ACCESS_TOKEN') ?: project.properties['GITHUB_PERSONAL_ACCESS_TOKEN']
20+
}
21+
}
22+
maven {
23+
name = 'CustomMavenRepo'
24+
url = "file://${buildDir}/repo"
25+
}
26+
}
27+
publications {
28+
codeview(MavenPublication) {
29+
groupId LIB_GROUP_ID
30+
artifactId LIB_ARTIFACT_ID
31+
version LIB_VERSION
32+
artifact("$buildDir/outputs/aar/codeview-release.aar")
33+
artifact(sourceJar)
34+
35+
pom.withXml {
36+
def dependenciesNode = asNode().appendNode('dependencies')
37+
38+
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
39+
configurations.api.allDependencies.each {
40+
def dependencyNode = dependenciesNode.appendNode('dependency')
41+
dependencyNode.appendNode('groupId', it.group)
42+
dependencyNode.appendNode('artifactId', it.name)
43+
dependencyNode.appendNode('version', it.version)
44+
}
45+
}
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)