Skip to content

Commit

Permalink
Move from github packages to jitpack.io for hosting termux library pa…
Browse files Browse the repository at this point in the history
…ckages

Github Package hosting is considered a private repository since it requires github APIs keys if a hosted library needs to be imported as a dependency. Importing from private repositories is not allowed as per F-Droid policy so termux plugin apps can't import termux libraries as dependencies so hence we move to Jitpack. Check #2011 (comment).

Version number of all published libraries from termux-app must be the same.

Importing can be done with the following way.

Add to root level build.gradle

```
allprojects {
    repositories {
        google()
        mavenCentral()
        //mavenLocal()
        maven { url "https://jitpack.io" }
    }
}
```

Add to app module level build.gradle if you want to import `termux-shared`

```
 dependencies {
    implementation 'com.github.termux:termux-shared:0.115'
}
```

Check https://github.com/jitpack/jitpack.io#building-with-jitpack for other details, like including commit or branch level import.

If you are updating the libraries as well and want to test locally, run `./gradlew publishReleasePublicationToMavenLocal` from root directory of termux-app to publish library to local maven repository. You may need to rebuild project before it, library files will be published at `~/.m2/repository/com/github/termux/termux-shared/0.115`. If you want to import the updated library in a project, then uncomment the `mavenLocal()` line in the build.gradle and run sync gradle with project files.

Making changes to library after dependencies have already been cached without incrementing version number may need deleting gradle cache if syncing gradle files doesn't work after publishing changes. Open gradle right sidebar in android studio, then right click on top level entry, then select "Refresh Gradle Dependencies", which will redownload/refresh all dependencies and will take a lot of time. Instead running `find ~/.gradle/caches/ -type d -name "*com.github.termux*" -prune -exec rm -rf "{}" \; -print` and then running gradle sync should be enough.

Using "com.termux" instead of "com.github.termux" will require a DNS TXT record to be added from git.termux.com to https://github.com/termux at termux.com

https://jitpack.io/docs/#custom-domain-name
  • Loading branch information
agnostic-apollo committed Jun 20, 2021
1 parent f77c886 commit b7b12eb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 83 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/publish_libraries.yml

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}

Expand Down
29 changes: 10 additions & 19 deletions terminal-emulator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,16 @@ task sourceJar(type: Jar) {
classifier "sources"
}

publishing {
publications {
bar(MavenPublication) {
groupId 'com.termux'
artifactId 'terminal-emulator'
version "0.114"
artifact(sourceJar)
artifact("$buildDir/outputs/aar/terminal-emulator-release.aar")
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/termux/termux-app")

credentials {
username = System.getenv("GH_USERNAME")
password = System.getenv("GH_TOKEN")
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
groupId = 'com.github.termux'
artifactId = 'terminal-emulator'
version = '0.114'
artifact(sourceJar)
}
}
}
Expand Down
29 changes: 10 additions & 19 deletions terminal-view/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,16 @@ task sourceJar(type: Jar) {
classifier "sources"
}

publishing {
publications {
bar(MavenPublication) {
groupId 'com.termux'
artifactId 'terminal-view'
version "0.114"
artifact(sourceJar)
artifact("$buildDir/outputs/aar/terminal-view-release.aar")
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/termux/termux-app")

credentials {
username = System.getenv("GH_USERNAME")
password = System.getenv("GH_TOKEN")
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
groupId = 'com.github.termux'
artifactId = 'terminal-view'
version = '0.114'
artifact(sourceJar)
}
}
}
Expand Down
29 changes: 10 additions & 19 deletions termux-shared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,16 @@ task sourceJar(type: Jar) {
classifier "sources"
}

publishing {
publications {
bar(MavenPublication) {
groupId 'com.termux'
artifactId 'termux-shared'
version "0.114"
artifact(sourceJar)
artifact("$buildDir/outputs/aar/termux-shared-release.aar")
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/termux/termux-app")

credentials {
username = System.getenv("GH_USERNAME")
password = System.getenv("GH_TOKEN")
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
groupId = 'com.github.termux'
artifactId = 'termux-shared'
version = '0.114'
artifact(sourceJar)
}
}
}
Expand Down

0 comments on commit b7b12eb

Please sign in to comment.