eclipse / mita

mita
Eclipse Public License 2.0
55 stars 20 forks source link

Implement standalone library system #135

Open csweichel opened 6 years ago

csweichel commented 6 years ago

General Idea

At the moment Mita libraries are tied to the Eclipse IDE. Libraries are packaged as plugins and register extension points which list the .mita and .platform files they contribute. This mechanism works will within an Eclipse-only environment, but fails in a standalone setup.

Further, this model assumes that users of Mita receive Mita through some form of distribution provider (e.g. Bosch building the XDK Workbench which ships with the xdk110 platform). However, this model does not always work well and does not reflect what developers have come to know. Most programming languages allow users to load libraries as part of a package configuration (think package.json).

We could introduce a mita.yaml file in a project folder which - among other things - lists the dependencies of a project. For example:

dependencies:
- location: xdk110-platform.jar
  hash: 722aacd9635ab795d9be074c2ea91253622c99b2
- location: http://eclipse.org/mita/some-extension.jar
  hash: 891aacd9635ab795d9be074c2ea91253622c99ad

The Mita compiler (in Eclipse or standalone) would download/copy all libraries to a .mita_lib folder within the project root. From this directory we would then try and load the libraries.

Library files

Mita libraries are jar files. The jar can contain .mita or .platform files as well as the generator classes as bytecode. Within a library we would expect a META-INF/mita-lib which just lists the files we ought to load relative to the jar file root.

Note: the mita-lib file does not list dependencies. This is intentional. At this point we neither support versioning or transitive dependencies.

csweichel commented 6 years ago

We should add support to the Mita CLI (#104 ) to manage the mita.yaml file, specifically:

mita init - creates a new mita.yaml file
mita add <url> - downloads a mita library and adds it to the mita.yaml file
mita install - collects all mita libraries and puts them in the .mita_lib folder