Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
strategy:
fail-fast: false
matrix:
image: [Pharo64-13, Moose64-13]
include:
- image: Pharo64-13
config: .smalltalk.ston
- image: Moose64-13
config: .smalltalk.moose.ston
services:
postgres:
image: postgres:15
Expand All @@ -43,7 +47,7 @@ jobs:
with:
smalltalk-image: ${{ matrix.image }}
- name: Load and test in a clean image
run: smalltalkci -s '${{ matrix.image }}' .smalltalk.ston
run: smalltalkci -s '${{ matrix.image }}' '${{ matrix.config }}'
- name: Upload JUnit results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down
20 changes: 20 additions & 0 deletions .smalltalk.moose.ston
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SmalltalkCISpec {
#name : 'FAMIXNGSQL-2-Pharo13-Moose13',
#preLoading : 'scripts/ci/prepare-moose.st',
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'FAMIXNGSQL',
#directory : 'src',
#load : [ 'Tests', 'GeneratorTests', 'MooseIDETests' ],
#onConflict : #useIncoming,
#onUpgrade : #useIncoming,
#platforms : [ #pharo ]
}
],
#preTesting : 'scripts/ci/configure-database.st',
#testing : {
#packages : [ 'FamixNGSQL-Importer-Tests', 'FAMIXNGSQLMetamodelGenerator-Tests', 'PgMetadata-tests', 'FamixNGSQL-MooseIDE-Tests' ],
#defaultTimeout : 120,
#failOnZeroTests : true
}
}
24 changes: 24 additions & 0 deletions docs/mooseide-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Optional Moose 13 integration

In a Moose 13 / Pharo 13 image with MooseIDE already installed, load the `MooseIDE`
group of FAMIXNGSQL. `MooseIDETests` adds its regression tests. The plain `Core`
group does not load these packages or require the Moose UI.

```smalltalk
Metacello new
baseline: 'FAMIXNGSQL';
repository: 'github://deem0n/FAMIXNGSQL:master/src';
load: 'MooseIDE'.
```

The Source Text browser automatically selects the SQL adapter. Routine and view
sources display without filesystem anchors. AST highlights are translated from
owner-relative intervals into the displayed fragment; absent, invalid, unrelated
or outside-fragment intervals produce no highlight. Definitions are not modified.

The dependency pin includes the cardinality-aware MooseQuery fix from
`deem0n/Famix` PR #2, required for views with scalar query containment. This is
fork-first v3 development work, not a published v3 release.

GitHub CI loads these optional tests in the ready-made Moose image. The plain
Pharo job continues to test Core without GUI dependencies.
5 changes: 5 additions & 0 deletions scripts/ci/prepare-moose.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"Use immutable archive dependencies, independent of prebuilt Iceberg checkouts.
Only affects the disposable CI image."
Iceberg enableMetacelloIntegration: false.
IceRepository registry copy do: [ :repository |
IceRepository unregisterRepository: repository ifAbsent: [ ] ].
8 changes: 7 additions & 1 deletion src/BaselineOfFAMIXNGSQL/BaselineOfFAMIXNGSQL.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ BaselineOfFAMIXNGSQL >> baseline: spec [
requires: #('FamixNGSQL' 'PostgreSQLParser' 'PgMetadata' 'SymbolResolver' 'PetitParser') ];
package: #'FamixNGSQL-Importer-Tests'
with: [ spec requires: #('FamixNGSQL-Importer' 'PgMetadata-Tests') ];
package: #'FamixNGSQL-MooseIDE'
with: [ spec requires: #('FamixNGSQL-Importer') ];
package: #'FamixNGSQL-MooseIDE-Tests'
with: [ spec requires: #('FamixNGSQL-MooseIDE') ];
package: #'FamixNGSQL-GTInspectorExtension'
with: [ spec requires: #('FamixNGSQL-Importer') ];
package: #FAMIXNGSQLAnalysis
Expand All @@ -29,7 +33,7 @@ BaselineOfFAMIXNGSQL >> baseline: spec [
spec
baseline: 'Famix'
with: [ spec
repository: 'github://moosetechnology/Famix:4fd41546375e0ab86a4920eff547cc898e22db0b/src';
repository: 'github://deem0n/Famix:b0a762751dd06ebe46f98d016943613d28c18d82/src';
loads: #('Core' 'Basic') ].
spec
baseline: 'SymbolResolver'
Expand Down Expand Up @@ -66,5 +70,7 @@ BaselineOfFAMIXNGSQL >> baseline: spec [
group: 'Generator' with: #('Core' 'FAMIXNGSQLMetamodelGenerator');
group: 'GeneratorTests' with: #('Generator' 'FAMIXNGSQLMetamodelGenerator-Tests');
group: 'Tests' with: #('Core' 'FamixNGSQL-Importer-Tests');
group: 'MooseIDE' with: #('Core' 'FamixNGSQL-MooseIDE');
group: 'MooseIDETests' with: #('MooseIDE' 'FamixNGSQL-MooseIDE-Tests');
group: 'LegacyUI' with: #('Core' 'FamixNGSQL-GTInspectorExtension' 'FAMIXNGSQLAnalysis' 'FAMIXNGSQLAnalysis-ConnectionsManager') ]
]
54 changes: 54 additions & 0 deletions src/FamixNGSQL-MooseIDE-Tests/FmxSQLSourceTextAdapterTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Class {
#name : #FmxSQLSourceTextAdapterTest,
#superclass : #TestCase,
#category : #'FamixNGSQL-MooseIDE-Tests'
}
{ #category : #tests }
FmxSQLSourceTextAdapterTest >> testAdapterSelectionAndPlainSourceFallback [
| routine adapter |
routine := FmxSQLStoredProcedure new source: 'SELECT 1'; yourself.
adapter := MiAbstractSourceTextAnchorAdapter adapterFor: routine.
self assert: adapter class equals: FmxSQLSourceTextAdapter.
adapter initializeDisplayedText: routine sourceText andEntity: routine.
self assert: (adapter intervalForEntity: routine) isNil.
self assert: routine sourceText equals: 'SELECT 1'
]
{ #category : #tests }
FmxSQLSourceTextAdapterTest >> testFragmentOffsetsAndForeignOwner [
| owner query reference adapter |
owner := FmxSQLStoredProcedure new source: 'prefix SELECT x suffix'; yourself.
query := FmxSQLSelectQuery new sourceAnchor:
(FmxSQLEntitySourceAnchor new entity: owner; start: 8; end: 15; yourself); yourself.
reference := FmxSQLColumnReference new sourceAnchor:
(FmxSQLEntitySourceAnchor new entity: owner; start: 15; end: 15; yourself); yourself.
adapter := FmxSQLSourceTextAdapter new initializeDisplayedText: query sourceText andEntity: query; yourself.
self assert: (adapter intervalForEntity: reference) equals: (8 to: 8).
reference sourceAnchor start: 1; end: 6.
self assert: (adapter intervalForEntity: reference) isNil.
reference sourceAnchor entity: (FmxSQLStoredProcedure new source: owner source; yourself); start: 15; end: 15.
self assert: (adapter intervalForEntity: reference) isNil
]
{ #category : #tests }
FmxSQLSourceTextAdapterTest >> testInvalidAnchorHasNoHighlight [
| routine reference adapter |
routine := FmxSQLStoredProcedure new source: 'SELECT 1'; yourself.
reference := FmxSQLColumnReference new sourceAnchor:
(FmxSQLEntitySourceAnchor new entity: routine; start: 0; end: 99; yourself); yourself.
adapter := FmxSQLSourceTextAdapter new initializeDisplayedText: routine sourceText andEntity: routine; yourself.
self assert: (adapter intervalForEntity: reference) isNil
]
{ #category : #tests }
FmxSQLSourceTextAdapterTest >> testStandardBrowserOnRoutineAndView [
| model view routine browser |
model := FmxSQLModel new.
view := FmxSQLView new name: 'example'; source: 'SELECT 1'; mooseModel: model; yourself.
FmxSQLSelectQuery new viewDefining: view; mooseModel: model.
routine := FmxSQLStoredProcedure new name: 'example'; source: 'SELECT 1'; mooseModel: model; yourself.
browser := MiSourceTextBrowser new.
[ browser open.
{ routine. view } do: [ :entity |
browser followEntity: entity.
self assert: browser specModel selectedEntity identicalTo: entity.
self assert: browser specModel rendererModel displayedText asString equals: entity sourceText ] ]
ensure: [ browser window ifNotNil: #close ]
]
1 change: 1 addition & 0 deletions src/FamixNGSQL-MooseIDE-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'FamixNGSQL-MooseIDE-Tests' }
34 changes: 34 additions & 0 deletions src/FamixNGSQL-MooseIDE/FmxSQLSourceTextAdapter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"Adapts PostgreSQL definitions and owner-relative AST intervals without file anchors."
Class {
#name : #FmxSQLSourceTextAdapter,
#superclass : #MiAbstractSourceTextAnchorAdapter,
#instVars : [ 'sourceOwner', 'offset' ],
#category : #'FamixNGSQL-MooseIDE'
}
{ #category : #testing }
FmxSQLSourceTextAdapter class >> acceptEntity: entity [
^ (entity isKindOf: FmxSQLEntity) and: [ entity respondsTo: #sourceText ]
]
{ #category : #initialization }
FmxSQLSourceTextAdapter >> initializeDisplayedText: text andEntity: entity [
| anchor |
super initializeDisplayedText: text andEntity: entity.
sourceOwner := entity.
offset := 0.
anchor := entity sourceAnchor.
((anchor isKindOf: FmxSQLEntitySourceAnchor) and: [ anchor hasSourceText ]) ifTrue: [
sourceOwner := anchor entity.
offset := anchor start - 1 ]
]
{ #category : #accessing }
FmxSQLSourceTextAdapter >> intervalForEntity: entity [
| anchor start end |
(entity respondsTo: #sourceAnchor) ifFalse: [ ^ nil ].
anchor := entity sourceAnchor.
((anchor isKindOf: FmxSQLEntitySourceAnchor) and: [ anchor hasSourceText ]) ifFalse: [ ^ nil ].
anchor entity == sourceOwner ifFalse: [ ^ nil ].
start := anchor start - offset.
end := anchor end - offset.
(start > 0 and: [ end >= start and: [ end <= displayedText size ] ]) ifFalse: [ ^ nil ].
^ start to: end
]
1 change: 1 addition & 0 deletions src/FamixNGSQL-MooseIDE/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'FamixNGSQL-MooseIDE' }