Difference between pages "Event-B XText Front-end" and "Exporting and importing archives containing theories"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Son
 
imported>Nicolas
 
Line 1: Line 1:
 
{{TOCright}}
 
{{TOCright}}
Return to [[Rodin Plug-ins]]
 
  
The Event-B XText front-end provides text editors for XContexts and and XMachines which then compiled automatically to Event-B contexts and machines.
+
== Purpose ==
  
<br style="clear: both" />
+
Rodin 2.0 with theory feature provides support for developing theories. But sharing theories can be somewhat difficult if care is not taken for exporting and importing them. This is related to the fact that theories are always in a particular project called "MathExtensions".
 +
To understand the problem, let's say we have developed an Event-B project P and a theory T and want to make an archive in order to share them. The workspace looks like this:
  
Please have a look also at the [[Event-B XText Front-end User Guide]].
+
+ MathExtensions
 +
  - T.tuf
 +
  - T.dtf
 +
  ...
 +
+ P
 +
  - C0.buc
 +
  - m0.bum
 +
  ...
  
=== Current version ===
+
If we make a standard archive export of these projects (File > Export > Archive File), we will get a zip file containing the project P and the project MathExtensions.
The Event-B XText front-end 0.0.5 is available as a separate plug-in from the main Rodin update site (under the Editor category).
 
  
=== Principles ===
+
But then, the person who will import the archive into his workspace with the theory feature installed (File > Import > Existing Projects into Workspace > Select archive file), will already have a project named "MathExtensions" in the workspace. Thus, the import wizard will warn that "Some projects cannot be imported because they already exist in the workspace", and theories of "MathExtensions" in the archive will not be imported. This page is dedicated to proposing workarounds for this problem.
The Event-B XText editors (i.e., XContext and XMachine editors) do not work directly on the Rodin files. Instead, they operate on the separate XContext and XMachine and they are compiled to the Rodin files.
+
 
 +
== Solution 1: theories at archive root ==
 +
 
 +
When exporting, select option "Create only selected directories", then select project P, but not project MathExtensions, only the T.* files in it, as shown below:
 +
 
 +
[[Image:Export_P_Troot.png|500px]]
 +
 
 +
Then clean P and MathExtensions (Project > Clean).
 +
 
 +
Then, import is done in two steps:
 +
# import T: File > Import > Archive File select the archive, untick the P project, only select T.* files at the root, select to import into the MathExtensions as shown on the image below
 +
# import P the standard way: File > Import > Existing Projects into Workspace > Select archive file
 +
 
 +
[[Image:Import_P_Troot.png|500px]]
 +
 
 +
Note: in this case we chose to only put the .tuf (theory unchecked file) and .bpr (proof file) into the archive, because other files (.tcf, .bpo, .bps) are generated upon build, and .dtf (deployed theory file) is generated when deploying T. It is also possible to put every T.* files in the archive, or only T.dtf. In any case, it is generally preferable to clean imported projects and the MathExtensions project.
 +
 
 +
This solution is the most conservative one, as other theories that might exist in the importing workspace are conserved.
 +
 
 +
== Solution 2: remove MathExtensions at import ==
 +
 
 +
This second solution is the most simple but can be used only when the importer has not developed any theories.
 +
It consists in exporting P and T the standard way, so that the archive contains P and MathExtensions projects. Then the importer simply deletes his empty MathExtensions project from the workspace before importing the standard way (File > Import > Existing Projects into Workspace > Select archive file).
 +
 
 +
== Solution 3: temporary project ==
 +
 
 +
This solution consists in creating a temporary project, for instance TempMathExtensions, then copying theory files to export in it. The exporter then makes a standard project archive with P and TempMathExtensions (and NOT MathExtensions).
 +
 
 +
The importer can then import this archive the standard way (File > Import > Existing Projects into Workspace > Select archive file), then copy theory files from TempMathExtensions to MathExtensions, and finally delete TempMathExtensions. A clean of P and MathExtensions is then highly recommended.

Revision as of 13:48, 5 November 2010

Purpose

Rodin 2.0 with theory feature provides support for developing theories. But sharing theories can be somewhat difficult if care is not taken for exporting and importing them. This is related to the fact that theories are always in a particular project called "MathExtensions". To understand the problem, let's say we have developed an Event-B project P and a theory T and want to make an archive in order to share them. The workspace looks like this:

+ MathExtensions
  - T.tuf
  - T.dtf
  ...
+ P
  - C0.buc
  - m0.bum
  ...

If we make a standard archive export of these projects (File > Export > Archive File), we will get a zip file containing the project P and the project MathExtensions.

But then, the person who will import the archive into his workspace with the theory feature installed (File > Import > Existing Projects into Workspace > Select archive file), will already have a project named "MathExtensions" in the workspace. Thus, the import wizard will warn that "Some projects cannot be imported because they already exist in the workspace", and theories of "MathExtensions" in the archive will not be imported. This page is dedicated to proposing workarounds for this problem.

Solution 1: theories at archive root

When exporting, select option "Create only selected directories", then select project P, but not project MathExtensions, only the T.* files in it, as shown below:

Export P Troot.png

Then clean P and MathExtensions (Project > Clean).

Then, import is done in two steps:

  1. import T: File > Import > Archive File select the archive, untick the P project, only select T.* files at the root, select to import into the MathExtensions as shown on the image below
  2. import P the standard way: File > Import > Existing Projects into Workspace > Select archive file

Import P Troot.png

Note: in this case we chose to only put the .tuf (theory unchecked file) and .bpr (proof file) into the archive, because other files (.tcf, .bpo, .bps) are generated upon build, and .dtf (deployed theory file) is generated when deploying T. It is also possible to put every T.* files in the archive, or only T.dtf. In any case, it is generally preferable to clean imported projects and the MathExtensions project.

This solution is the most conservative one, as other theories that might exist in the importing workspace are conserved.

Solution 2: remove MathExtensions at import

This second solution is the most simple but can be used only when the importer has not developed any theories. It consists in exporting P and T the standard way, so that the archive contains P and MathExtensions projects. Then the importer simply deletes his empty MathExtensions project from the workspace before importing the standard way (File > Import > Existing Projects into Workspace > Select archive file).

Solution 3: temporary project

This solution consists in creating a temporary project, for instance TempMathExtensions, then copying theory files to export in it. The exporter then makes a standard project archive with P and TempMathExtensions (and NOT MathExtensions).

The importer can then import this archive the standard way (File > Import > Existing Projects into Workspace > Select archive file), then copy theory files from TempMathExtensions to MathExtensions, and finally delete TempMathExtensions. A clean of P and MathExtensions is then highly recommended.