diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 53a3f53d8823d0..ab92cf0d569837 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -244,13 +244,7 @@ final def extractNativeDependencies = tasks.register('extractNativeDependencies' } task installArchives { - dependsOn("publishReleasePublicationToNpmRepository") -} - -// Creating sources with comments -task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs + dependsOn("publishAllPublicationsToNpmRepository") } android { @@ -358,12 +352,19 @@ android { configurations { extractHeaders extractJNI - javadocDeps.extendsFrom api } buildFeatures { prefab true } + + publishing { + multipleVariants { + withSourcesJar() + withJavadocJar() + allVariants() + } + } } dependencies { @@ -390,8 +391,6 @@ dependencies { // Therefore hermes-engine is a compileOnly dependency. compileOnly(project(":ReactAndroid:hermes-engine")) - javadocDeps("com.squareup:javapoet:1.13.0") - testImplementation("junit:junit:${JUNIT_VERSION}") testImplementation("org.powermock:powermock-api-mockito2:${POWERMOCK_VERSION}") testImplementation("org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}") @@ -431,11 +430,8 @@ afterEvaluate { publishing { publications { release(MavenPublication) { - // Applies the component for the release build variant. - from components.release - - // Add additional sourcesJar to artifacts - artifact(androidSourcesJar) + // We do a multi variant release + from components.default // You can then customize attributes of the publication as shown below. artifactId = POM_ARTIFACT_ID diff --git a/scripts/publish-npm.js b/scripts/publish-npm.js index 082776561727bc..215bccd2a15890 100755 --- a/scripts/publish-npm.js +++ b/scripts/publish-npm.js @@ -188,7 +188,17 @@ exec('git checkout ReactAndroid/gradle.properties'); echo('Generated artifacts for Maven'); -let artifacts = ['.aar', '.pom'].map(suffix => { +let artifacts = [ + '.module', + '-debug.aar', + '-release.aar', + '-debug.pom', + '-release.pom', + '-debug-sources.jar', + '-release-sources.jar', + '-debug-javadoc.jar', + '-release-javadoc.jar', +].map(suffix => { return `react-native-${releaseVersion}${suffix}`; }); @@ -199,7 +209,7 @@ artifacts.forEach(name => { `./android/com/facebook/react/react-native/${releaseVersion}/${name}`, ) ) { - echo(`file ${name} was not generated`); + echo(`Failing as expected file: ${name} was not correctly generated.`); exit(1); } });