Browse Source

getting there

Guy Carmeli 8 years ago
parent
commit
a8649d70ca

+ 6
- 0
example-redux/.buckconfig View File

@@ -0,0 +1,6 @@
1
+
2
+[android]
3
+  target = Google Inc.:Google APIs:23
4
+
5
+[maven_repositories]
6
+  central = https://repo1.maven.org/maven2

+ 37
- 6
example-redux/.flowconfig View File

@@ -15,11 +15,8 @@
15 15
 # Ignore react and fbjs where there are overlaps, but don't ignore
16 16
 # anything that react-native relies on
17 17
 .*/node_modules/fbjs/lib/Map.js
18
-.*/node_modules/fbjs/lib/Promise.js
19 18
 .*/node_modules/fbjs/lib/fetch.js
20 19
 .*/node_modules/fbjs/lib/ExecutionEnvironment.js
21
-.*/node_modules/fbjs/lib/isEmpty.js
22
-.*/node_modules/fbjs/lib/crc32.js
23 20
 .*/node_modules/fbjs/lib/ErrorUtils.js
24 21
 
25 22
 # Flow has a built-in definition for the 'react' module which we prefer to use
@@ -28,6 +25,11 @@
28 25
 .*/node_modules/react/lib/React.js
29 26
 .*/node_modules/react/lib/ReactDOM.js
30 27
 
28
+.*/__mocks__/.*
29
+.*/__tests__/.*
30
+
31
+.*/commoner/test/source/widget/share.js
32
+
31 33
 # Ignore commoner tests
32 34
 .*/node_modules/commoner/test/.*
33 35
 
@@ -40,14 +42,43 @@
40 42
 # Ignore Website
41 43
 .*/website/.*
42 44
 
45
+# Ignore generators
46
+.*/local-cli/generator.*
47
+
48
+# Ignore BUCK generated folders
49
+.*\.buckd/
50
+
51
+.*/node_modules/is-my-json-valid/test/.*\.json
52
+.*/node_modules/iconv-lite/encodings/tables/.*\.json
53
+.*/node_modules/y18n/test/.*\.json
54
+.*/node_modules/spdx-license-ids/spdx-license-ids.json
55
+.*/node_modules/spdx-exceptions/index.json
56
+.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
57
+.*/node_modules/resolve/lib/core.json
58
+.*/node_modules/jsonparse/samplejson/.*\.json
59
+.*/node_modules/json5/test/.*\.json
60
+.*/node_modules/ua-parser-js/test/.*\.json
61
+.*/node_modules/builtin-modules/builtin-modules.json
62
+.*/node_modules/binary-extensions/binary-extensions.json
63
+.*/node_modules/url-regex/tlds.json
64
+.*/node_modules/joi/.*\.json
65
+.*/node_modules/isemail/.*\.json
66
+.*/node_modules/tr46/.*\.json
67
+
68
+
43 69
 [include]
44 70
 
45 71
 [libs]
46 72
 node_modules/react-native/Libraries/react-native/react-native-interface.js
73
+node_modules/react-native/flow
74
+flow/
47 75
 
48 76
 [options]
49 77
 module.system=haste
50 78
 
79
+esproposal.class_static_fields=enable
80
+esproposal.class_instance_fields=enable
81
+
51 82
 munge_underscores=true
52 83
 
53 84
 module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
@@ -57,9 +88,9 @@ suppress_type=$FlowIssue
57 88
 suppress_type=$FlowFixMe
58 89
 suppress_type=$FixMe
59 90
 
60
-suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
61
-suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
91
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
92
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
62 93
 suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
63 94
 
64 95
 [version]
65
-0.21.0
96
+0.23.0

+ 6
- 0
example-redux/.gitignore View File

@@ -32,3 +32,9 @@ local.properties
32 32
 #
33 33
 node_modules/
34 34
 npm-debug.log
35
+
36
+# BUCK
37
+buck-out/
38
+\.buckd/
39
+android/app/libs
40
+android/keystores/debug.keystore

+ 66
- 0
example-redux/android/app/BUCK View File

@@ -0,0 +1,66 @@
1
+import re
2
+
3
+# To learn about Buck see [Docs](https://buckbuild.com/).
4
+# To run your application with Buck:
5
+# - install Buck
6
+# - `npm start` - to start the packager
7
+# - `cd android`
8
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
9
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
10
+# - `buck install -r android/app` - compile, install and run application
11
+#
12
+
13
+lib_deps = []
14
+for jarfile in glob(['libs/*.jar']):
15
+  name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
16
+  lib_deps.append(':' + name)
17
+  prebuilt_jar(
18
+    name = name,
19
+    binary_jar = jarfile,
20
+  )
21
+
22
+for aarfile in glob(['libs/*.aar']):
23
+  name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
24
+  lib_deps.append(':' + name)
25
+  android_prebuilt_aar(
26
+    name = name,
27
+    aar = aarfile,
28
+  )
29
+
30
+android_library(
31
+  name = 'all-libs',
32
+  exported_deps = lib_deps
33
+)
34
+
35
+android_library(
36
+  name = 'app-code',
37
+  srcs = glob([
38
+    'src/main/java/**/*.java',
39
+  ]),
40
+  deps = [
41
+    ':all-libs',
42
+    ':build_config',
43
+    ':res',
44
+  ],
45
+)
46
+
47
+android_build_config(
48
+  name = 'build_config',
49
+  package = 'com.exampleredux',
50
+)
51
+
52
+android_resource(
53
+  name = 'res',
54
+  res = 'src/main/res',
55
+  package = 'com.exampleredux',
56
+)
57
+
58
+android_binary(
59
+  name = 'app',
60
+  package_type = 'debug',
61
+  manifest = 'src/main/AndroidManifest.xml',
62
+  keystore = '//android/keystores:debug',
63
+  deps = [
64
+    ':app-code',
65
+  ],
66
+)

+ 9
- 2
example-redux/android/app/build.gradle View File

@@ -9,7 +9,7 @@ import com.android.build.OutputFile
9 9
  * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 10
  * bundle directly from the development server. Below you can see all the possible configurations
11 11
  * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
- * `apply from: "react.gradle"` line.
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 13
  *
14 14
  * project.ext.react = [
15 15
  *   // the name of the generated asset file containing your JS bundle
@@ -59,7 +59,7 @@ import com.android.build.OutputFile
59 59
  * ]
60 60
  */
61 61
 
62
-apply from: "react.gradle"
62
+apply from: "../../node_modules/react-native/react.gradle"
63 63
 
64 64
 /**
65 65
  * Set this to true to create two separate APKs instead of one:
@@ -127,3 +127,10 @@ dependencies {
127 127
     releaseCompile project(path: ':react-native-navigation', configuration: 'libraryRelease')
128 128
 //    compile project(':react-native-navigation')
129 129
 }
130
+
131
+// Run this once to be able to run the application with BUCK
132
+// puts all compile dependencies into folder libs for BUCK to use
133
+task copyDownloadableDepsToLibs(type: Copy) {
134
+  from configurations.compile
135
+  into 'libs'
136
+}

+ 0
- 4
example-redux/android/app/proguard-rules.pro View File

@@ -61,7 +61,3 @@
61 61
 -dontwarn java.nio.file.*
62 62
 -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
63 63
 -dontwarn okio.**
64
-
65
-# stetho
66
-
67
--dontwarn com.facebook.stetho.**