Skip to content

Commit

Permalink
fix build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
bebnev committed Feb 11, 2022
1 parent 9762ede commit 3bc1a1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 80 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ local.properties
buck-out/
\.buckd/
*.keystore


example/
85 changes: 7 additions & 78 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
repositories {
google()
jcenter()
}
def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '3.5.3'

dependencies {
classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.5.3')}")
classpath "com.android.tools.build:gradle:$buildGradleVersion"
}
}

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'
apply plugin: 'maven'

android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
Expand All @@ -38,76 +38,5 @@ repositories {
}

dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
}

def configureReactNativePom(def pom) {
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

pom.project {
name packageJson.title
artifactId packageJson.name
version = packageJson.version
group = "com.bebnev"
description packageJson.description
url packageJson.repository.baseUrl

licenses {
license {
name packageJson.license
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
distribution 'repo'
}
}

developers {
developer {
id packageJson.author
name packageJson.author
}
}
}
}

afterEvaluate { project ->

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 androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
include '**/*.java'
}

android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
from variant.javaCompile.destinationDir
}
}

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
}
}
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-user-agent",
"version": "2.3.0",
"version": "2.3.1",
"description": "Library that helps you to get mobile application user agent and web view user agent strings.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 3bc1a1d

Please sign in to comment.