I have tried this and I think we are on the right track.
I found a bug in the DslTransformation which caused the NPE in circular
dependency check. Fixed in trunk.
The suggested solution from oawforum is difficult to follow and it actually
doesn't solve the cyclic imports problem. I will post something there.
One way, which also has the cyclic imports problem, is to overwrite the
model() function.
List[emf::EObject] model(DslImport this) :
let loaded = model==null?{}:model.load().flatten() :
let loaded2 = loaded.typeSelect(DslModel).imports.model().flatten() :
loaded.union(loaded2);
We don't allow cyclic dependencies between Modules (imports) anyway, but it
would be nice to avoid this problem, since it might cause an infinite loop.
You are right that we can add another import keyword to load project
external models ("common") and mark those with a flag that we propagate
through the transformation all the way to Module so we can skip those
modules in the generation phase.
/Patrik
amphoras wrote:
>
> Hi,
>
> I posted over on the oAW forums about resolving nested imports for design
> files. Someone responded with a solution that looks very promising. This
> obviously does not solve my problem of keeping a "common" model separate
> from my "app" one, but if I can solve this nested imports problem, I am
> pretty sure that I can solve the other one.
>
> The sample solution is in the third post here:
> http://www.openarchitectureware.org/forum/viewtopic.php?showtopic=10600&lastpost=true
>
> I tried to mimic what he was doing by making a few changes for Sculptor's
> DSL. I am having some trouble though. Here's my version:
>
> cached List[DslApplication] allModelElements (DslModel this) :
> imports().app.collect(this.app).flatten();
>
> imports (DslModel this) :
> importClosure( {}.toSet(), { this } );
>
> private Set[DslModel] importClosure (Set[DslModel] result, List[DslModel]
> nextModels) :
> nextModels.isEmpty ? result : (
> let m = nextModels.first() : (
> result.contains(m) ?
> importClosure(result,
> nextModels.withoutFirst()) :
> importClosure(result.add(m).toSet(),
>
> nextModels.withoutFirst().addAll( m.imports.model.flatten()
> ).toList()
> )
> )
> );
>
> List[emf::EObject] allVisibleElements(emf::EObject x):
> ((DslModel)x.eRootContainer).allModelElements();
>
> When I run the generator unit tests, I get:
>
> 625 INFO ConditionalComponent - CheckComponent(sculptordsl-checker):
> expression dslModel.eAllContents.union({dslModel}) check file(s):
> org::fornax::cartridges::sculptor::dsl::GenChecks
> org::fornax::cartridges::sculptor::dsl::Checks
> 1719 ERROR WorkflowRunner - Workflow interrupted. Reason: Errors
> during validation.
> 1719 ERROR WorkflowRunner - Couldn't resolve reference to
> 'PlanetMessage' [EMAIL PROTECTED]
> (eClass: [EMAIL PROTECTED] (name: DslConsumer)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to
> 'MoonMessage' [EMAIL PROTECTED]
> (eClass: [EMAIL PROTECTED] (name: DslConsumer)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to 'Planet'
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslServiceOperation)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to
> 'PlanetManager' [EMAIL PROTECTED]
> (eClass: [EMAIL PROTECTED] (name:
> DslServiceOperationDelegate) (instanceClassName: null) (abstract: false,
> interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to 'Planet'
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to 'XmlMoon'
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to 'Planet'
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to 'Moon'
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to
> 'PlanetManager' [EMAIL PROTECTED]
> (eClass: [EMAIL PROTECTED] (name:
> DslDependency) (instanceClassName: null) (abstract: false, interface:
> false))]
> 1734 ERROR WorkflowRunner - Couldn't resolve reference to
> 'PlanetManager' [EMAIL PROTECTED]
> (eClass: [EMAIL PROTECTED] (name:
> DslDependency) (instanceClassName: null) (abstract: false, interface:
> false))]
> 1734 ERROR WorkflowRunner - Unkown reference moons
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Unkown reference planet
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Opposite should specify this reference as
> opposite: moons" <-> "planet
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
> 1734 ERROR WorkflowRunner - Opposite should specify this reference as
> opposite: planet" <-> "moons
> [EMAIL PROTECTED] (eClass:
> [EMAIL PROTECTED] (name: DslReference)
> (instanceClassName: null) (abstract: false, interface: false))]
>
> It looks like the current model's contents are not being found, so I tried
> to add "this.app" in allModelElements. It's not working though. I'll
> keep beating at this, but if you see something that I'm missing, please
> let me know!
>
> Thanks!
> --Polly
>
>
--
View this message in context:
http://www.nabble.com/-Sculptor--importing-nested-design-files-tp20269181s17564p20274334.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer