Skip to content

Commit

Permalink
fix build gradle in prep for rn upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
aleccolville committed Jul 25, 2022
1 parent 20c278c commit 4ab96d6
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 72 deletions.
143 changes: 72 additions & 71 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ buildscript {
}

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

// Matches values in recent template from React Native 0.59 / 0.60
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9
Expand Down Expand Up @@ -70,73 +70,74 @@ dependencies {
implementation 'com.matheranalytics:listener-tracker:1.0.12' // mather analytics
}

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.matejdr.matheranalytics"
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.username
name packageJson.author.name
}
}
}
}

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 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
}
}
}
// 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.matejdr.matheranalytics"
// 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.username
// name packageJson.author.name
// }
// }
// }
// }

// 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 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
// }
// }
// }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-mather-analytics",
"title": "React Native Mather Analytics",
"version": "1.1.3",
"version": "1.1.4",
"description": "NZME React Native implementation for mather analytics tracking",
"types": "./types/index.d.ts",
"main": "./lib/index.js",
Expand Down

0 comments on commit 4ab96d6

Please sign in to comment.