Skip to content

chore: android29 cleanup #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,13 @@ android-platform-28:
java -jar dts-generator/build/libs/dts-generator.jar -input ${ANDROID_HOME}/platforms/android-28/android.jar
mv out/android.d.ts out/android-platform-28.d.ts

android-platform-29:
java -jar dts-generator/build/libs/dts-generator.jar -input ${ANDROID_HOME}/platforms/android-29/android.jar
mv out/android.d.ts out/android-platform-29.d.ts

android-platform-all: android-platform-17 android-platform-18 android-platform-19 android-platform-20 android-platform-21 \
android-platform-22 android-platform-23 android-platform-24 android-platform-25 android-platform-26 android-platform-27 \
android-platform-28

android-support-17:
java -jar dts-generator/build/libs/dts-generator.jar \
-input libs/android-support/27.0.1 -input-generics libs/generics.txt \
-super ${ANDROID_HOME}/platforms/android-17/android.jar -skip-declarations
mv out/android.d.ts out/android-support-17.d.ts

android-support-23:
java -jar dts-generator/build/libs/dts-generator.jar \
-input libs/android-support/27.0.1 -input-generics libs/generics.txt \
-super ${ANDROID_HOME}/platforms/android-23/android.jar -skip-declarations
mv out/android.d.ts out/android-support-23.d.ts

android-support-26:
java -jar dts-generator/build/libs/dts-generator.jar \
-input libs/android-support/27.0.1 -input-generics libs/generics.txt \
-super ${ANDROID_HOME}/platforms/android-26/android.jar -skip-declarations
mv out/android.d.ts out/android-support-26.d.ts

android-support-28:
java -jar dts-generator/build/libs/dts-generator.jar \
-input libs/android-support/27.0.1 -input-generics libs/generics.txt \
-super ${ANDROID_HOME}/platforms/android-28/android.jar -skip-declarations
mv out/android.d.ts out/android-support-28.d.ts

android-support-all: android-support-17 android-support-23 android-support-26 android-support-28
android-platform-28 android-platform-29

androidx-17:
java -jar dts-generator/build/libs/dts-generator.jar \
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ If you want to generate typings of a package but you are not sure how you can ge

7. Run the dts-generator tool passing as **input** arguments the path to the output jars folder

## Android support specifics
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)
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:
## Androidx specifics
To get all the jar files for androidx follow the steps above. You can find the **jar** files for androidx 1.0.0 in [the current repository](libs/androidx/1.0.0)
As androidx 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:

1. Run the typings generator for android support passing **android-17/android.jar** as a supper jar
1. Run the typings generator for androidx passing **android-17/android.jar** as a supper jar
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
3. Run `tsc` passing the generated typings file and there shouldn't be errors
4. Now start replacing the reference file with the files from other API level while the `tsc` execution completes with no error
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

By repeating the steps above we've found that:

- Android support 17 typings(built with supper jar from android API 17) can be reused until android API 22
- Android support 23 typings(built with supper jar from android API 23) can be reused until android API 25
- Android support 26 typings(built with supper jar from android API 26) can be reused for API 26 and 27
- Androidx 17 typings(built with supper jar from android API 17) can be reused until android API 22
- Androidx 23 typings(built with supper jar from android API 23) can be reused until android API 25
- Androidx 26 typings(built with supper jar from android API 26) can be reused for API 26 and 27

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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed libs/android-support/27.0.1/android-support-v4.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.