@@ -22,14 +22,42 @@ def supportsNamespace() {
2222 return major >= 8
2323}
2424
25+ def isExpoProject () {
26+ def hasExpoModulesCore = rootProject. subprojects. any { it. name == ' expo-modules-core' }
27+
28+ def packageJsonFile = new File (rootProject. projectDir. parentFile, ' package.json' )
29+ def hasExpoDependency = false
30+ if (packageJsonFile. exists()) {
31+ def packageJson = new groovy.json.JsonSlurper (). parseText(packageJsonFile. text)
32+ hasExpoDependency = (packageJson. dependencies?. expo != null ) ||
33+ (packageJson. devDependencies?. expo != null )
34+ }
35+
36+ return hasExpoModulesCore || hasExpoDependency
37+ }
38+
39+ def expoProject = isExpoProject()
40+
2541apply plugin : ' com.android.library'
2642if (isNewArchitectureEnabled()) {
2743 apply plugin : ' com.facebook.react'
2844}
2945
46+ if (expoProject) {
47+ group = ' expo.modules.pushy'
48+ version = ' 1.0.0'
3049
31- android {
50+ def expoModulesCorePlugin = new File (project(" :expo-modules-core" ). projectDir. absolutePath, " ExpoModulesCorePlugin.gradle" )
51+ apply from : expoModulesCorePlugin
52+ applyKotlinExpoModulesCorePlugin()
53+ useCoreDependencies()
54+ useExpoPublishing()
55+ } else {
56+ group = ' cn.reactnative.modules.update'
57+ version = ' 1.0.0'
58+ }
3259
60+ android {
3361 if (supportsNamespace()) {
3462 namespace " cn.reactnative.modules.update"
3563
@@ -41,7 +69,6 @@ android {
4169 }
4270 compileSdkVersion safeExtGet(' compileSdkVersion' , 28 )
4371 buildToolsVersion safeExtGet(' buildToolsVersion' , ' 28.0.3' )
44-
4572 defaultConfig {
4673 minSdkVersion safeExtGet(' minSdkVersion' , 16 )
4774 targetSdkVersion safeExtGet(' targetSdkVersion' , 27 )
@@ -50,6 +77,7 @@ android {
5077 consumerProguardFiles " proguard.pro"
5178 buildConfigField " boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString()
5279 }
80+
5381 sourceSets {
5482 main {
5583 // let gradle pack the shared library into apk
@@ -59,17 +87,28 @@ android {
5987 } else {
6088 java. srcDirs + = [' src/oldarch' ]
6189 }
90+
91+ if (expoProject) {
92+ java. srcDirs + = [' java/expo/modules/pushy' ]
93+ } else {
94+ java. exclude ' expo/modules/pushy/**'
95+ }
6296 }
6397 }
6498
6599 buildTypes {
66100 release {
67- resValue(" string" , " pushy_build_time" , " ${ minutesSinceEpoch} " )
101+ // resValue("string", "pushy_build_time", "${minutesSinceEpoch}")
102+ resValue(" string" , " pushy_build_time" , " 29042093" )
68103 }
69104 debug {
70105 resValue(" string" , " pushy_build_time" , " 0" )
71106 }
72107 }
108+
109+ lintOptions {
110+ abortOnError false
111+ }
73112}
74113
75114repositories {
0 commit comments