Skip to content

Commit 9f65f8f

Browse files
committed
rename to fix case
1 parent fb1d70d commit 9f65f8f

15 files changed

+137
-48
lines changed

android/build.gradle

Lines changed: 137 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,137 @@
1-
apply plugin: 'com.android.library'
2-
3-
def safeExtGet(prop, fallback) {
4-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5-
}
6-
7-
repositories {
8-
mavenCentral()
9-
jcenter()
10-
google()
11-
}
12-
13-
buildscript {
14-
repositories {
15-
jcenter()
16-
google()
17-
}
18-
dependencies {
19-
classpath 'com.android.tools.build:gradle:4.0.1'
20-
}
21-
}
22-
23-
android {
24-
compileSdkVersion safeExtGet('compileSdkVersion', 30)
25-
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
26-
defaultConfig {
27-
minSdkVersion safeExtGet('minSdkVersion', 16)
28-
targetSdkVersion safeExtGet('targetSdkVersion', 30)
29-
versionCode 1
30-
versionName "1.0"
31-
}
32-
buildTypes {
33-
release {
34-
minifyEnabled false
35-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
36-
}
37-
}
38-
productFlavors {
39-
}
40-
}
41-
42-
dependencies {
43-
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
44-
implementation 'com.squareup.okhttp3:okhttp:+'
45-
implementation 'com.squareup.okhttp3:logging-interceptor:+'
46-
implementation 'com.squareup.okhttp3:okhttp-urlconnection:+'
47-
// {ReactNativeBlobUtil_PRE_0.28_DEPDENDENCY}
48-
}
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'maven'
3+
4+
def safeExtGet(prop, fallback) {
5+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
6+
}
7+
8+
repositories {
9+
mavenCentral()
10+
mavenLocal()
11+
maven {
12+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
13+
url "$rootDir/../node_modules/react-native/android"
14+
}
15+
maven {
16+
// Android JSC is installed from npm
17+
url "$rootDir/../node_modules/jsc-android/dist"
18+
}
19+
google()
20+
jcenter()
21+
}
22+
23+
buildscript {
24+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
25+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
26+
// module dependency in an application project.
27+
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
28+
if (project == rootProject) {
29+
repositories {
30+
google()
31+
jcenter()
32+
}
33+
dependencies {
34+
classpath 'com.android.tools.build:gradle:4.1.0'
35+
}
36+
}
37+
}
38+
39+
android {
40+
compileSdkVersion safeExtGet('compileSdkVersion', 30)
41+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
42+
defaultConfig {
43+
minSdkVersion safeExtGet('minSdkVersion', 16)
44+
targetSdkVersion safeExtGet('targetSdkVersion', 30)
45+
versionCode 1
46+
versionName "1.0"
47+
}
48+
buildTypes {
49+
release {
50+
minifyEnabled false
51+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
52+
}
53+
}
54+
productFlavors {
55+
}
56+
}
57+
58+
dependencies {
59+
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
60+
implementation 'com.squareup.okhttp3:okhttp:+'
61+
implementation 'com.squareup.okhttp3:logging-interceptor:+'
62+
implementation 'com.squareup.okhttp3:okhttp-urlconnection:+'
63+
// {ReactNativeBlobUtil_PRE_0.28_DEPDENDENCY}
64+
}
65+
66+
def configureReactNativePom(def pom) {
67+
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
68+
69+
pom.project {
70+
name packageJson.title
71+
artifactId packageJson.name
72+
version = packageJson.version
73+
group = "com.ReactNativeBlobUtil"
74+
description packageJson.description
75+
url packageJson.repository.baseUrl
76+
77+
licenses {
78+
license {
79+
name packageJson.license
80+
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
81+
distribution 'repo'
82+
}
83+
}
84+
85+
developers {
86+
developer {
87+
id packageJson.author.username
88+
name packageJson.author.name
89+
}
90+
}
91+
}
92+
}
93+
94+
afterEvaluate { project ->
95+
// some Gradle build hooks ref:
96+
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
97+
task androidJavadoc(type: Javadoc) {
98+
source = android.sourceSets.main.java.srcDirs
99+
classpath += files(android.bootClasspath)
100+
classpath += files(project.getConfigurations().getByName('compile').asList())
101+
include '**/*.java'
102+
}
103+
104+
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
105+
classifier = 'javadoc'
106+
from androidJavadoc.destinationDir
107+
}
108+
109+
task androidSourcesJar(type: Jar) {
110+
classifier = 'sources'
111+
from android.sourceSets.main.java.srcDirs
112+
include '**/*.java'
113+
}
114+
115+
android.libraryVariants.all { variant ->
116+
def name = variant.name.capitalize()
117+
def javaCompileTask = variant.javaCompileProvider.get()
118+
119+
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
120+
from javaCompileTask.destinationDir
121+
}
122+
}
123+
124+
artifacts {
125+
archives androidSourcesJar
126+
archives androidJavadocJar
127+
}
128+
129+
task installArchives(type: Upload) {
130+
configuration = configurations.archives
131+
repositories.mavenDeployer {
132+
// Deploy to react-native-event-bridge/maven, ready to publish to npm
133+
repository url: "file://${projectDir}/../android/maven"
134+
configureReactNativePom pom
135+
}
136+
}
137+
}

0 commit comments

Comments
 (0)