Skip to content

Commit

Permalink
Add missing sources jar into published android artifacts (#32982)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kudo authored and facebook-github-bot committed Jan 28, 2022
1 parent f7a66e6 commit 384e1a0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ task installArchives {
dependsOn("publishReleasePublicationToNpmRepository")
}

// Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

android {
compileSdkVersion 31

Expand Down Expand Up @@ -414,6 +420,9 @@ afterEvaluate {
// Applies the component for the release build variant.
from components.release

// Add additional sourcesJar to artifacts
artifact(androidSourcesJar)

// You can then customize attributes of the publication as shown below.
artifactId = POM_ARTIFACT_ID
groupId = GROUP
Expand Down

0 comments on commit 384e1a0

Please sign in to comment.