gradle 7 compatibility fast way

This commit is contained in:
Primakov Alexandr Alexandrovich 2023-08-08 16:21:48 +03:00
parent 3825b3f1e0
commit 8b148a3a0d

View File

@ -28,7 +28,7 @@ def safeExtGet(prop, fallback) {
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
@ -47,7 +47,7 @@ buildscript {
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@ -113,47 +113,47 @@ def configureReactNativePom(def pom) {
}
}
afterEvaluate { project ->
// some Gradle build hooks ref:
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
classpath += files(project.getConfigurations().getByName('compile').asList())
include '**/*.java'
}
// afterEvaluate { project ->
// // some Gradle build hooks ref:
// // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
// task androidJavadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs
// classpath += files(android.bootClasspath)
// classpath += files(project.getConfigurations().getByName('compile').asList())
// include '**/*.java'
// }
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
classifier = 'javadoc'
from androidJavadoc.destinationDir
}
// task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
// classifier = 'javadoc'
// from androidJavadoc.destinationDir
// }
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
include '**/*.java'
}
// task androidSourcesJar(type: Jar) {
// classifier = 'sources'
// from android.sourceSets.main.java.srcDirs
// include '**/*.java'
// }
android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
def javaCompileTask = variant.javaCompileProvider.get()
// android.libraryVariants.all { variant ->
// def name = variant.name.capitalize()
// def javaCompileTask = variant.javaCompileProvider.get()
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
from javaCompileTask.destinationDir
}
}
// task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
// from javaCompileTask.destinationDir
// }
// }
artifacts {
archives androidSourcesJar
archives androidJavadocJar
}
// artifacts {
// archives androidSourcesJar
// archives androidJavadocJar
// }
task installArchives(type: Upload) {
configuration = configurations.archives
repositories.mavenDeployer {
// Deploy to react-native-event-bridge/maven, ready to publish to npm
repository url: "file://${projectDir}/../android/maven"
configureReactNativePom pom
}
}
}
// task installArchives(type: Upload) {
// configuration = configurations.archives
// repositories.mavenDeployer {
// // Deploy to react-native-event-bridge/maven, ready to publish to npm
// repository url: "file://${projectDir}/../android/maven"
// configureReactNativePom pom
// }
// }
// }