Skip to content

Commit a1457d1

Browse files
robertkirkmanfornwall
authored andcommitted
Fixed: Correct publication of Maven libraries after update of Gradle to 9.2.1
- After #3619, unfortunately this error began to occur when one attempts to use the [Publication to Maven Local guide](https://github.com/termux/termux-app/wiki/Termux-Libraries#forking-and-local-development) to compile all Termux APKs entirely from source, which previously worked: ``` > Task :app:processDebugResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction > Android resource linking failed ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/src/main/AndroidManifest.xml:72:9-76:20: AAPT: error: resource style/Theme.BaseActivity.DayNight.NoActionBar (aka com.termux.api:style/Theme.BaseActivity.DayNight.NoActionBar) not found. ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/src/main/AndroidManifest.xml:88:9-93:20: AAPT: error: resource style/Theme.BaseActivity.DayNight.NoActionBar (aka com.termux.api:style/Theme.BaseActivity.DayNight.NoActionBar) not found. ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/build/intermediates/packaged_manifests/debug/processDebugManifestForPackage/AndroidManifest.xml:183: AAPT: error: resource style/Theme.MarkdownViewActivity.DayNight (aka three.termux.api:style/Theme.MarkdownViewActivity.DayNight) not found. ``` - This PR fixes that error by using `components.default` in the `publications` block instead of `components.findByName('release')` and adding a `publishing` block to the `android` section of the `build.gradle` of each affected library, in accordance with https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/dsl/PublishingOptions and https://stackoverflow.com/a/71366104. `components.release` no longer works, but testing indicates that `components.default` works.
1 parent 2ad6112 commit a1457d1

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

terminal-emulator/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ android {
4343
testOptions {
4444
unitTests.returnDefaultValues = true
4545
}
46+
47+
publishing {
48+
multipleVariants {
49+
withSourcesJar()
50+
withJavadocJar()
51+
allVariants()
52+
}
53+
}
4654
}
4755

4856
tasks.withType(Test) {
@@ -66,7 +74,7 @@ afterEvaluate {
6674
publications {
6775
// Creates a Maven publication called "release".
6876
release(MavenPublication) {
69-
from components.findByName('release')
77+
from components.default
7078
groupId = 'com.termux'
7179
artifactId = 'terminal-emulator'
7280
version = '0.118.0'

terminal-view/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ android {
2727
sourceCompatibility JavaVersion.VERSION_1_8
2828
targetCompatibility JavaVersion.VERSION_1_8
2929
}
30+
31+
publishing {
32+
multipleVariants {
33+
withSourcesJar()
34+
withJavadocJar()
35+
allVariants()
36+
}
37+
}
3038
}
3139

3240
dependencies {
@@ -43,7 +51,7 @@ afterEvaluate {
4351
publications {
4452
// Creates a Maven publication called "release".
4553
release(MavenPublication) {
46-
from components.findByName('release')
54+
from components.default
4755
groupId = 'com.termux'
4856
artifactId = 'terminal-view'
4957
version = '0.118.0'

termux-shared/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ android {
6363
path file('src/main/cpp/Android.mk')
6464
}
6565
}
66+
67+
publishing {
68+
multipleVariants {
69+
withSourcesJar()
70+
withJavadocJar()
71+
allVariants()
72+
}
73+
}
6674
}
6775

6876
dependencies {
@@ -81,7 +89,7 @@ afterEvaluate {
8189
publications {
8290
// Creates a Maven publication called "release".
8391
release(MavenPublication) {
84-
from components.findByName('release')
92+
from components.default
8593
groupId = 'com.termux'
8694
artifactId = 'termux-shared'
8795
version = '0.118.0'

0 commit comments

Comments
 (0)