Support for Java classes (part 1)
To fully support development workflow for Java, Java classes may now be part of a
Smalltalk/X package (if annotated by stx.libjava.annotation.Package). They have to be
treated specially - there's no version method, they should be stored in a java/src subdirectory
etc)
--- a/common/Make.proto Wed Jul 30 16:10:36 2014 +0000
+++ b/common/Make.proto Thu Jul 31 09:46:33 2014 +0100
@@ -34,7 +34,7 @@
# add the path(es) here:,
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libview2
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libjava -I$(INCLUDE_TOP)/stx/libscm/mercurial -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
# if you need any additional defines for embedded C code,
--- a/common/SCMAbstractFileoutLikeTask.st Wed Jul 30 16:10:36 2014 +0000
+++ b/common/SCMAbstractFileoutLikeTask.st Thu Jul 31 09:46:33 2014 +0100
@@ -204,46 +204,49 @@
versionMethodName := package manager nameOfVersionMethodInClasses.
ActivityNotification notify:'Compiling #version methods...'.
klasses
- withIndexDo:[:cls :index |
- |metaCls|
+ withIndexDo:[:cls :index |
+ |metaCls|
- metaCls := cls theMetaclass.
- ((metaCls includesSelector:versionMethodName) not
- "JV@2012-11-14: libsvn did this check, however, it is not valid for
- SCMs that does not expand keywords. I disable it, but kept as comment
- as I do not remember why it was good for..."
- "or:[ ((cls perform:versionMethodName asSymbol) startsWith:'$Id') not ]")
- ifTrue:[
- metaCls compile:(metaCls
- versionMethodTemplateForSourceCodeManager:package manager)
- classified:'documentation'.
- (metaCls compiledMethodAt:versionMethodName)
- setPackage:package name asSymbol
- ].
- package manager utilities ensureCorrectVersionMethodsInClass: cls usingManager: package manager.
- ^ ProgressNotification newException
- messageText: ('Compiling %1 (%2)' bindWith:versionMethodName
- with:cls nameWithoutPrefix);
- parameter: (100 / klasses size) * index;
- raiseRequest
- ].
+ cls isJavaClass ifFalse:[
+ metaCls := cls theMetaclass.
+ ((metaCls includesSelector:versionMethodName) not
+ "JV@2012-11-14: libsvn did this check, however, it is not valid for
+ SCMs that does not expand keywords. I disable it, but kept as comment
+ as I do not remember why it was good for..."
+ "or:[ ((cls perform:versionMethodName asSymbol) startsWith:'$Id') not ]")
+ ifTrue:[
+ metaCls compile:(metaCls
+ versionMethodTemplateForSourceCodeManager:package manager)
+ classified:'documentation'.
+ (metaCls compiledMethodAt:versionMethodName)
+ setPackage:package name asSymbol
+ ].
+ package manager utilities ensureCorrectVersionMethodsInClass: cls usingManager: package manager.
+ ].
+ ^ ProgressNotification newException
+ messageText: ('Compiling %1 (%2)' bindWith:versionMethodName
+ with:cls nameWithoutPrefix);
+ parameter: (100 / klasses size) * index;
+ raiseRequest
+ ].
(self extensionMethodsToFileOutFor: package) notEmpty ifTrue:[
- | def |
+ | def |
- "TODO: Not programming language aware..."
- ((def := package definition) class includesSelector: package manager nameOfVersionMethodForExtensions) ifFalse:[
- def class
- compile:
- (package manager versionMethodTemplateForSmalltalkFor:package manager nameOfVersionMethodForExtensions)
- classified: #documentation.
- (def class compiledMethodAt:package manager nameOfVersionMethodForExtensions)
- setPackage:package name asSymbol
+ "TODO: Not programming language aware..."
+ ((def := package definition) class includesSelector: package manager nameOfVersionMethodForExtensions) ifFalse:[
+ def class
+ compile:
+ (package manager versionMethodTemplateForSmalltalkFor:package manager nameOfVersionMethodForExtensions)
+ classified: #documentation.
+ (def class compiledMethodAt:package manager nameOfVersionMethodForExtensions)
+ setPackage:package name asSymbol
- ]
+ ]
]
"Created: / 21-02-2014 / 23:01:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-07-2014 / 09:04:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doFileOut
@@ -505,7 +508,7 @@
| prjClass classesSpec classNamesAndAttributesMap |
(packageClassesChanged | packageExtensionsChanged) ifFalse:[
- ^ self
+ ^ self
].
ActivityNotification notify:'Updating project definition'.
prjClass := ProjectDefinition definitionClassForPackage: package name createIfAbsent:true.
@@ -513,28 +516,29 @@
"/Update classlist beforehand - to care about order and removals...
classNamesAndAttributesMap := Dictionary new.
prjClass classNamesAndAttributes do:[:nameOrPair |
- nameOrPair isArray
- ifTrue:[classNamesAndAttributesMap at: nameOrPair first put: nameOrPair]
- ifFalse:[classNamesAndAttributesMap at: nameOrPair put: (Array with: nameOrPair)]
+ nameOrPair isArray
+ ifTrue:[classNamesAndAttributesMap at: nameOrPair first put: nameOrPair]
+ ifFalse:[classNamesAndAttributesMap at: nameOrPair put: (Array with: nameOrPair)]
].
- classesSpec := prjClass searchForClasses collect:[:cls|
- classNamesAndAttributesMap at: cls name ifAbsent:[Array with: cls name]
+ classesSpec := prjClass searchForClasses reject:[:cls | cls isJavaClass ] thenCollect:[:cls|
+ classNamesAndAttributesMap at: cls name ifAbsent:[Array with: cls name]
].
prjClass classNamesAndAttributes:classesSpec usingCompiler:nil.
"/Now do standard update
Class packageQuerySignal answer:prjClass package do:[
- prjClass theNonMetaclass
- forEachContentsMethodsCodeToCompileDo:[:code :category |
- (code startsWith: 'excludedFromPreRequisites')
- ifFalse:[prjClass theMetaclass compile:code classified:category]
- ]
- "/ignoreOldEntries: false
- ignoreOldDefinition: false
+ prjClass theNonMetaclass
+ forEachContentsMethodsCodeToCompileDo:[:code :category |
+ (code startsWith: 'excludedFromPreRequisites')
+ ifFalse:[prjClass theMetaclass compile:code classified:category]
+ ]
+ "/ignoreOldEntries: false
+ ignoreOldDefinition: false
]
"Created: / 21-02-2014 / 23:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-07-2014 / 20:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SCMAbstractFileoutLikeTask methodsFor:'private'!
@@ -619,19 +623,19 @@
"Yet another kludge to trick Smalltalk>>fileNameForClass:, sigh"
savedClassFilenames := Dictionary new.
- (def searchForClasses reject:[:e|e owningClass notNil]) do:
- [:cls|
- savedClassFilenames
- at: cls
- put: cls getClassFilename.
- cls setClassFilename: (package containerNameForClass: cls)].
+ (def searchForClasses reject:[:e|e owningClass notNil or:[ e isJavaClass ] ] ) do:
+ [:cls|
+ savedClassFilenames
+ at: cls
+ put: cls getClassFilename.
+ cls setClassFilename: (package containerNameForClass: cls)].
contents := def generateFile: file.
savedClassFilenames keysAndValuesDo:
- [:cls :classFileName|
- cls setClassFilename: classFileName].
+ [:cls :classFileName|
+ cls setClassFilename: classFileName].
^contents
- "Modified: / 22-02-2014 / 22:47:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-07-2014 / 20:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
shouldFileOutClass: class
--- a/common/SCMAbstractPackageModel.st Wed Jul 30 16:10:36 2014 +0000
+++ b/common/SCMAbstractPackageModel.st Thu Jul 31 09:46:33 2014 +0100
@@ -212,38 +212,50 @@
!
containerNameForClass:cls
- ^self
- containerNameForClassNamed: cls theNonMetaclass fullName
+ | clsName |
+
+ clsName := cls isJavaClass ifTrue:[ cls theNonMetaClass binaryName ] ifFalse:[ cls theNonMetaclass fullName ].
+ ^ self
+ containerNameForClassNamed: clsName
language: cls programmingLanguage
"Created: / 07-10-2012 / 10:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 15-11-2012 / 00:46:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-07-2014 / 08:39:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
containerNameForClassNamed: nm language: lang
^String streamContents:[:s|
- | xlated |
-
- "/ Here, consult abbreviation file...
- lang isSmalltalk ifTrue:[
- | abbrev |
+ "/ Sigh, special case for Java classes. Their code
+ "/ is in java/src subdirectory.
+ lang isJavaLike ifTrue:[
+ s nextPutAll: 'java'.
+ s nextPut: Filename separator.
+ s nextPutAll: 'src'.
+ s nextPut: Filename separator.
+ s nextPutAll: (nm copyReplaceAll: $/ with: Filename separator).
+ ] ifFalse:[
+ | xlated |
- abbrev := self abbrevs at: nm ifAbsent:[ nil ].
- abbrev notNil ifTrue:[
- xlated := abbrev fileName.
+ "/ Here, consult abbreviation file...
+ lang isSmalltalk ifTrue:[
+ | abbrev |
+
+ abbrev := self abbrevs at: nm ifAbsent:[ nil ].
+ abbrev notNil ifTrue:[
+ xlated := abbrev fileName.
+ ].
].
+ xlated isNil ifTrue:[
+ xlated := (nm copyReplaceAll:$: with: $_).
+ ].
+ s nextPutAll: (nm copyReplaceAll:$: with: $_). "/ Q: should't this be nextPutAll: xlated here? See issue #48.
].
- xlated isNil ifTrue:[
- xlated := (nm copyReplaceAll:$: with: $_).
- ].
-
- s nextPutAll: (nm copyReplaceAll:$: with: $_).
s nextPut: $..
- s nextPutAll: lang sourceFileSuffix
+ s nextPutAll: lang sourceFileSuffix.
]
"Created: / 15-11-2012 / 00:45:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 14-03-2014 / 22:00:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 31-07-2014 / 08:54:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
containerNameForExtensions
--- a/common/SCMAbstractPackageWorkingCopy.st Wed Jul 30 16:10:36 2014 +0000
+++ b/common/SCMAbstractPackageWorkingCopy.st Thu Jul 31 09:46:33 2014 +0100
@@ -407,7 +407,7 @@
|stream|
- stream := self containerWriteStreamForClass:cls.
+ stream := self containerWriteStreamForClass:cls.
[
self fileOutClass:cls on:stream
] ensure:[
@@ -417,6 +417,7 @@
"Modified: / 11-06-2009 / 16:18:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Created: / 30-12-2009 / 19:04:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 03-07-2013 / 19:50:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 30-07-2014 / 20:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fileOutClass:cls on:clsStream
@@ -797,6 +798,13 @@
"/ Class which is not loaded could not be changed
class isLoaded ifFalse:[^false].
+ "/ Java classes that has been modified in St/X IDE have
+ "/ its source string set, those loaded from pre-compiled
+ "/ .class file has sourceString nil.
+ class isJavaClass ifTrue:[
+ ^ class sourceString notNil
+ ].
+
class withAllPrivateClassesDo:[:each |
(ChangeSet current includesChangeForClass:each) ifTrue:[ ^ true ].
].
@@ -809,6 +817,7 @@
^false
"Created: / 03-03-2014 / 09:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-07-2014 / 20:52:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
hasChangesInMethod: method
--- a/common/bc.mak Wed Jul 30 16:10:36 2014 +0000
+++ b/common/bc.mak Thu Jul 31 09:46:33 2014 +0100
@@ -39,7 +39,7 @@
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libview2
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libjava -I$(INCLUDE_TOP)\stx\libscm\mercurial -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
LOCALDEFINES=
STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
--- a/common/common.rc Wed Jul 30 16:10:36 2014 +0000
+++ b/common/common.rc Thu Jul 31 09:46:33 2014 +0100
@@ -3,8 +3,8 @@
// automagically generated from the projectDefinition: stx_libscm_common.
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,2,32767,32767
- PRODUCTVERSION 6,2,3,0
+ FILEVERSION 6,2,998,998
+ PRODUCTVERSION 6,2,4,0
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
@@ -20,12 +20,12 @@
BEGIN
VALUE "CompanyName", "Jan Vrany\0"
VALUE "FileDescription", "Source Code Management Support Library for Smalltalk/X (LIB)\0"
- VALUE "FileVersion", "6.2.32767.32767\0"
+ VALUE "FileVersion", "6.2.998.998\0"
VALUE "InternalName", "stx:libscm/common\0"
VALUE "LegalCopyright", "Copyright Jan Vrany 2012\0"
VALUE "ProductName", "Smalltalk/X SCM Support Library\0"
- VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Thu, 01 May 2014 16:12:58 GMT\0"
+ VALUE "ProductVersion", "6.2.4.0\0"
+ VALUE "ProductDate", "Thu, 31 Jul 2014 08:33:47 GMT\0"
END
END