Skip to content

Commit b669648

Browse files
committed
init
0 parents  commit b669648

Some content is hidden

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

43 files changed

+2268
-0
lines changed

.buckconfig

+6
Original file line numberDiff line numberDiff line change
@@ -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

.flowconfig

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[ignore]
2+
3+
# We fork some components by platform.
4+
.*/*.android.js
5+
6+
# Ignore templates with `@flow` in header
7+
.*/local-cli/generator.*
8+
9+
# Ignore malformed json
10+
.*/node_modules/y18n/test/.*\.json
11+
12+
[include]
13+
14+
[libs]
15+
node_modules/react-native/Libraries/react-native/react-native-interface.js
16+
node_modules/react-native/flow
17+
flow/
18+
19+
[options]
20+
module.system=haste
21+
22+
esproposal.class_static_fields=enable
23+
esproposal.class_instance_fields=enable
24+
25+
experimental.strict_type_args=true
26+
27+
munge_underscores=true
28+
29+
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
30+
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'
31+
32+
suppress_type=$FlowIssue
33+
suppress_type=$FlowFixMe
34+
suppress_type=$FixMe
35+
36+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
37+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
38+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
39+
40+
[version]
41+
^0.27.0

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IJ
26+
#
27+
*.iml
28+
.idea
29+
.gradle
30+
local.properties
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
37+
# BUCK
38+
buck-out/
39+
\.buckd/
40+
android/app/libs
41+
android/keystores/debug.keystore

.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# a simple rn project for myself

android/app/BUCK

+66
Original file line numberDiff line numberDiff line change
@@ -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.rnproject',
50+
)
51+
52+
android_resource(
53+
name = 'res',
54+
res = 'src/main/res',
55+
package = 'com.rnproject',
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+
)

android/app/build.gradle

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
apply plugin: "com.android.application"
2+
3+
import com.android.build.OutputFile
4+
5+
/**
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
8+
* These basically call `react-native bundle` with the correct arguments during the Android build
9+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+
* bundle directly from the development server. Below you can see all the possible configurations
11+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
13+
*
14+
* project.ext.react = [
15+
* // the name of the generated asset file containing your JS bundle
16+
* bundleAssetName: "index.android.bundle",
17+
*
18+
* // the entry file for bundle generation
19+
* entryFile: "index.android.js",
20+
*
21+
* // whether to bundle JS and assets in debug mode
22+
* bundleInDebug: false,
23+
*
24+
* // whether to bundle JS and assets in release mode
25+
* bundleInRelease: true,
26+
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property can be in the following formats
30+
* // 'bundleIn${productFlavor}${buildType}'
31+
* // 'bundleIn${buildType}'
32+
* // bundleInFreeDebug: true,
33+
* // bundleInPaidRelease: true,
34+
* // bundleInBeta: true,
35+
*
36+
* // the root of your project, i.e. where "package.json" lives
37+
* root: "../../",
38+
*
39+
* // where to put the JS bundle asset in debug mode
40+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
41+
*
42+
* // where to put the JS bundle asset in release mode
43+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
44+
*
45+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
46+
* // require('./image.png')), in debug mode
47+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
48+
*
49+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
50+
* // require('./image.png')), in release mode
51+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
52+
*
53+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
54+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
55+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
56+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
57+
* // for example, you might want to remove it from here.
58+
* inputExcludes: ["android/**", "ios/**"],
59+
*
60+
* // override which node gets called and with what additional arguments
61+
* nodeExecutableAndArgs: ["node"]
62+
*
63+
* // supply additional arguments to the packager
64+
* extraPackagerArgs: []
65+
* ]
66+
*/
67+
68+
apply from: "../../node_modules/react-native/react.gradle"
69+
70+
/**
71+
* Set this to true to create two separate APKs instead of one:
72+
* - An APK that only works on ARM devices
73+
* - An APK that only works on x86 devices
74+
* The advantage is the size of the APK is reduced by about 4MB.
75+
* Upload all the APKs to the Play Store and people will download
76+
* the correct one based on the CPU architecture of their device.
77+
*/
78+
def enableSeparateBuildPerCPUArchitecture = false
79+
80+
/**
81+
* Run Proguard to shrink the Java bytecode in release builds.
82+
*/
83+
def enableProguardInReleaseBuilds = false
84+
85+
android {
86+
compileSdkVersion 23
87+
buildToolsVersion "23.0.1"
88+
89+
defaultConfig {
90+
applicationId "com.rnproject"
91+
minSdkVersion 16
92+
targetSdkVersion 22
93+
versionCode 1
94+
versionName "1.0"
95+
ndk {
96+
abiFilters "armeabi-v7a", "x86"
97+
}
98+
}
99+
signingConfigs {
100+
release {
101+
storeFile file(MYAPP_RELEASE_STORE_FILE)
102+
storePassword MYAPP_RELEASE_STORE_PASSWORD
103+
keyAlias MYAPP_RELEASE_KEY_ALIAS
104+
keyPassword MYAPP_RELEASE_KEY_PASSWORD
105+
}
106+
}
107+
splits {
108+
abi {
109+
reset()
110+
enable enableSeparateBuildPerCPUArchitecture
111+
universalApk false // If true, also generate a universal APK
112+
include "armeabi-v7a", "x86"
113+
}
114+
}
115+
buildTypes {
116+
release {
117+
minifyEnabled enableProguardInReleaseBuilds
118+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
119+
signingConfig signingConfigs.release
120+
}
121+
}
122+
// applicationVariants are e.g. debug, release
123+
applicationVariants.all { variant ->
124+
variant.outputs.each { output ->
125+
// For each separate APK per architecture, set a unique version code as described here:
126+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
127+
def versionCodes = ["armeabi-v7a":1, "x86":2]
128+
def abi = output.getFilter(OutputFile.ABI)
129+
if (abi != null) { // null for the universal-debug, universal-release variants
130+
output.versionCodeOverride =
131+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
132+
}
133+
}
134+
}
135+
}
136+
137+
dependencies {
138+
compile fileTree(dir: "libs", include: ["*.jar"])
139+
compile "com.android.support:appcompat-v7:23.0.1"
140+
compile "com.facebook.react:react-native:+" // From node_modules
141+
}
142+
143+
// Run this once to be able to run the application with BUCK
144+
// puts all compile dependencies into folder libs for BUCK to use
145+
task copyDownloadableDepsToLibs(type: Copy) {
146+
from configurations.compile
147+
into 'libs'
148+
}

android/app/my-release-key.keystore

2.17 KB
Binary file not shown.

android/app/proguard-rules.pro

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# 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+
#}
18+
19+
# Disabling obfuscation is useful if you collect stack traces from production crashes
20+
# (unless you are using a system that supports de-obfuscate the stack traces).
21+
-dontobfuscate
22+
23+
# React Native
24+
25+
# Keep our interfaces so they can be used by other ProGuard rules.
26+
# See http://sourceforge.net/p/proguard/bugs/466/
27+
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28+
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29+
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30+
31+
# Do not strip any method/class that is annotated with @DoNotStrip
32+
-keep @com.facebook.proguard.annotations.DoNotStrip class *
33+
-keep @com.facebook.common.internal.DoNotStrip class *
34+
-keepclassmembers class * {
35+
@com.facebook.proguard.annotations.DoNotStrip *;
36+
@com.facebook.common.internal.DoNotStrip *;
37+
}
38+
39+
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40+
void set*(***);
41+
*** get*();
42+
}
43+
44+
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45+
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
46+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
47+
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
48+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
49+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
50+
51+
-dontwarn com.facebook.react.**
52+
53+
# okhttp
54+
55+
-keepattributes Signature
56+
-keepattributes *Annotation*
57+
-keep class okhttp3.** { *; }
58+
-keep interface okhttp3.** { *; }
59+
-dontwarn okhttp3.**
60+
61+
# okio
62+
63+
-keep class sun.misc.Unsafe { *; }
64+
-dontwarn java.nio.file.*
65+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
66+
-dontwarn okio.**

0 commit comments

Comments
 (0)