You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-30Lines changed: 20 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,34 +62,6 @@ There are two type of dependencies that can be passed:
62
62
## Adding all implements for generic types
63
63
There is an option **all-generic-implements** which is disabled by default which controls whether to add implements for all interfaces (if they are more than one) to generic type declarations. The problem is that in most of the cases one of those interfaces is actually an extend, so it should be manual reviewed and fixed after generation.
64
64
65
-
## Android support specifics
66
-
One of the ways to get the android support jar files is to follow the steps bellow:
67
-
68
-
1. Create a NativeScript application - `tns create android-support-files`
3. Open **platforms/android/app/build.graddle** file and locate the **explodeAar** task
71
-
4. Add a print on the first line of the task `println "${compileDependency} copied to ${outputDir}"`
72
-
5. Run `tns build android` and look for the lines from the output above
73
-
6. Search for all files containing **android/support** or **android.support** in their path and get their corresponding jar files from the **platform/android/app/build/exploded-dependencies** folder
74
-
7. To generate android support typings run the tool passing all the files from above
75
-
8. You can find the **jar** files for android support 27.0.1 in [the current repository](libs/android-support/27.0.1)
76
-
77
-
As the android support needs the base android jar file to create its typings you need to pass the android.jar file as a **super** parameter to the generator. To avoid having typings for every different API level you can reuse typings built with API level 17 for all API levels until 23. It's quite easy to test this:
78
-
79
-
1. Run the typings generator for android support passing **android-17/android.jar** as a supper jar
80
-
2. Add `/// <reference path="android-17.d.ts"/>` at the top of the generated typings file where android-17.d.ts is the typings file of the android API level 17
81
-
3. Run `tsc` passing the generated typings file and there shouldn't be errors
82
-
4. Now start replacing the reference file with the files from other API level while the `tsc` execution completes with no error
83
-
5. If there's an error this means that you need to generate the android support typings with the same android API level super jar
84
-
85
-
By repeating the steps above we've found that:
86
-
87
-
- Android support 17 typings(built with supper jar from android API 17) can be reused until android API 22
88
-
- Android support 23 typings(built with supper jar from android API 23) can be reused until android API 25
89
-
- Android support 26 typings(built with supper jar from android API 26) can be reused for API 26 and 27
90
-
91
-
The corresponding typings files can be found in the [tns-platform-declarations](https://github.com/NativeScript/NativeScript/tree/master/tns-platform-declarations) package. The repo's [Makefile](Makefile) can be used as a reference for creating these typings files
92
-
93
65
## Finding package dependencies
94
66
If you want to generate typings of a package but you are not sure how you can get all the needed dependencies you can follow the steps bellow:
95
67
@@ -114,11 +86,29 @@ If you want to generate typings of a package but you are not sure how you can ge
114
86
./gradlew extractAllJars
115
87
```
116
88
117
-
5. The command above will get the needed jar files for your dependency and will output them in the [dts-generator/jar-files](dts-generator/jar-files) folder
89
+
5. The command above will get the needed jar files for your dependency and will output them in the [dts-generator/jar-files](dts-generator/jar-files) folder (or you can optionaly pass another output folder `-PjarsOutput=another-folder`)
118
90
6. You can run the following command to check what are the dependencies between the packages:
7. Run the dts-generator tool passing as **input** arguments the jar files for the needed package from the [dts-generator/jar-files](dts-generator/jar-files) folder
96
+
7. Run the dts-generator tool passing as **input** arguments the path to the output jars folder
97
+
98
+
## Android support specifics
99
+
To get all the jar files for android support follow the steps above. You can find the **jar** files for android support 27.0.1 in [the current repository](libs/android-support/27.0.1)
100
+
As the android support needs the base android jar file to create its typings you need to pass the android.jar file as a **super** parameter to the generator. To avoid having typings for every different API level you can reuse typings built with API level 17 for all API levels until 23. It's quite easy to test this:
101
+
102
+
1. Run the typings generator for android support passing **android-17/android.jar** as a supper jar
103
+
2. Add `/// <reference path="android-17.d.ts"/>` at the top of the generated typings file where android-17.d.ts is the typings file of the android API level 17
104
+
3. Run `tsc` passing the generated typings file and there shouldn't be errors
105
+
4. Now start replacing the reference file with the files from other API level while the `tsc` execution completes with no error
106
+
5. If there's an error this means that you need to generate the android support typings with the same android API level super jar
107
+
108
+
By repeating the steps above we've found that:
109
+
110
+
- Android support 17 typings(built with supper jar from android API 17) can be reused until android API 22
111
+
- Android support 23 typings(built with supper jar from android API 23) can be reused until android API 25
112
+
- Android support 26 typings(built with supper jar from android API 26) can be reused for API 26 and 27
113
+
114
+
The corresponding typings files can be found in the [tns-platform-declarations](https://github.com/NativeScript/NativeScript/tree/master/tns-platform-declarations) package. The repo's [Makefile](Makefile) can be used as a reference for creating these typings files
helpMessage.appendln("\t\t[-output <path>]:\tThe direcory the d.ts files will be generated in.");
113
+
helpMessage.appendln("\t\t[-output <path>]:\t\tThe direcory the d.ts files will be generated in.");
109
114
helpMessage.appendln("\t\t[-input]:\t\tThe input jars or class directories from which the d.ts files will be generated.");
110
115
helpMessage.appendln("\t\t[-super]:\t\tProvide jar files from which to search for super classes.");
111
116
helpMessage.appendln("\t\t[-input-generics]:\tProvide a file with information for number of generic types per given generic class name.");
112
-
helpMessage.appendln("\t\t[-all-generic-implements]:\tAdd this flag to generate implements for all interfaces implemented by the generic types." +
117
+
helpMessage.appendln("\t\t[-all-generic-implements]:\t\tAdd this flag to generate implements for all interfaces implemented by the generic types." +
113
118
" It is not enabled by default as when there are more than one implementation most probably one of them needs to be changed to extends, but this have to be made manually");
114
119
helpMessage.appendln("\t\t[-skip-declarations]:\t\tProvide this flag if you don't want android-declarations.d.ts file to be generated and referenced.");
120
+
helpMessage.appendln("\t\t[--class-mode]:\t\tPass this argument if you want folders to be processed as class folders.");
115
121
helpMessage.appendln("\t\t[-help]:\t\tPrints this help message.");
0 commit comments