Add codegen debug logging to check CI issues

Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25874281

fbshipit-source-id: 9cb70c98849ab3eaa0318c88d51210fe9de8bdf5
This commit is contained in:
Andrei Shikov 2021-01-11 16:03:02 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 5348a98207
Коммит b1474f56cb
2 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -12,6 +12,7 @@ import com.facebook.react.codegen.generator.JavaGenerator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.io.File;
import org.apache.log4j.Logger;
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
@ -24,6 +25,8 @@ import org.gradle.api.tasks.Exec;
*/
public class CodegenPlugin implements Plugin<Project> {
Logger logger = Logger.getLogger(getClass());
public void apply(final Project project) {
final CodegenPluginExtension extension =
project.getExtensions().create("react", CodegenPluginExtension.class, project);
@ -46,6 +49,8 @@ public class CodegenPlugin implements Plugin<Project> {
s -> {
generatedSrcDir.delete();
generatedSrcDir.mkdirs();
logger.warn(
"[Gradle] Codegen command on execution: " + ((Exec) s).getCommandLine());
});
task.getInputs()
@ -60,15 +65,13 @@ public class CodegenPlugin implements Plugin<Project> {
ImmutableList.of("**/*.js"))));
task.getOutputs().file(generatedSchemaFile);
ImmutableList<String> execCommands =
new ImmutableList.Builder<String>()
.add("yarn")
.addAll(ImmutableList.copyOf(extension.nodeExecutableAndArgs))
.add(extension.codegenGenerateSchemaCLI().getAbsolutePath())
.add(generatedSchemaFile.getAbsolutePath())
.add(extension.jsRootDir.getAbsolutePath())
.build();
task.commandLine(execCommands);
task.executable("yarn")
.args(ImmutableList.copyOf(extension.nodeExecutableAndArgs))
.args(extension.codegenGenerateSchemaCLI().getAbsolutePath())
.args(generatedSchemaFile.getAbsolutePath())
.args(extension.jsRootDir.getAbsolutePath());
logger.warn("[Gradle] Codegen command on configure: " + task.getCommandLine());
});
// 3. Task: generate Java code from schema.

Просмотреть файл

@ -32,6 +32,7 @@ function filterJSFile(file) {
);
}
console.log('[JS] Codegen args: ' + process.argv.join(' '));
const allFiles = [];
fileList.forEach(file => {
if (fs.lstatSync(file).isDirectory()) {