minor(clojurescript): Add back Figwheel support by ajoberstar · Pull Request #192 · clojurephant/clojurephant · GitHub
Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/modules/reference/pages/dsl/clojurescriptbuild.adoc
132 changes: 132 additions & 0 deletions docs/modules/reference/pages/dsl/figwheeloptions.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
= FigwheelOptions

**Source:** link:https://github.com/clojurephant/clojurephant/blob/{page-origin-refname}/src/main/java/dev/clojurephant/plugin/clojurescript/tasks/FigwheelOptions.java[`dev.clojurephant.plugin.clojurescript.tasks.FigwheelOptions`]

Options for Figwheel (see link:https://figwheel.org/config-options[Figwheel's documentation]).

== Properties

NOTE: Not all Figwheel options are supported yet. Open an issue or submit a PR if there's one you'd like added.

[cols="2*m,1a", options="header"]
|===
|Property
|Type
|Description

|targetDir
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/file/DirectoryProperty.html[DirectoryProperty]
|Defaults to the build's `outputDir`

|watchDirs
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/file/ConfigurableFileCollection.html[ConfigurableFileCollection]
|

|cssDirs
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/file/ConfigurableFileCollection.html[ConfigurableFileCollection]
|

|ringHandler
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|ringServerOptions
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html[MapProperty<String, Object>]
|

|rebelReadline
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|Defaults to `false` (overriding Figwheel's default)

|pprintConfig
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|openFileCommand
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|figwheelCore
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|hotReloadCljs
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|connectUrl
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|openUrl
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Object>]
|

|reloadCljFiles
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|logFile
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/file/RegularFileProperty.html[RegularFileProperty]
|

|logLevel
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|clientLogLevel
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|logSyntaxErrorStyle
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|loadWarningedCode
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|ansiColorOutput
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|validateConfig
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|validateCli
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|launchNode
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|inspectNode
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|nodeCommand
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|launchJs
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<String>]
|

|cljsDevtools
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|

|helpfulClasspaths
|link:https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html[Property<Boolean>]
|Defaults to `false` (overriding Figwheel's default)
|===

== Methods

_None_

== Example

See xref:dsl/clojurescriptextension.adoc[].
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ private void configureBuildDefaults(Project project, SourceSetContainer sourceSe
module.getBaseOutputDirectory().set(build.getCompiler().getBaseOutputDirectory());
});

build.getFigwheel().getTargetDir().set(build.getOutputDir());
build.getFigwheel().getWatchDirs().from(build.getSourceRoots());
build.getFigwheel().getRebelReadline().set(false);
build.getFigwheel().getHelpfulClasspaths().set(false);

String compileTaskName = build.getTaskName("compile");
TaskProvider<ClojureScriptCompile> compileTask = project.getTasks().register(compileTaskName, ClojureScriptCompile.class, task -> {
task.setDescription(String.format("Compiles the ClojureScript source for the %s build.", build.getName()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.clojurephant.plugin.clojurescript;

import dev.clojurephant.plugin.clojurescript.tasks.ClojureScriptCompileOptions;
import dev.clojurephant.plugin.clojurescript.tasks.FigwheelOptions;
import org.apache.commons.text.WordUtils;
import org.gradle.api.Action;
import org.gradle.api.Named;
Expand Down Expand Up @@ -38,6 +39,13 @@ public void compiler(Action<? super ClojureScriptCompileOptions> configureAction
configureAction.execute(getCompiler());
}

@Nested
public abstract FigwheelOptions getFigwheel();

public void figwheel(Action<? super FigwheelOptions> configureAction) {
configureAction.execute(getFigwheel());
}

String getTaskName(String task) {
if ("main".equals(getName())) {
return String.format("%sClojureScript", task);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,16 @@ public class ClojureScriptPlugin implements Plugin<Project> {
public void apply(Project project) {
project.getPlugins().apply(ClojureScriptBasePlugin.class);
project.getPlugins().apply(ClojureCommonPlugin.class);
configureFigwheel(project);
}

public void configureFigwheel(Project project) {
ClojureScriptExtension extension = project.getExtensions().getByType(ClojureScriptExtension.class);
ClojureScriptBuild main = extension.getBuilds().getByName("main");
ClojureScriptBuild test = extension.getBuilds().getByName("test");
ClojureScriptBuild dev = extension.getBuilds().getByName("dev");

dev.getFigwheel().getWatchDirs().from(main.getSourceRoots());
dev.getFigwheel().getWatchDirs().from(test.getSourceRoots());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package dev.clojurephant.plugin.clojurescript.tasks;

import java.util.HashMap;
import java.util.Map;

import org.gradle.api.Project;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.file.Directory;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.OutputFile;

public abstract class FigwheelOptions {
@OutputDirectory
public abstract DirectoryProperty getTargetDir();

@InputFiles
public abstract ConfigurableFileCollection getWatchDirs();

@InputFiles
public abstract ConfigurableFileCollection getCssDirs();

@Input
public abstract Property<String> getRingHandler();

@Input
public abstract MapProperty<String, Object> getRingServerOptions();

@Input
public abstract Property<Boolean> getRebelReadline();

@Input
public abstract Property<Boolean> getPprintConfig();

@Input
public abstract Property<String> getOpenFileCommand();

@Input
public abstract Property<Boolean> getFigwheelCore();

@Input
public abstract Property<Boolean> getHotReloadCljs();

@Input
public abstract Property<String> getConnectUrl();

@Input
public abstract Property<Object> getOpenUrl();

@Input
public abstract Property<String> getReloadCljFiles();

@OutputFile
public abstract RegularFileProperty getLogFile();

@Input
public abstract Property<String> getLogLevel();

@Input
public abstract Property<String> getClientLogLevel();

@Input
public abstract Property<String> getLogSyntaxErrorStyle();

@Input
public abstract Property<Boolean> getLoadWarningedCode();

@Input
public abstract Property<Boolean> getAnsiColorOutput();

@Input
public abstract Property<Boolean> getValidateConfig();

@Input
public abstract Property<Boolean> getValidateCli();

@Input
public abstract Property<Boolean> getLaunchNode();

@Input
public abstract Property<Boolean> getInspectNode();

@Input
public abstract Property<String> getNodeCommand();

@Input
public abstract Property<String> getLaunchJs();

@Input
public abstract Property<Boolean> getCljsDevtools();

@Input
public abstract Property<Boolean> getHelpfulClasspaths();

// skipping remaining options for now
}
40 changes: 40 additions & 0 deletions src/main/java/dev/clojurephant/plugin/common/internal/Edn.java