-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(updated): update example react-native version to 0.70.5, update b…
…uild.gradle
- Loading branch information
Showing
63 changed files
with
3,400 additions
and
2,612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,140 @@ | ||
buildscript { | ||
if (project == rootProject) { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.5.3' | ||
} | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.5.3' | ||
} | ||
} | ||
|
||
def isNewArchitectureEnabled() { | ||
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
if (isNewArchitectureEnabled()) { | ||
apply plugin: 'com.facebook.react' | ||
} | ||
|
||
def getExtOrDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['EscPosPrinter_' + name] | ||
} | ||
|
||
def getExtOrIntegerDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['EscPosPrinter_' + name]).toInteger() | ||
} | ||
|
||
android { | ||
compileSdkVersion safeExtGet('EscPosPrinter_compileSdkVersion', 29) | ||
buildToolsVersion safeExtGet('EscPosPrinter_buildToolsVersion', '29.0.2') | ||
defaultConfig { | ||
minSdkVersion safeExtGet('EscPosPrinter_minSdkVersion', 16) | ||
targetSdkVersion safeExtGet('EscPosPrinter_targetSdkVersion', 29) | ||
versionCode 1 | ||
versionName "1.0" | ||
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') | ||
|
||
defaultConfig { | ||
minSdkVersion getExtOrIntegerDefault('minSdkVersion') | ||
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
} | ||
} | ||
|
||
lintOptions { | ||
disable 'GradleCompatible' | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
} | ||
} | ||
lintOptions { | ||
disable 'GradleCompatible' | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
google() | ||
|
||
def found = false | ||
def defaultDir = null | ||
def androidSourcesName = 'React Native sources' | ||
|
||
if (rootProject.ext.has('reactNativeAndroidRoot')) { | ||
defaultDir = rootProject.ext.get('reactNativeAndroidRoot') | ||
} else { | ||
defaultDir = new File( | ||
projectDir, | ||
'/../../../node_modules/react-native/android' | ||
) | ||
} | ||
|
||
if (defaultDir.exists()) { | ||
maven { | ||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
url("$rootDir/../node_modules/react-native/android") | ||
url defaultDir.toString() | ||
name androidSourcesName | ||
} | ||
google() | ||
jcenter() | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") | ||
found = true | ||
} else { | ||
def parentDir = rootProject.projectDir | ||
|
||
1.upto(5, { | ||
if (found) return true | ||
parentDir = parentDir.parentFile | ||
|
||
def androidSourcesDir = new File( | ||
parentDir, | ||
'node_modules/react-native' | ||
) | ||
|
||
def androidPrebuiltBinaryDir = new File( | ||
parentDir, | ||
'node_modules/react-native/android' | ||
) | ||
|
||
if (androidPrebuiltBinaryDir.exists()) { | ||
maven { | ||
url androidPrebuiltBinaryDir.toString() | ||
name androidSourcesName | ||
} | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") | ||
found = true | ||
} else if (androidSourcesDir.exists()) { | ||
maven { | ||
url androidSourcesDir.toString() | ||
name androidSourcesName | ||
} | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") | ||
found = true | ||
} | ||
}) | ||
} | ||
|
||
if (!found) { | ||
throw new GradleException( | ||
"${project.name}: unable to locate React Native android sources. " + | ||
"Ensure you have you installed React Native as a dependency in your project and try again." | ||
) | ||
} | ||
} | ||
|
||
|
||
dependencies { | ||
//noinspection GradleDynamicVersion | ||
implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
implementation "com.facebook.react:react-native:+" // From node_modules | ||
implementation 'com.google.android.gms:play-services-location:17.1.0' | ||
implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
implementation "com.facebook.react:react-native:+" | ||
implementation 'com.google.android.gms:play-services-location:17.1.0' | ||
// From node_modules | ||
} | ||
|
||
if (isNewArchitectureEnabled()) { | ||
react { | ||
jsRootDir = file("../src/") | ||
libraryName = "EscPosPrinter" | ||
codegenJavaPackageName = "com.reactnativeescposprinter" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
EscPosPrinter_kotlinVersion=1.7.0 | ||
EscPosPrinter_minSdkVersion=21 | ||
EscPosPrinter_targetSdkVersion=31 | ||
EscPosPrinter_compileSdkVersion=31 | ||
EscPosPrinter_ndkversion=21.4.7075529 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BUNDLE_PATH: "vendor/bundle" | ||
BUNDLE_FORCE_RUBY_PLATFORM: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.7.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
ruby '2.7.5' | ||
|
||
gem 'cocoapods', '~> 1.11', '>= 1.11.2' |
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
example/android/.settings/org.eclipse.buildship.core.prefs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# To learn about Buck see [Docs](https://buckbuild.com/). | ||
# To run your application with Buck: | ||
# - install Buck | ||
# - `npm start` - to start the packager | ||
# - `cd android` | ||
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | ||
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | ||
# - `buck install -r android/app` - compile, install and run application | ||
# | ||
|
||
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") | ||
|
||
lib_deps = [] | ||
|
||
create_aar_targets(glob(["libs/*.aar"])) | ||
|
||
create_jar_targets(glob(["libs/*.jar"])) | ||
|
||
android_library( | ||
name = "all-libs", | ||
exported_deps = lib_deps, | ||
) | ||
|
||
android_library( | ||
name = "app-code", | ||
srcs = glob([ | ||
"src/main/java/**/*.java", | ||
]), | ||
deps = [ | ||
":all-libs", | ||
":build_config", | ||
":res", | ||
], | ||
) | ||
|
||
android_build_config( | ||
name = "build_config", | ||
package = "com.escposprinterexample", | ||
) | ||
|
||
android_resource( | ||
name = "res", | ||
package = "com.escposprinterexample", | ||
res = "src/main/res", | ||
) | ||
|
||
android_binary( | ||
name = "app", | ||
keystore = "//android/keystores:debug", | ||
manifest = "src/main/AndroidManifest.xml", | ||
package_type = "debug", | ||
deps = [ | ||
":app-code", | ||
], | ||
) |
Oops, something went wrong.