1- def safeExtGet (prop , fallback ) {
2- rootProject. ext. has(prop) ? rootProject. ext. get(prop) : fallback
1+ plugins {
2+ id " com.android.library"
3+ id " maven-publish"
34}
45
5- buildscript {
6- // The Android Gradle plugin is only required when opening the android folder stand-alone.
7- // This avoids unnecessary downloads and potential conflicts when the library is included as a
8- // module dependency in an application project.
9- repositories {
10- google()
11- jcenter()
12- }
13- dependencies {
14- // noinspection GradleDependency
15- classpath rootProject. ext. has(' gradleBuildTools' ) ? rootProject. ext. get(' gradleBuildTools' ) : ' com.android.tools.build:gradle:3.3.0'
16- classpath ' com.github.dcendents:android-maven-gradle-plugin:2.1'
17- }
18- }
19-
20- apply plugin : ' com.android.library'
21- apply plugin : ' maven'
22- apply plugin : ' com.github.dcendents.android-maven'
23-
246android {
25- compileSdkVersion safeExtGet( ' compileSdkVersion ' , 28 )
26- buildToolsVersion safeExtGet( ' buildToolsVersion ' , ' 28.0.3 ' )
7+ compileSdkVersion 30
8+
279 defaultConfig {
28- minSdkVersion safeExtGet(' minSdkVersion' , 16 )
29- targetSdkVersion safeExtGet(' targetSdkVersion' , 28 )
30- versionCode 1
31- versionName " 1.0"
10+ minSdkVersion 21
11+ targetSdkVersion 30
3212 }
3313 lintOptions {
3414 abortOnError false
3515 }
3616}
3717
3818repositories {
39- mavenLocal()
40- maven {
41- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
42- url " $rootDir /../node_modules/react-native/android"
43- }
44- maven {
45- // Android JSC is installed from npm
46- url " $rootDir /../node_modules/jsc-android/dist"
47- }
48- google()
49- jcenter()
5019 if (project == rootProject) {
51- maven {
52- url " https://a8c-libs.s3.amazonaws.com/android/react-native-mirror"
53- }
20+ maven { url " https://a8c-libs.s3.amazonaws.com/android/react-native-mirror" }
5421 } else {
5522 // When building as a dep, the RN's maven repo is locally in the node_modules folder
5623 def nodeModulesPath = " ${ project.buildDir} /../../node_modules/"
5724 maven { url " ${ nodeModulesPath} /react-native/android" }
5825 }
26+
27+ google()
28+ jcenter()
29+ mavenCentral()
5930}
6031
6132dependencies {
@@ -69,80 +40,14 @@ dependencies {
6940 implementation " androidx.transition:transition:1.1.0"
7041}
7142
72- def configureReactNativePom (def pom ) {
73- def packageJson = new groovy.json.JsonSlurper (). parseText(file(' ../package.json' ). text)
74-
75- pom. project {
76- name packageJson. title
77- artifactId packageJson. name
78- version = packageJson. version
79- group = " com.swmansion.reanimated"
80- description packageJson. description
81- url packageJson. repository. baseUrl
82-
83- licenses {
84- license {
85- name packageJson. license
86- url packageJson. repository. baseUrl + ' /blob/master/' + packageJson. licenseFilename
87- distribution ' repo'
88- }
89- }
90-
91- developers {
92- developer {
93- id packageJson. author. username
94- name packageJson. author. name
43+ afterEvaluate {
44+ publishing {
45+ publications {
46+ release(MavenPublication ) {
47+ from components. release
48+ groupId = ' com.github.wordpress-mobile'
49+ artifactId = ' react-native-reanimated'
9550 }
9651 }
9752 }
9853}
99-
100- afterEvaluate { project ->
101-
102- task androidJavadoc(type : Javadoc ) {
103- source = android. sourceSets. main. java. srcDirs
104- classpath + = files(android. bootClasspath)
105- classpath + = files(project. getConfigurations(). getByName(' compile' ). asList())
106- include ' **/*.java'
107- }
108-
109- task androidJavadocJar(type : Jar , dependsOn : androidJavadoc) {
110- classifier = ' javadoc'
111- from androidJavadoc. destinationDir
112- }
113-
114- task androidSourcesJar(type : Jar ) {
115- classifier = ' sources'
116- from android. sourceSets. main. java. srcDirs
117- include ' **/*.java'
118- }
119-
120- android. libraryVariants. all { variant ->
121- def compileTask
122- if (variant. hasProperty(' javaCompileProvider' )){
123- compileTask = variant. javaCompileProvider. get()
124- }else {
125- compileTask = variant. javaCompile
126- }
127-
128- def name = variant. name. capitalize()
129- task " jar${ name} " (type : Jar , dependsOn : compileTask) {
130- from compileTask. destinationDir
131- }
132- }
133-
134- artifacts {
135- archives androidSourcesJar
136- archives androidJavadocJar
137- }
138-
139- task installArchives(type : Upload ) {
140- configuration = configurations. archives
141- repositories. mavenDeployer {
142- // Deploy to react-native-event-bridge/maven, ready to publish to npm
143- repository url : " file://${ projectDir} /../android/maven"
144-
145- configureReactNativePom pom
146- }
147- }
148- }
0 commit comments