Skip to content

Commit 2c8e4a7

Browse files
author
PROGRESS\radeva
committed
docs:update readme
1 parent 6be81d7 commit 2c8e4a7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
1-
# android-dts-generator
1+
# Android d.ts Generator
22
A tool that generates TypeScript declaration files (.d.ts) from Jars
33

44
> Because there are certain incompatibilities between Java and TypeScript, definitions MAY NOT always be completely accurate. They will however compile and provide auto complete feature inside a modern text editor supporting typings.
55
6-
### Quirks
6+
## Quirks
77
- Interfaces are represented by classes, this will allow you to extend them by using the `new` syntax, as well as show you all its members that need to be implemented
88
- Classes from the package `java.util.function` don't have their typings generated, as `function` is a reserved keyword in TypeScript and JavaScript
99
- Classes returning values of Type in the package `java.util.function` will return `any` instead
1010
- Classes using methods with parameters of Type in the package `java.util.function` will take `any` instead
1111
- Classes implementing `java.util.Iterator`, `android.animation.TypeEvaluator`, `java.lang.Comparable` do not implement those interfaces in the generated definitions for compatibility-related issues
1212

1313

14-
### Generate definitons for Android SDK
14+
## Prerequisites
15+
- [Gradle](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper)
16+
- Built gradle wrapper. [Read more](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper)
17+
18+
19+
Generate definitions following any of the approaches described below. Once you have run any of commands, you can find the generated typings in `dts-generator\out` directory.
20+
## Generate definitons for Android SDK
1521
```shell
1622
cd dts-generator
1723
gradlew jar
1824
java -jar build\libs\dts-generator.jar -input %ANDROID_HOME%\platforms\android-<Platform Level (21/22/23/24)>\android.jar
1925
```
2026

21-
### Generate definitions for any Jar
27+
## Generate definitions for any Jar
2228
```shell
2329
cd dts-generator
2430
gradlew jar
2531
java -jar build\libs\dts-generator.jar -input <Path to your Jar>
2632
```
2733

28-
### Pass multiple jars to generator
34+
## Pass multiple jars to generator
2935
```shell
3036
cd dts-generator
3137
gradlew jar
3238
java -jar build\libs\dts-generator.jar -input <jar1> <jar2> <jar3>
3339
```
3440

35-
### Generate definitions for .aar
41+
## Generate definitions for .aar
3642
```
3743
Open the .aar archive
3844
Extract the classes.jar and any dependencies it may have inside libs/
3945
Rename classes.jar if necessary
4046
```
4147
```shell
42-
java - jar build\libs\dts-generator.jar -input classes.jar dependency-of-classes-jar.jar
48+
java -jar build\libs\dts-generator.jar -input classes.jar dependency-of-classes-jar.jar
4349
```

0 commit comments

Comments
 (0)