mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-11-01 05:43:11 +08:00 
			
		
		
		
	support to Expo (#486)
* support to Expo * update * update * update --------- Co-authored-by: Steven <steven@Stevens-MacBook-Pro.local>
This commit is contained in:
		| @@ -22,14 +22,42 @@ def supportsNamespace() { | ||||
|   return major >= 8 | ||||
| } | ||||
|  | ||||
| def isExpoProject() { | ||||
|     def hasExpoModulesCore = rootProject.subprojects.any { it.name == 'expo-modules-core' } | ||||
|  | ||||
|     def packageJsonFile = new File(rootProject.projectDir.parentFile, 'package.json') | ||||
|     def hasExpoDependency = false | ||||
|     if (packageJsonFile.exists()) { | ||||
|         def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text) | ||||
|         hasExpoDependency = (packageJson.dependencies?.expo != null) ||  | ||||
|                            (packageJson.devDependencies?.expo != null) | ||||
|     } | ||||
|      | ||||
|     return hasExpoModulesCore || hasExpoDependency | ||||
| } | ||||
|  | ||||
| def expoProject = isExpoProject() | ||||
|  | ||||
| apply plugin: 'com.android.library' | ||||
| if (isNewArchitectureEnabled()) { | ||||
|     apply plugin: 'com.facebook.react' | ||||
| } | ||||
|  | ||||
| if (expoProject) { | ||||
|     group = 'expo.modules.pushy' | ||||
|     version = '1.0.0' | ||||
|  | ||||
|     def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") | ||||
|     apply from: expoModulesCorePlugin | ||||
|     applyKotlinExpoModulesCorePlugin() | ||||
|     useCoreDependencies() | ||||
|     useExpoPublishing() | ||||
| } else { | ||||
|     group = 'cn.reactnative.modules.update' | ||||
|     version = '1.0.0' | ||||
| } | ||||
|  | ||||
| android { | ||||
|  | ||||
|     if (supportsNamespace()) { | ||||
|         namespace "cn.reactnative.modules.update" | ||||
|  | ||||
| @@ -41,7 +69,6 @@ android { | ||||
|     } | ||||
|     compileSdkVersion safeExtGet('compileSdkVersion', 28) | ||||
|     buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') | ||||
|  | ||||
|     defaultConfig { | ||||
|         minSdkVersion safeExtGet('minSdkVersion', 16) | ||||
|         targetSdkVersion safeExtGet('targetSdkVersion', 27) | ||||
| @@ -50,6 +77,7 @@ android { | ||||
|         consumerProguardFiles "proguard.pro" | ||||
|         buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||||
|     } | ||||
|      | ||||
|     sourceSets { | ||||
|         main { | ||||
|             // let gradle pack the shared library into apk | ||||
| @@ -59,6 +87,12 @@ android { | ||||
|             } else { | ||||
|                 java.srcDirs += ['src/oldarch'] | ||||
|             } | ||||
|              | ||||
|             if (expoProject) { | ||||
|                 java.srcDirs += ['java/expo/modules/pushy'] | ||||
|             } else { | ||||
|                 java.exclude 'expo/modules/pushy/**' | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -70,6 +104,10 @@ android { | ||||
|             resValue("string", "pushy_build_time", "0") | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     lintOptions { | ||||
|         abortOnError false | ||||
|     } | ||||
| } | ||||
|  | ||||
| repositories { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 波仔糕
					波仔糕