Skip to content
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

feat: add ftl build command #605

Merged
merged 2 commits into from
Nov 16, 2023
Merged

feat: add ftl build command #605

merged 2 commits into from
Nov 16, 2023

Conversation

wesbillman
Copy link
Member

Fixes #597

This currently only supports building kotlin modules. go support will be added in the future.

I'm not 100% sure if this is the best way to activate hermit as part of the build but we can discuss.

Create new module and build:

ftl init kotlin services alice

ftl build services/ftl-module-alice
info: Building kotlin module 'alice'
info: Using build command 'source ../bin/activate-hermit && mvn compile'

With log-level=debug

ftl build services/ftl-module-alice --log-level=debug
info: Building kotlin module 'alice'
info: Using build command 'source ../bin/activate-hermit && mvn compile'
debug: ../bin/activate-hermit: line 61: /bin/hermit: No such file or directory
debug: ../bin/activate-hermit: line 20: /bin/hermit: No such file or directory
debug: Hermit environment  activated
debug: [INFO] Scanning for projects...
debug: [INFO]
debug: [INFO] ------------------------< ftl:ftl-module-alice >------------------------
debug: [INFO] Building ftl-module-alice 1.0-SNAPSHOT
debug: [INFO] --------------------------------[ jar ]---------------------------------
debug: [INFO]
debug: [INFO] --- maven-dependency-plugin:3.2.0:copy (default) @ ftl-module-alice ---
debug: [INFO] Configured Artifact: xyz.block:ftl-generator:jar-with-dependencies:1.0-SNAPSHOT:jar

Default build command can be overridden in ftl.toml

module = "alice"
language = "kotlin"
build = "source ../bin/activate-hermit && mvn clean compile"
deploy = [
  "target/main",
  "target/classes",
  "target/dependency",
  "target/classpath.txt",
]
ftl build services/ftl-module-alice
info: Building kotlin module 'alice'
info: Using build command 'source ../bin/activate-hermit && mvn clean compile'

Example errors:

Building a go module:

ftl build echo
ftl: error: unable to build. unknown language "go"

toml not found

ftl build bogus
ftl: error: [<base>]: stat /Users/wesbillman/dev/ftl/examples/bogus: no such file or directory

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

Glorious!

Weird that the Hermit activation is throwing an error...


buildCmd := config.Build
if buildCmd == "" {
buildCmd = "source ../bin/activate-hermit && mvn compile"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll have to check if the ../bin/hermit directory exists, as it's optional.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I would remove the Hermit activation completely. We should assume that the user has either already activated the environment, or isn't using it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I was curious about that. In our "default" build would we assume it's there? Or, should I just always check if there is one and if so go ahead and add the activation?

@wesbillman wesbillman merged commit 8c6a74a into main Nov 16, 2023
10 checks passed
@wesbillman wesbillman deleted the add-ftl-build branch November 16, 2023 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
2 participants