Add @DoNotStrip annotations to root Pojos

Summary:
To ensure these Pojos don't get dead code eliminated, this diff adds a DoNotStrip annotation to each Props pojo object.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26041103

fbshipit-source-id: 02031f39f5fc5ef1bb9f11b729e68437bfe95452
This commit is contained in:
Ramanpreet Nara
2021-01-26 17:07:01 -08:00
committed by Facebook GitHub Bot
parent 19ef415895
commit e08681cf79
2 changed files with 71 additions and 1 deletions
@@ -236,6 +236,10 @@ function serializePojo(pojo: Pojo, basePackageName: string): string {
importSet.add($import);
};
if (pojo.isRoot) {
addImport('com.facebook.proguard.annotations.DoNotStrip');
}
const indent = ' '.repeat(2);
const members = pojo.properties
@@ -269,7 +273,7 @@ function serializePojo(pojo: Pojo, basePackageName: string): string {
package ${basePackageName}.${pojo.namespace};
${imports === '' ? '' : `\n${imports}\n`}
public class ${pojo.name} {
${pojo.isRoot ? '@DoNotStrip\n' : ''}public class ${pojo.name} {
${members}
${getters}
}