Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/content/en-US/docs/1.getting-started/2.first-project.md
blob: c14f343841ead1139aa407982f47e44b9c4260b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: A first project
description: Write a Tala project in a few lines, then build, run, format and lint it.
---

<!-- SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> -->
<!-- SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 -->

A project is a folder with a project file. Its sources are the `.tala` files below `Sources/`, and `entry` names the
class whose `public static void Main()` starts the program.

```kotlin [BUILD.kts]
project {
  name = "Example"
}

sources {
  executable {
    entry = "Example.Program"
  }
}
```

```tala [Sources/Main.tala]
namespace Example;

public class Program {
    public static void Main() {
        Console.Println("Hello from Tala!");
    }
}
```

## Build and run

```bash [terminal]
tazel build
tazel run -- first second
```

`tazel build` writes `build/debug/Example`, or `Example.exe` on Windows. `tazel run` builds the program and starts it;
what follows `--` goes to the program unread. A second `tazel build` with nothing changed reports the target as fresh and
starts no compiler.

## Format and lint

```bash [terminal]
tazel fmt -- --check
tazel lint -- --fix
```

Options after `--` go to talafmt and talalint, so `tazel fmt -- --check` only reports, and `tazel lint -- --fix` applies
the fixes it can.

::note
ViGet does not serve Tala packages. A project that declares a dependency of the build, a library target and `.vipkg`
creation are refused by name, with exit code 1.
::

Next: every block of [the project file](/docs/reference/project-file), and every [command](/docs/reference/commands).