or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

analysis-caching.mdcompiler-management.mdconfiguration.mdindex.mdlogging-reporting.mdmain-entry.mdutilities.md

main-entry.mddocs/

0

# Main Entry Point

1

2

Primary command-line interface and programmatic entry points for Zinc compilation orchestration.

3

4

## Capabilities

5

6

### Command-Line Interface

7

8

Standard main method for command-line execution of Zinc compilation.

9

10

```scala { .api }

11

/**

12

* Standard main method for command-line execution

13

* @param args Command-line arguments for compilation

14

*/

15

def main(args: Array[String]): Unit

16

```

17

18

**Usage Example:**

19

20

```scala

21

import org.pantsbuild.zinc.Main

22

23

// Command-line execution

24

Main.main(Array(

25

"-scala-home", "/usr/local/scala",

26

"-classpath", "/path/to/dependencies:/additional/deps",

27

"-d", "/path/to/output/classes",

28

"src/main/scala/MyClass.scala",

29

"src/main/scala/AnotherClass.scala"

30

))

31

```

32

33

### Programmatic Compilation

34

35

Programmatic compilation entry point with optional working directory specification.

36

37

```scala { .api }

38

/**

39

* Programmatic compilation entry point with optional working directory

40

* @param args Command-line arguments for compilation

41

* @param cwd Optional working directory for relative path resolution

42

*/

43

def run(args: Array[String], cwd: Option[File]): Unit

44

```

45

46

**Usage Example:**

47

48

```scala

49

import org.pantsbuild.zinc.Main

50

import java.io.File

51

52

// Programmatic execution with working directory

53

val projectDir = new File("/path/to/project")

54

val args = Array(

55

"-scala-home", "/usr/local/scala",

56

"-classpath", "./lib/dependency.jar:./lib/other.jar", // relative paths

57

"-d", "./target/classes",

58

"./src/main/scala/Example.scala"

59

)

60

61

Main.run(args, Some(projectDir))

62

```

63

64

## Implementation Notes

65

66

The `Main` object serves as the primary entry point for Zinc compilation and handles:

67

68

- Command-line argument parsing through the `Settings` system

69

- Working directory resolution for relative paths

70

- Error handling and logging setup

71

- Compilation orchestration through the `Compiler` system

72

73

Both methods will parse arguments, set up the compilation environment, and execute the compilation process with appropriate error handling and logging.