Skip to content

Commit 384e1a0

Browse files
Kudofacebook-github-bot
authored andcommitted
Add missing sources jar into published android artifacts (#32982)
Summary: when migrated to `maven-publish` in #31611, the sources jar is not included by default from `maven-publish`. so react-native 0.66 / 0.67 doesn't include sources jar in npm published artifacts. it's not ideal for debug or tracing code. this pr added the sources jar into the published artifact. ## Changelog [Android] [Fixed] - Add missing sources jar into published android artifacts Pull Request resolved: #32982 Test Plan: make sure sources jar is included in artifact. ``` $ ./gradlew :ReactAndroid:installArchives $ find android -name '*sources.jar*' ``` Reviewed By: ShikaSD Differential Revision: D33842979 Pulled By: cortinico fbshipit-source-id: f99ad46ce0cca0cfc2ab1d5c5a4fcb40a02683e7
1 parent f7a66e6 commit 384e1a0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ReactAndroid/build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ task installArchives {
272272
dependsOn("publishReleasePublicationToNpmRepository")
273273
}
274274

275+
// Creating sources with comments
276+
task androidSourcesJar(type: Jar) {
277+
classifier = 'sources'
278+
from android.sourceSets.main.java.srcDirs
279+
}
280+
275281
android {
276282
compileSdkVersion 31
277283

@@ -414,6 +420,9 @@ afterEvaluate {
414420
// Applies the component for the release build variant.
415421
from components.release
416422

423+
// Add additional sourcesJar to artifacts
424+
artifact(androidSourcesJar)
425+
417426
// You can then customize attributes of the publication as shown below.
418427
artifactId = POM_ARTIFACT_ID
419428
groupId = GROUP

0 commit comments

Comments
 (0)