Skip to content
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

Input aar file type support #9

Open
roblav96 opened this issue Aug 28, 2016 · 5 comments
Open

Input aar file type support #9

roblav96 opened this issue Aug 28, 2016 · 5 comments

Comments

@roblav96
Copy link
Contributor

How would I go about using an aar file instead of jar? I'd like to input play-services-maps-9.4.0.aar into the dts-generator.

@petekanev
Copy link
Contributor

@roblav96 for the time being you can extract the classes.jar from the .aar and pass it as a parameter to the generator. Feel free to rename the .jar to whatever you feel like to avoid naming conflicts.

@petekanev
Copy link
Contributor

@roblav96 A little unrelated to the issue, but thought it's worth sharing - I tried inputting as many jars and aars into the generator and it kind of... worked. Due to limitations in TypeScript and JavaScript modules (namespaces) that contain .android. anywhere in the namespace will confuse the TypeScript compiler, and invalidate all previously declared classes in android. (Android SDK) resulting in TSC errors.
Google's play-services libraries reside in the com.google.android.gms note the .android. and that is a showstopper for now.

For these reasons we are rolling out dts generation support behind a tns build/run android --androidTypings flag , in 2.4.0, with support for only the android SDK and all android support libraries

@roblav96
Copy link
Contributor Author

roblav96 commented Nov 7, 2016

@Pip3r4o Interesting. That might explain why I could never get full https://github.com/OneSignal/OneSignal-Android-SDK declarations since it required com.google.android.gms.

What's strange is that when I throw com.soundcloud.android.crop https://github.com/jdamcd/android-crop through the generator the declarations come out fine.

declare module com {
    export module soundcloud {
        export module android {
            export module crop {
                export class Crop extends java.lang.Object {
                    public static REQUEST_CROP: number;
                    public static REQUEST_PICK: number;
                    public static RESULT_ERROR: number;
                    public start(param0: android.content.Context, param1: android.support.v4.app.Fragment, param2: number): void;
                    public static pickImage(param0: android.app.Activity): void;
                    public start(param0: android.content.Context, param1: android.support.v4.app.Fragment): void;
                    public asSquare(): com.soundcloud.android.crop.Crop;
                    public static of(param0: android.net.Uri, param1: android.net.Uri): com.soundcloud.android.crop.Crop;
                    ...
                }
            }
        }
    }
}

@petekanev
Copy link
Contributor

petekanev commented Nov 7, 2016

@roblav96 declarations do come out fine-looking, executing tsc however will throw errors saying content not found on com.soundcloud.android when the typing should instead be referring to android.content.Context

@roblav96
Copy link
Contributor Author

roblav96 commented Nov 9, 2016

@Pip3r4o Yes that's certainly true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants