Skip to content

Commit

Permalink
Support dual publishing of standard and prefixed webrtc build (#18)
Browse files Browse the repository at this point in the history
* Support dual publishing of standard and prefixed webrtc build

* Prefix so files to avoid collison
  • Loading branch information
davidliu authored Dec 27, 2023
1 parent dfb114d commit e4746ef
Show file tree
Hide file tree
Showing 26 changed files with 372 additions and 89 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ jobs:
java-version: '12'
distribution: 'adopt'

- name: Download aar
run: ./downloadAar.sh
- name: Download aars
run: |
./downloadAar.sh
./downloadAar_prefixed.sh
- name: Check aar exists
run: test -f "libwebrtc.aar"
run: |
test -f "android/libwebrtc.aar"
test -f "android-prefixed/libwebrtc_prefixed.aar"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
.gradle/
.DS_Store
*.asc
*.asc
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ This library is hosted on Maven Central. To include this library in your project

```gradle
dependencies {
implementation 'io.github.webrtc-sdk:android:114.5735.05'
implementation 'io.github.webrtc-sdk:android:114.5735.06'
}
```

We also offer a shadowed version that moves the `org.webrtc` package to `livekit.org.webrtc`,
avoiding any collisions with other WebRTC libraries:

```gradle
dependencies {
implementation 'io.github.webrtc-sdk:android-prefixed:114.5735.06'
}
```
1 change: 1 addition & 0 deletions android-prefixed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
118 changes: 118 additions & 0 deletions android-prefixed/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
plugins {
id 'signing'
id 'com.android.library'
id 'com.kezong.fat-aar'
id 'maven-publish'
}
group = 'com.github.davidliu'

android {
namespace 'com.github.davidliu.lkshadowwebrtc'
compileSdk 33

defaultConfig {
minSdk 21
}

buildTypes {
release {
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
afterEvaluate {
generateReleaseBuildConfig.enabled = false
generateDebugBuildConfig.enabled = false
generateReleaseResValues.enabled = false
generateDebugResValues.enabled = false
}
}

dependencies {
compileOnly project(path: ':android-prefixed:shadow', configuration: 'shadow')
embed project(path: ':android-prefixed:shadow', configuration: 'shadow')
}

def POM_ARTIFACT_ID = "android-prefixed"

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getRepositoryUsername() {
return hasProperty('nexusUsername') ? nexusUsername : ""
}

def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}

def configurePom(pom) {
pom.name = POM_NAME
pom.packaging = POM_PACKAGING
pom.description = POM_DESCRIPTION
pom.url = POM_URL

pom.scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

pom.licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

pom.developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}

afterEvaluate {

publishing {
repositories {
maven {
url getReleaseRepositoryUrl()
credentials(PasswordCredentials) {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
publications {
androidPrefixed(MavenPublication) {
// Applies the component for the release build variant.
from components.release

groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME
artifact("deploy/sources.jar") {
classifier 'sources'
}
artifact("deploy/javadoc.jar") {
classifier 'javadoc'
}
configurePom(pom)
}
}

signing {
publishing.publications.all { publication ->
sign publication
}
}
}
}
1 change: 1 addition & 0 deletions android-prefixed/deploy/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Javadoc and sources are not available, but are required for deployment on Sonatype. These jars are used to bypass those checks.
Binary file added android-prefixed/deploy/javadoc.jar
Binary file not shown.
Binary file added android-prefixed/deploy/sources.jar
Binary file not shown.
1 change: 1 addition & 0 deletions android-prefixed/shadow/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
24 changes: 24 additions & 0 deletions android-prefixed/shadow/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

dependencies {
api files("libs/classes.jar")
}

shadowJar {

}
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation

task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "livekit" // Default value is "shadow"
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar
1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
83 changes: 83 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

apply plugin: "maven-publish"
apply plugin: 'signing'

def POM_ARTIFACT_ID = "android"
def AAR_FILE = "libwebrtc.aar"

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getRepositoryUsername() {
return hasProperty('nexusUsername') ? nexusUsername : ""
}

def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}

def configurePom(pom) {
pom.name = POM_NAME
pom.packaging = POM_PACKAGING
pom.description = POM_DESCRIPTION
pom.url = POM_URL

pom.scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

pom.licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

pom.developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}

afterEvaluate {

publishing {
repositories {
maven {
url getReleaseRepositoryUrl()
credentials(PasswordCredentials) {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
publications {
android(MavenPublication) {
groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME
artifact(AAR_FILE)
artifact("deploy/sources.jar") {
classifier 'sources'
}
artifact("deploy/javadoc.jar") {
classifier 'javadoc'
}
configurePom(pom)
}
}

signing {
publishing.publications.all { publication ->
sign publication
}
}
}
}
1 change: 1 addition & 0 deletions android/deploy/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Javadoc and sources are not available, but are required for deployment on Sonatype. These jars are used to bypass those checks.
Binary file added android/deploy/javadoc.jar
Binary file not shown.
Binary file added android/deploy/sources.jar
Binary file not shown.
Loading

0 comments on commit e4746ef

Please sign in to comment.