Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Adds Maven Support For Gradle Dependency [xx] #577

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
README
======

Steps before publishing a new version to npm:

1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
```
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
sdk.dir=/Users/{username}/Library/Android/sdk
```
3. Delete the `maven` folder
4. Run `sudo ./gradlew installArchives`
5. Verify that latest set of generated files is in the maven folder with the correct version number

94 changes: 93 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}

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

def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_BUILD_TOOLS_VERSION = "26.0.2"
Expand All @@ -19,6 +31,86 @@ android {
}
}

repositories {
google()
jcenter()
maven {
url "$projectDir/../node_modules/react-native/android"
}
mavenCentral()
}

dependencies {
compileOnly 'com.facebook.react:react-native:+'
}
}

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

pom.project {
name "React Native Sound"
artifactId packageJson.name
version = packageJson.version
group = "com.zmxv.RNSound"
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 'zmxv'
name packageJson.author.name
}
}
}
}

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
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
60106aaefd1651dfce923a4471716e21
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd52b4d751cec99c67422ad6a7a4eba7d8d347e6
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1bcef3718951fc026eccd47926697f4d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2855b2257d3f4a718bd4863ca57a7cd9562091aa
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
203e4fc952c468155bb4b9e689270736
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c48e14575bba63f2e3f271f0e56070745239a79d
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zmxv.RNSound</groupId>
<artifactId>react-native-sound</artifactId>
<version>0.10.12</version>
<packaging>aar</packaging>
<name>React Native Sound</name>
<description>React Native module for playing sound clips on iOS, Android, and Windows</description>
<url>null</url>
<licenses>
<license>
<name>MIT</name>
<url>null/blob/master/null</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>zmxv</id>
<name>Zhen Wang (http://blog.zmxv.com)</name>
</developer>
</developers>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cc939039245e899b4bc7457de3c3e6cf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53f0cb9cfd309dfd902d2f6690f2d4b805db62f3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.zmxv.RNSound</groupId>
<artifactId>react-native-sound</artifactId>
<versioning>
<release>0.10.12</release>
<versions>
<version>0.10.12</version>
</versions>
<lastUpdated>20190614175543</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
79e5fc5cdd7143aaabc5561945558b4c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e17070c134bc996b14a099b3f807b581da900a90
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@
"android",
"windows"
],
"author": "Zhen Wang <[email protected]> (http://blog.zmxv.com)",
"author": {
"name": "Zhen Wang (http://blog.zmxv.com)",
"email": "[email protected]"
},
"license": "MIT",
"devDependencies": {
"glob": "^7.1.4",
"promisify-child-process": "^3.1.1"
},
"peerDependencies": {
"react-native": ">=0.8.0"
},
"scripts": {
"clang-format": "node scripts/clang-format.js",
"clang-format:check": "node scripts/clang-format.js --check"
},
"devDependencies": {
"glob": "^7.1.4",
"promisify-child-process": "^3.1.1"
},
"files": [
"**/*.@(js|ts)",
"*.podspec",
Expand Down