Class ProgramLicences
java.lang.Object
org.ek9lang.core.ProgramLicences
THE licence files every program EK9 compiles carries with it (licence decision D-L1, docs/legal): the runtime's
Apache-2.0 licence, the runtime's NOTICE, and the notices of the third-party code the program contains. Apache-2.0
s.4 asks that they travel with every copy of the runtime, and every compiled program is one.
A program jar holds them as JAR_DIRECTORY entries (RuntimeClassExtractor writes them). A native
executable has no jar, so it holds them EMBEDDED: each file is a NUL, EMBEDDED_MARK, its name, a newline,
its text and a NUL - plain bytes in a data section, found by scanning, so no object-file format needs parsing and
strings shows them too. readFrom(Path) reads either form back; ek9 -show-licences is its door.
The names are always FILE_NAMES, whatever the form, and nothing else is ever read or written.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne licence file: its name (one ofFILE_NAMES) and its bytes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhat precedes the name of each embedded file, after its NUL.Every licence file a program carries, in the order they are shown.static final StringWhere a program jar holds them.static final StringThe runtime's licence, the Apache License 2.0.static final StringThe runtime's NOTICE.static final StringThe notices of the third-party code in the program (a JVM program and a native one contain different code). -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]embedded(List<ProgramLicences.LicenceFile> files) The embedded form offiles, for a native executable's data.static List<ProgramLicences.LicenceFile> The licence files the compiler puts with every program it compiles for the JVM.(package private) static List<ProgramLicences.LicenceFile> fromEmbedded(byte[] bytes) The embedded files inbytes; the first of each name counts.static List<ProgramLicences.LicenceFile> The licence filesprogramcarries - a program jar or a native executable - inFILE_NAMESorder; empty when it carries none (it is not a program EK9 compiled, or EK9 compiled it before programs carried them).
-
Field Details
-
LICENCE_FILE
-
NOTICE_FILE
-
THIRD_PARTY_FILE
The notices of the third-party code in the program (a JVM program and a native one contain different code).- See Also:
-
FILE_NAMES
-
JAR_DIRECTORY
-
EMBEDDED_MARK
What precedes the name of each embedded file, after its NUL.- See Also:
-
-
Method Details
-
forJvmPrograms
The licence files the compiler puts with every program it compiles for the JVM. -
embedded
The embedded form offiles, for a native executable's data. -
readFrom
The licence filesprogramcarries - a program jar or a native executable - inFILE_NAMESorder; empty when it carries none (it is not a program EK9 compiled, or EK9 compiled it before programs carried them).- Throws:
IOException
-
fromEmbedded
The embedded files inbytes; the first of each name counts.
-