Skip to content

add gradle tasks for metalava generation #671

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 15 commits into from
Aug 14, 2019
Merged

Conversation

VinayGuthal
Copy link
Contributor

@VinayGuthal VinayGuthal commented Jul 29, 2019

This pr does the following things. it provides two tasks

  1. generateApiTxt task
    This generates the api.txt file which can be used to generate api information in the future.
  2. apiInformation task
    This provides information about the public apis.
    Adds the ci command to invoke the github rest api to post the comments of the results.

Additional context:
Baseline files are certain files which allows metalava to ignore the warnings present in these files. There is a system property updateBaseline which is added which allows us to control updation of the baseline file.

The last comment is how the output would look like

@googlebot googlebot added the cla: yes Override cla label Jul 29, 2019
@VinayGuthal
Copy link
Contributor Author

Can you guys have an initial look onto this pr

@@ -64,6 +69,21 @@ public void apply(Project project) {
}
});
}
if(System.getenv().containsKey("METALAVA_BINARY_PATH")) {
String metalavaBinaryPath = System.getenv().get("METALAVA_BINARY_PATH");
String sourcePath = project.getProjectDir() + "/src/main/java";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably needs different paths if its a kotlin project

Copy link
Member

@vkryachko vkryachko Jul 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be replaced with the variant-specific sourceSets collection: see https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/buildSrc/src/main/kotlin/androidx/build/java/JavaCompileInputs.kt#43

Also note that they also setup classpath and bootClasspath, I think we need to do it too

@VinayGuthal
Copy link
Contributor Author

This is a test comment

1 similar comment
@VinayGuthal
Copy link
Contributor Author

This is a test comment

@VinayGuthal
Copy link
Contributor Author

This is a testing comment

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

9 similar comments
@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

�[34m _ _
_ __ ___ | | __ | | __ ___ ____ _
| '
_ \ / _ \ __/ _ | |/ \ \ / / _ |
| | | | | | __/ || (
| | | (
| |\ V / (
| |
|| || ||___|__,||_,| _/ _,_|�[0m

�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentId.java:23: �[31merror: �[0mClass com.google.firebase.firestore.DocumentId no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Exclude.java:23: �[31merror: �[0mClass com.google.firebase.firestore.Exclude no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/IgnoreExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.IgnoreExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/PropertyName.java:23: �[31merror: �[0mClass com.google.firebase.firestore.PropertyName no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ServerTimestamp.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ServerTimestamp no longer implements java.lang.annotation.Annotation [RemovedInterface]
�[1m/usr/local/google/home/vguthal/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/ThrowOnExtraProperties.java:23: �[31merror: �[0mClass com.google.firebase.firestore.ThrowOnExtraProperties no longer implements java.lang.annotation.Annotation [RemovedInterface]

@VinayGuthal
Copy link
Contributor Author

This is a test comment

3 similar comments
@VinayGuthal
Copy link
Contributor Author

This is a test comment

@VinayGuthal
Copy link
Contributor Author

This is a test comment

@VinayGuthal
Copy link
Contributor Author

This is a test comment

@VinayGuthal
Copy link
Contributor Author

No project's public api surface was changed due to this PR.

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-database:
error: Added class com.google.firebase.database.DataSnapshot [AddedClass]

Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-firestore:
error: Removed method com.google.firebase.firestore.DocumentChange.val(Object) [RemovedMethod]

Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

/retest

if (System.getenv().containsKey("METALAVA_BINARY_PATH")) {
String metalavaBinaryPath = System.getenv("METALAVA_BINARY_PATH");
AndroidSourceSet mainSourceSet = android.getSourceSets().getByName("main");
File apiTxtFile = new File(project.getProjectDir() + "/api.txt");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace this with project.file("api.txt"), and maybe inline it?

String metalavaBinaryPath = System.getenv("METALAVA_BINARY_PATH");
AndroidSourceSet mainSourceSet = android.getSourceSets().getByName("main");
File apiTxtFile = new File(project.getProjectDir() + "/api.txt");
File baseLineFile = new File(project.getProjectDir() + "/baseline.txt");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of baseline.txt? it seems to be empty, also why is it's version declared as 1.0, while api.txt is declared as 2.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Baseline files are certain files which allows metalava to ignore the warnings present in these files. There is a system property updateBaseline which is added which allows us to control updation of the baseline file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are empty for some sdks whereas its not for firestore, common and other sdks

AndroidSourceSet mainSourceSet = android.getSourceSets().getByName("main");
File apiTxtFile = new File(project.getProjectDir() + "/api.txt");
File baseLineFile = new File(project.getProjectDir() + "/baseline.txt");
File outputFile = new File(project.getRootProject().getBuildDir() + "/apiinfo/" + project.getPath().substring(1).replace(":", "_"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project.getRootProject().file(Paths.get(
  project.getRootProject().buildDir().getPath(),
  "apiinfo",
  project.getPath().substring(1).replace(":", "_")));

File baseLineFile = new File(project.getProjectDir() + "/baseline.txt");
File outputFile = new File(project.getRootProject().getBuildDir() + "/apiinfo/" + project.getPath().substring(1).replace(":", "_"));
File outputFileDir = outputFile.getParentFile();
if(!outputFileDir.exists()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should move it into the task action so that this does not happen if the task is not executed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@VinayGuthal
Copy link
Contributor Author

/retest

File baseLineFile = new File(project.getProjectDir() + "/baseline.txt");
File outputFile = new File(project.getRootProject().getBuildDir() + "/apiinfo/" + project.getPath().substring(1).replace(":", "_"));
File outputFileDir = outputFile.getParentFile();
if(!outputFileDir.exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-firestore:
error: Added method com.google.firebase.firestore.CollectionReference.add(Object) [AddedMethod]
error: Added method com.google.firebase.firestore.DocumentChange.equals(Object) [AddedMethod]
Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-database:
error: Added class com.google.firebase.database.ChildEventListener [AddedInterface]
error: Added class com.google.firebase.database.DatabaseException [AddedClass]

Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

}
String cmdTemplate = "%s --source-path %s --check-compatibility:api:current %s --format=v2 --baseline %s --no-color";
if(getUpdateBaseline()) {
cmdTemplate = "%s --source-path %s --check-compatibility:api:current %s --format=v2 --update-baseline %s --no-color";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, there is a lot of boilerplate here that comes down to 2 commands and their respective arguments.

%s --source-path %s --api %s --format=v2 --baseline %s
 "%s --source-path %s --check-compatibility:api:current %s --format=v2 --update-baseline %s --no-color";

I think we can remove some cruft by modelling this as

// This task executes in 2 modes.
// 1. Generate api text mode
// 2. Compare api text mode 
public abstract class MetalavaExecutionTask extends DefaultTask {
    @Input
    abstract String getMetalavaBinaryPath();

    @InputFile
    abstract File getApiTxt();

    @Input
    abstract String getSourcePath();

    @InputFile
    abstract File getBaselineFile();

    @Input
    abstract boolean getUpdateBaseline();

    @Input
    abstract enum getMode();


    @OutputFile
    abstract File getOutputFile();

    abstract void setSourcePath(String value);

    abstract void setBaselineFile(File value);

    abstract void setUpdateBaseline(boolean value);

    abstract void setMetalavaBinaryPath(String value);

    abstract void setApiTxt(File value);

    abstract void setOutputFile(File value);

    abstract void setMode(Mode mode);

    private static enum Mode {
        GENERATE, COMPARE
    }

    @TaskAction
    void execute() {
        File outputFileDir = getOutputFile().getParentFile();
        if(!outputFileDir.exists()) {
            outputFileDir.mkdirs();
        }
        
        String cmd = mode == Mode.GENERATE ? "--check-compatibility:api:current %s" : "--api %s"
        String baseline = "--baseline %s" : "--update-baseline %s"
        String format = "--format=v2"
        String sourcePath = "--source-path %s"

        String cmdTemplate = ["%s", sourcePath, cmd, baselineArg, "--no-color"].join(" ")

        String cmdToRun = String.format(cmdTemplate, getMetalavaBinaryPath(), getSourcePath(), getApiTxt().getAbsolutePath(), getBaselineFile().getAbsolutePath());

        getProject().exec(spec-> {
            spec.setCommandLine(Arrays.asList(cmdToRun.split(" ")));
            try {
                spec.setStandardOutput(new FileOutputStream(getOutputFile()));
            } catch (FileNotFoundException e) {
                getLogger().error(e.toString());
            }
        });


        
    }

}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the ci command we would need to run the task to getApiInformation
and then run the task to generateApiInformation in this order
so we would need two tasks. However we can merge the two task classes into one though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And there is no purpose of outputFile in the generateApiInformation Task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure of the second task has changed now. It involves producing the api.txt file and then comparing the already existing api.txt with that. I feel now the structure of the two tasks are fairly different

}
if(doesSourcePathExist) {
project.getTasks().register("apiInformation", ApiInformationTask.class, task -> {
task.setProperty("apiTxt", project.file("api.txt"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer using setters directly instead of using this "reflective magic".(here and below)

outputFileDir.mkdirs();
}
String cmdTemplate = getUpdateBaseline() ?
"%s --source-path %s --check-compatibility:api:current %s --format=v2 --update-baseline %s --no-color"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned before you are still not populating the classpath

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-common:
error: Class com.google.firebase.FirebaseNetworkException superclass changed from com.google.firebase.FirebaseException to java.lang.Object [ChangedSuperclass]
error: Class com.google.firebase.FirebaseTooManyRequestsException superclass changed from com.google.firebase.FirebaseException to java.lang.Object [ChangedSuperclass]metalava wrote updated baseline to /usr/local/google/home/vguthal/firebase-android-sdk/firebase-common/baseline.txt

The public api surface has changed for the subproject firebase-database:
error: Added class com.google.firebase.database.DataSnapshot [AddedClass]metalava wrote updated baseline to /usr/local/google/home/vguthal/firebase-android-sdk/firebase-database/baseline.txt

Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-database:
warning: Added method com.google.firebase.database.ChildEventListener.onChildRemoved(com.google.firebase.database.DataSnapshot) [AddedAbstractMethod]

Please update the api.txt files for the subprojects being affected by this change with the files present in the artifacts directory. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

/test device-check-changed

boolean doesSourcePathExist = false;
for(String sourcePath : sourcePathArgument.split(":")) {
if(new File(sourcePath).exists()) {
doesSourcePathExist = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can replace this for loop with mainSourceSet.getJava().getSrcDirs().stream().anyMatch(File::exists)

@VinayGuthal VinayGuthal merged commit eab54ce into master Aug 14, 2019
@VinayGuthal VinayGuthal deleted the add_metalava_api_txt branch August 14, 2019 21:07
@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-firestore:
error: Removed class com.google.firebase.firestore.FirebaseFirestore.InstanceRegistry [RemovedInterface]

The public api surface has changed for the subproject firebase-common:
error: Added field com.google.firebase.FirebaseApp.vinay [AddedField]
error: Added field com.google.firebase.FirebaseApp.vinay1 [AddedField]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

2 similar comments
@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-firestore:
error: Removed class com.google.firebase.firestore.FirebaseFirestore.InstanceRegistry [RemovedInterface]

The public api surface has changed for the subproject firebase-common:
error: Added field com.google.firebase.FirebaseApp.vinay [AddedField]
error: Added field com.google.firebase.FirebaseApp.vinay1 [AddedField]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@VinayGuthal
Copy link
Contributor Author

The public api surface has changed for the subproject firebase-firestore:
error: Removed class com.google.firebase.firestore.FirebaseFirestore.InstanceRegistry [RemovedInterface]

The public api surface has changed for the subproject firebase-common:
error: Added field com.google.firebase.FirebaseApp.vinay [AddedField]
error: Added field com.google.firebase.FirebaseApp.vinay1 [AddedField]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants