Skip to content

Commit 8609578

Browse files
committed
using cocoapods solely to manage native des on iOS.
1 parent 74c00e1 commit 8609578

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3240
-16823
lines changed

.eslintrc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@
22
"extends": [
33
"standard",
44
"plugin:react/recommended"
5-
],
6-
"plugins": ["jest"],
7-
"env": {
8-
"jest/globals": true
9-
}
5+
]
106
}

RNZipArchive.podspec

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ require 'json'
33
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
44

55
Pod::Spec.new do |s|
6-
76
s.name = 'RNZipArchive'
87
s.version = package['version']
98
s.summary = package['description']
@@ -13,14 +12,13 @@ Pod::Spec.new do |s|
1312
s.source = { :git => 'https://github.com/mockingbot/react-native-zip-archive.git', :tag => "#{s.version}"}
1413
s.platform = :ios, '8.0'
1514
s.preserve_paths = '*.js'
16-
s.library = 'z'
1715

1816
s.dependency 'React'
1917
s.dependency 'SSZipArchive', '2.2.2'
18+
s.compiler_flags = '-GCC_PREPROCESSOR_DEFINITIONS="HAVE_INTTYPES_H HAVE_PKCRYPT HAVE_STDINT_H HAVE_WZAES HAVE_ZLIB MZ_ZIP_NO_SIGNING $(inherited)"'
2019

2120
s.subspec 'Core' do |ss|
2221
ss.source_files = 'ios/*.{h,m}'
2322
ss.public_header_files = ['ios/RNZipArchive.h']
2423
end
25-
2624
end

example/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

example/.flowconfig

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,60 +11,66 @@
1111
; Ignore duplicate module providers
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
14-
.*/Libraries/react-native/React.js
15-
14+
node_modules/react-native/Libraries/react-native/React.js
1615
; Ignore polyfills
17-
.*/Libraries/polyfills/.*
18-
19-
; Ignore metro
20-
.*/node_modules/metro/.*
21-
16+
node_modules/react-native/Libraries/polyfills/.*
17+
; These should not be required directly
18+
; require from fbjs/lib instead: require('fbjs/lib/warning')
19+
node_modules/warning/.*
20+
; Flow doesn't support platforms
21+
.*/Libraries/Utilities/HMRLoadingView.js
22+
[untyped]
23+
.*/node_modules/@react-native-community/cli/.*/.*
2224
[include]
23-
2425
[libs]
2526
node_modules/react-native/Libraries/react-native/react-native-interface.js
2627
node_modules/react-native/flow/
27-
node_modules/react-native/flow-github/
28-
2928
[options]
3029
emoji=true
31-
3230
esproposal.optional_chaining=enable
3331
esproposal.nullish_coalescing=enable
34-
32+
module.file_ext=.js
33+
module.file_ext=.json
34+
module.file_ext=.ios.js
3535
module.system=haste
3636
module.system.haste.use_name_reducers=true
3737
# get basename
38-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39-
# strip .js or .js.flow suffix
40-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41-
# strip .ios suffix
42-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
4438
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
4539
module.system.haste.paths.blacklist=.*/__tests__/.*
4640
module.system.haste.paths.blacklist=.*/__mocks__/.*
47-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
4841
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
49-
42+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
43+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
44+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
45+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
5046
munge_underscores=true
51-
5247
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
53-
54-
module.file_ext=.js
55-
module.file_ext=.jsx
56-
module.file_ext=.json
57-
module.file_ext=.native.js
58-
5948
suppress_type=$FlowIssue
6049
suppress_type=$FlowFixMe
6150
suppress_type=$FlowFixMeProps
6251
suppress_type=$FlowFixMeState
63-
64-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
65-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
66-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
52+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
53+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
6754
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
68-
55+
[lints]
56+
sketchy-null-number=warn
57+
sketchy-null-mixed=warn
58+
sketchy-number=warn
59+
untyped-type-import=warn
60+
nonstrict-import=warn
61+
deprecated-type=warn
62+
unsafe-getters-setters=warn
63+
inexact-spread=warn
64+
unnecessary-invariant=warn
65+
signature-verification-failure=warn
66+
deprecated-utility=error
67+
[strict]
68+
deprecated-type
69+
nonstrict-import
70+
sketchy-null
71+
unclear-type
72+
unsafe-getters-setters
73+
untyped-import
74+
untyped-type-import
6975
[version]
70-
^0.86.0
76+
^0.98.0

example/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ buck-out/
5454

5555
# Bundle artifact
5656
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

example/Example.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { Component } from 'react'
22
import {
33
StyleSheet, View,
4-
Alert, WebView, Platform
4+
Alert, Platform
55
} from 'react-native'
6+
import WebView from 'react-native-webview'
67
import {
78
ANIMATIONS_SLIDE,
89
CustomTabs

example/__tests__/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* @format
3-
* @lint-ignore-every XPLATJSCOPYRIGHT1
43
*/
54

65
import 'react-native';

example/android/app/_BUCK

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.example",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.example",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

example/android/app/build.gradle

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+
* bundleCommand: "ram-bundle",
23+
*
2124
* // whether to bundle JS and assets in debug mode
2225
* bundleInDebug: false,
2326
*
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
7376
*/
7477

7578
project.ext.react = [
76-
entryFile: "index.js"
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
7781
]
7882

7983
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,9 +97,35 @@ def enableSeparateBuildPerCPUArchitecture = false
9397
*/
9498
def enableProguardInReleaseBuilds = false
9599

100+
/**
101+
* The preferred build flavor of JavaScriptCore.
102+
*
103+
* For example, to use the international variant, you can use:
104+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105+
*
106+
* The international variant includes ICU i18n library and necessary data
107+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108+
* give correct results when using with locales other than en-US. Note that
109+
* this variant is about 6MiB larger per architecture than default.
110+
*/
111+
def jscFlavor = 'org.webkit:android-jsc:+'
112+
113+
/**
114+
* Whether to enable the Hermes VM.
115+
*
116+
* This should be set on project.ext.react and mirrored here. If it is not set
117+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118+
* and the benefits of using Hermes will therefore be sharply reduced.
119+
*/
120+
def enableHermes = project.ext.react.get("enableHermes", false);
121+
96122
android {
97123
compileSdkVersion rootProject.ext.compileSdkVersion
98-
buildToolsVersion rootProject.ext.buildToolsVersion
124+
125+
compileOptions {
126+
sourceCompatibility JavaVersion.VERSION_1_8
127+
targetCompatibility JavaVersion.VERSION_1_8
128+
}
99129

100130
defaultConfig {
101131
applicationId "com.example"
@@ -104,46 +134,72 @@ android {
104134
versionCode 1
105135
versionName "1.0"
106136
}
137+
signingConfigs {
138+
debug {
139+
storeFile file('debug.keystore')
140+
storePassword 'android'
141+
keyAlias 'androiddebugkey'
142+
keyPassword 'android'
143+
}
144+
}
107145
splits {
108146
abi {
109147
reset()
110148
enable enableSeparateBuildPerCPUArchitecture
111149
universalApk false // If true, also generate a universal APK
112-
include "armeabi-v7a", "x86", "arm64-v8a"
150+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
113151
}
114152
}
115153
buildTypes {
154+
debug {
155+
debuggable true
156+
signingConfig signingConfigs.debug
157+
}
116158
release {
159+
// Caution! In production, you need to generate your own keystore file.
160+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
161+
signingConfig signingConfigs.debug
117162
minifyEnabled enableProguardInReleaseBuilds
118163
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
119164
}
120-
debug {
121-
debuggable true
122-
}
123165
}
124166
// applicationVariants are e.g. debug, release
125167
applicationVariants.all { variant ->
126168
variant.outputs.each { output ->
127169
// For each separate APK per architecture, set a unique version code as described here:
128-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129-
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
170+
// https://developer.android.com/studio/build/configure-apk-splits.html
171+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
130172
def abi = output.getFilter(OutputFile.ABI)
131173
if (abi != null) { // null for the universal-debug, universal-release variants
132174
output.versionCodeOverride =
133175
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134176
}
177+
135178
}
136179
}
180+
181+
packagingOptions {
182+
pickFirst '**/armeabi-v7a/libc++_shared.so'
183+
pickFirst '**/x86/libc++_shared.so'
184+
pickFirst '**/arm64-v8a/libc++_shared.so'
185+
pickFirst '**/x86_64/libc++_shared.so'
186+
pickFirst '**/x86/libjsc.so'
187+
pickFirst '**/armeabi-v7a/libjsc.so'
188+
}
137189
}
138190

139191
dependencies {
140-
implementation project(':react-native-custom-tabs')
141-
implementation project(':react-native-zip-archive')
142-
implementation project(':react-native-fs')
143-
implementation project(':react-native-document-picker')
144192
implementation fileTree(dir: "libs", include: ["*.jar"])
145-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
193+
implementation 'androidx.appcompat:appcompat:1.0.0'
146194
implementation "com.facebook.react:react-native:+" // From node_modules
195+
196+
if (enableHermes) {
197+
def hermesPath = "../../node_modules/hermesvm/android/";
198+
debugImplementation files(hermesPath + "hermes-debug.aar")
199+
releaseImplementation files(hermesPath + "hermes-release.aar")
200+
} else {
201+
implementation jscFlavor
202+
}
147203
}
148204

149205
// Run this once to be able to run the application with BUCK
@@ -152,3 +208,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
152208
from configurations.compile
153209
into 'libs'
154210
}
211+
212+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

example/android/app/proguard-rules.pro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11-
12-
# If your project uses WebView with JS, uncomment the following
13-
# and specify the fully qualified class name to the JavaScript interface
14-
# class:
15-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16-
# public *;
17-
#}

0 commit comments

Comments
 (0)