Skip to content

Updated dependencies and added tests #53

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 16, 2020
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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ androidx-29:
-super ${ANDROID_HOME}/platforms/android-29/android.jar -skip-declarations
mv out/android.d.ts out/androidx-29.d.ts

test-compare-output:
java -jar dts-generator/build/libs/dts-generator.jar \
-input libs
cmp out/android.d.ts test/expected-output/android.d.ts
cmp out/android-declarations.d.ts test/expected-output/android-declarations.d.ts

androidx-all: androidx-17 androidx-23 androidx-26 androidx-28 androidx-29
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ java -jar build/libs/dts-generator.jar -input <jarFolder>

> Note: Check the [Makefile](Makefile) for sample usage

## Test

In order to test the tool there are some predefined androuidx packages. We are running the tool and comparing the output with the expected output commited in the repo.
To run the test:

```shell
make test-compare-output
```

Then check whether the make command will return an error comparing the files.

> Note: If the libs folder content is changed, the expected output should also be changed

## Generate definitions for .aar
```
Open the .aar archive
Expand Down
4 changes: 2 additions & 2 deletions dts-generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ allprojects {
}

dependencies {
implementation 'org.apache.bcel:bcel:6.4.1'
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.bcel:bcel:6.5.0'
implementation 'commons-io:commons-io:2.8.0'
implementation 'com.github.spotbugs:spotbugs:3.1.12'

// add your dependency here as the example bellow, make sure you are using testCompileOnly
Expand Down
4 changes: 4 additions & 0 deletions test/expected-output/android-declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module native { export class Array<T> { constructor(); length: number; [index: number]: T; } }

import globalAndroid = android;

Loading