Skip to content

Commit

Permalink
Add codegen debug logging to check CI issues
Browse files Browse the repository at this point in the history
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25874281

fbshipit-source-id: 9cb70c98849ab3eaa0318c88d51210fe9de8bdf5
  • Loading branch information
Andrei Shikov authored and facebook-github-bot committed Jan 12, 2021
1 parent 5348a98 commit b1474f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;
Expand All @@ -24,6 +25,8 @@
*/
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);
Expand All @@ -46,6 +49,8 @@ public void apply(final Project project) {
s -> {
generatedSrcDir.delete();
generatedSrcDir.mkdirs();
logger.warn(
"[Gradle] Codegen command on execution: " + ((Exec) s).getCommandLine());
});

task.getInputs()
Expand All @@ -60,15 +65,13 @@ public void apply(final Project 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit b1474f5

Please sign in to comment.