Skip to content

Commit e4746ef

Browse files
authored
Support dual publishing of standard and prefixed webrtc build (#18)
* Support dual publishing of standard and prefixed webrtc build * Prefix so files to avoid collison
1 parent dfb114d commit e4746ef

26 files changed

+372
-89
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ jobs:
2525
java-version: '12'
2626
distribution: 'adopt'
2727

28-
- name: Download aar
29-
run: ./downloadAar.sh
28+
- name: Download aars
29+
run: |
30+
./downloadAar.sh
31+
./downloadAar_prefixed.sh
3032
3133
- name: Check aar exists
32-
run: test -f "libwebrtc.aar"
34+
run: |
35+
test -f "android/libwebrtc.aar"
36+
test -f "android-prefixed/libwebrtc_prefixed.aar"
3337
3438
- name: Grant execute permission for gradlew
3539
run: chmod +x gradlew

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
22
.gradle/
33
.DS_Store
4-
*.asc
4+
*.asc
5+
local.properties

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This library is hosted on Maven Central. To include this library in your project
1010

1111
```gradle
1212
dependencies {
13-
implementation 'io.github.webrtc-sdk:android:114.5735.05'
13+
implementation 'io.github.webrtc-sdk:android:114.5735.06'
1414
}
1515
```
16+
17+
We also offer a shadowed version that moves the `org.webrtc` package to `livekit.org.webrtc`,
18+
avoiding any collisions with other WebRTC libraries:
19+
20+
```gradle
21+
dependencies {
22+
implementation 'io.github.webrtc-sdk:android-prefixed:114.5735.06'
23+
}
24+
```

android-prefixed/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android-prefixed/build.gradle

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
plugins {
2+
id 'signing'
3+
id 'com.android.library'
4+
id 'com.kezong.fat-aar'
5+
id 'maven-publish'
6+
}
7+
group = 'com.github.davidliu'
8+
9+
android {
10+
namespace 'com.github.davidliu.lkshadowwebrtc'
11+
compileSdk 33
12+
13+
defaultConfig {
14+
minSdk 21
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
}
21+
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_7
24+
targetCompatibility JavaVersion.VERSION_1_7
25+
}
26+
afterEvaluate {
27+
generateReleaseBuildConfig.enabled = false
28+
generateDebugBuildConfig.enabled = false
29+
generateReleaseResValues.enabled = false
30+
generateDebugResValues.enabled = false
31+
}
32+
}
33+
34+
dependencies {
35+
compileOnly project(path: ':android-prefixed:shadow', configuration: 'shadow')
36+
embed project(path: ':android-prefixed:shadow', configuration: 'shadow')
37+
}
38+
39+
def POM_ARTIFACT_ID = "android-prefixed"
40+
41+
def getReleaseRepositoryUrl() {
42+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
43+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
44+
}
45+
46+
def getRepositoryUsername() {
47+
return hasProperty('nexusUsername') ? nexusUsername : ""
48+
}
49+
50+
def getRepositoryPassword() {
51+
return hasProperty('nexusPassword') ? nexusPassword : ""
52+
}
53+
54+
def configurePom(pom) {
55+
pom.name = POM_NAME
56+
pom.packaging = POM_PACKAGING
57+
pom.description = POM_DESCRIPTION
58+
pom.url = POM_URL
59+
60+
pom.scm {
61+
url = POM_SCM_URL
62+
connection = POM_SCM_CONNECTION
63+
developerConnection = POM_SCM_DEV_CONNECTION
64+
}
65+
66+
pom.licenses {
67+
license {
68+
name = POM_LICENCE_NAME
69+
url = POM_LICENCE_URL
70+
distribution = POM_LICENCE_DIST
71+
}
72+
}
73+
74+
pom.developers {
75+
developer {
76+
id = POM_DEVELOPER_ID
77+
name = POM_DEVELOPER_NAME
78+
}
79+
}
80+
}
81+
82+
afterEvaluate {
83+
84+
publishing {
85+
repositories {
86+
maven {
87+
url getReleaseRepositoryUrl()
88+
credentials(PasswordCredentials) {
89+
username = getRepositoryUsername()
90+
password = getRepositoryPassword()
91+
}
92+
}
93+
}
94+
publications {
95+
androidPrefixed(MavenPublication) {
96+
// Applies the component for the release build variant.
97+
from components.release
98+
99+
groupId = GROUP
100+
artifactId = POM_ARTIFACT_ID
101+
version = VERSION_NAME
102+
artifact("deploy/sources.jar") {
103+
classifier 'sources'
104+
}
105+
artifact("deploy/javadoc.jar") {
106+
classifier 'javadoc'
107+
}
108+
configurePom(pom)
109+
}
110+
}
111+
112+
signing {
113+
publishing.publications.all { publication ->
114+
sign publication
115+
}
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)