#REFACTORING by exept
class: ProjectDefinition class
changed:
#allPreRequisites:
#allReferences
#checkIfClassesArePresent
#loadClassLibrary
#loadExtensions
#loadMandatoryPreRequisitesAsAutoloaded:
#loadPreRequisitesAsAutoloaded:
Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
--- a/ProjectDefinition.st Tue Jul 09 20:48:11 2019 +0200
+++ b/ProjectDefinition.st Tue Jul 09 20:50:05 2019 +0200
@@ -215,47 +215,6 @@
!ProjectDefinition class methodsFor:'instance creation'!
-definitionClassForMonticelloPackage:aMonicelloPackagename
- ^ self definitionClassForMonticelloPackage:aMonicelloPackagename createIfAbsent:false
-
- "
- self definitionClassForMonticelloPackage:'foobar'
- "
-!
-
-definitionClassForMonticelloPackage:aMonicelloPackagename createIfAbsent:createIfAbsent
- ^ self allSubclasses
- detect:[:eachProjectDefinition |
- eachProjectDefinition monticelloPackageName = aMonicelloPackagename ]
- ifNone:[
- |dfn squeakPackageInfo|
-
- createIfAbsent ifTrue:[
- dfn := ApplicationDefinition
- definitionClassForPackage:'mc:',aMonicelloPackagename createIfAbsent:true projectType:GUIApplicationType.
-
- "/ if the squeak-stuff is loaded, use it.
- PackageInfo notNil ifTrue:[
- squeakPackageInfo := PackageInfo allSubclasses
- detect:[:pi | pi new packageName = aMonicelloPackagename] ifNone:nil.
- ].
-
- squeakPackageInfo notNil ifTrue:[
- dfn classNames:(squeakPackageInfo new classes collect:[:each | each name]).
- ].
- ] ifFalse:[
- nil
- ]
- ]
-
- "
- self definitionClassForMonticelloPackage:'foobar'
- self definitionClassForMonticelloPackage:'foobar' createIfAbsent:true
- "
-
- "Modified: / 30-10-2010 / 00:26:07 / cg"
-!
-
definitionClassForPackage:aPackageID
"given a packageID (such as 'stx:libfoo/bar'), lookup the corresponding peoject definition class.
Return it, or nil if not present"
@@ -982,6 +941,7 @@
+
!ProjectDefinition class methodsFor:'accessing - packaging'!
classNames:aCollectionOfClassNames
@@ -3014,36 +2974,6 @@
"Created: / 23-01-2007 / 19:08:27 / cg"
! !
-!ProjectDefinition class methodsFor:'description - java'!
-
-javaBundle
- "Defines a Java code bundle provided by this package.
- Used by STX:LIBJAVA"
-
- ^nil
-
- "Created: / 15-01-2013 / 16:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaClassPath
- | bundle |
-
- bundle := self javaBundle.
- ^ bundle notNil ifTrue:[ bundle classPath ] ifFalse: [ #() ]
-
- "Created: / 13-12-2011 / 23:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-01-2015 / 11:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaSourcePath
- | bundle |
-
- bundle := self javaBundle.
- ^ bundle notNil ifTrue:[ bundle sourcePath ] ifFalse: [ #() ]
-
- "Created: / 13-12-2011 / 23:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 21-01-2015 / 11:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
!ProjectDefinition class methodsFor:'description - project information'!
@@ -3914,42 +3844,6 @@
"Created: / 24-02-2011 / 11:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-generate_java_build_auto_dot_xml
- <file: 'java/build.auto.xml' overwrite: true>
-
- self javaBundle isNil ifTrue:[ ^ nil ].
- ^self
- replaceMappings: self java_build_auto_dot_xml_mappings
- in: self java_build_auto_dot_xml
-
- "
- stx_libjava_tools generate_java_build_auto_dot_xml
- stx_libjava_experiments generate_java_build_auto_dot_xml
-
- "
-
- "Created: / 18-01-2015 / 07:32:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 16:55:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-generate_java_build_dot_xml
- <file: 'java/build.xml' overwrite: false>
-
- self javaBundle isNil ifTrue:[ ^ nil ].
- ^self
- replaceMappings: self java_build_dot_xml_mappings
- in: self java_build_dot_xml
-
- "
- stx_libjava_tools generate_java_build_auto_dot_xml
- stx_libjava_experiments generate_java_build_auto_dot_xml
-
- "
-
- "Created: / 19-01-2015 / 07:37:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 16:32:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
generate_lccmake_dot_mak
^self replaceMappings: self bmake_dot_mak_mappings
@@ -4300,30 +4194,6 @@
"Created: / 04-09-2012 / 13:04:26 / cg"
!
-java_build_auto_dot_xml_mappings
- ^ self common_mappings
- at: 'TOP' put: (self pathToTopWithSeparator:'/');
- at: 'PACKAGE_SLASHED' put: (self package copyReplaceAll: $: with: $/);
- at: 'PACKAGE_DOTTED' put: ((self package copyReplaceAll: $: with: $/) replaceAll: $/ with: $.);
- at: 'BUILD_PREREQS_CLASSPATH_REFS' put: (self generateJavaBuildPrereqsClasspathRefs);
- at: 'BUILD_PREREQS_CLASSPATH_PATHS' put: (self generateJavaBuildPrereqsClasspathPaths);
- at: 'BUILD_PREREQS' put: (self generateJavaBuildPrereqs);
- yourself
-
- "Created: / 18-01-2015 / 07:32:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 07:21:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-java_build_dot_xml_mappings
- ^ self common_mappings
- at: 'TOP' put: (self pathToTopWithSeparator:'/');
- at: 'PACKAGE_SLASHED' put: (self package copyReplaceAll: $: with: $/);
- at: 'PACKAGE_DOTTED' put: ((self package copyReplaceAll: $: with: $/) replaceAll: $/ with: $.);
- yourself
-
- "Created: / 19-01-2015 / 07:37:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
make_dot_proto_mappings
^ self common_mappings
at: 'MODULE' put: ( self module );
@@ -5223,68 +5093,6 @@
^ self subProjectMakeCallsUsing:'call vcmake %1 %2'.
! !
-!ProjectDefinition class methodsFor:'file mappings support-Java'!
-
-generateJavaBuildPrereqs
- ^ self generateJavaBuildPrereqsUsingTemplate:
-
-' <target name="prereqs.%(PREREQ_PACKAGE_DOTTED)" extensionOf="prereqs.main">
- <ant antfile="${TOP}/../%(PREREQ_PACKAGE_SLASHED)/java/build.xml"
- target="${ant.project.invoked-targets}"
- inheritAll="false"
- useNativeBasedir="true"/>
- </target>
-'
-
- "Created: / 18-01-2015 / 07:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 07:27:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-generateJavaBuildPrereqsClasspathPaths
- ^ self generateJavaBuildPrereqsUsingTemplate:
-
-' <path id="build.classpath.prereqs.%(PREREQ_PACKAGE_DOTTED)">
- <pathelement path="${TOP}/../%(PREREQ_PACKAGE_SLASHED)/java/bin"/>
- <fileset dir="${TOP}/../%(PREREQ_PACKAGE_SLASHED)/java/libs" includes="*.jar"/>
- </path>
-'
-
- "Created: / 18-01-2015 / 07:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 07:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-generateJavaBuildPrereqsClasspathRefs
- ^ self generateJavaBuildPrereqsUsingTemplate:
-
-' <path refid="build.classpath.prereqs.%(PREREQ_PACKAGE_DOTTED)"/>
-'
-
- "Created: / 18-01-2015 / 07:40:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-generateJavaBuildPrereqsUsingTemplate: template
- | mappings |
-
- mappings := Dictionary new.
- mappings at: 'PACKAGE_SLASHED' put: (self package copyReplaceAll: $: with: $/).
- mappings at: 'PACKAGE_DOTTED' put: ((self package copyReplaceAll: $: with: $/) replaceAll: $/ with: $.).
-
- ^ String streamContents:[ :s |
- ((self preRequisitesFor: self package) asArray sort) do:[:each |
- | def |
-
- def := ProjectDefinition definitionClassForPackage: each createIfAbsent: false.
- def javaBundle notNil ifTrue: [
- mappings at: 'PREREQ_PACKAGE_SLASHED' put: (each copyReplaceAll: $: with: $/).
- mappings at: 'PREREQ_PACKAGE_DOTTED' put: ((each copyReplaceAll: $: with: $/) replaceAll: $/ with: $.).
- s nextPutAll: (template expandPlaceholdersWith: mappings)
- ]
- ].
- ]
-
- "Created: / 18-01-2015 / 07:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 07:29:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
!ProjectDefinition class methodsFor:'file templates'!
@@ -5474,41 +5282,6 @@
"
!
-java_build_auto_dot_xml
- "Template for java/build.auto.xml"
-^ '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!!-- This file has been generated by STX:LIBJAVA. Do not edit!! Edit build.xml instead -->
-<project>
- <property name="TOP" value="../%(TOP)" />
- <import file="${TOP}/libjava/java/build.common.xml"/>
-
- <path id="build.classpath.prereqs">
-%(BUILD_PREREQS_CLASSPATH_REFS)
- </path>
-
-%(BUILD_PREREQS_CLASSPATH_PATHS)
-
-%(BUILD_PREREQS)
-
-</project>
-'
-
- "Created: / 18-01-2015 / 07:32:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2015 / 07:23:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-java_build_dot_xml
- "Template for java/build.xml"
-^ '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project name="%(PACKAGE_DITTED)" default="compile" basedir=".">
- <import file="build.auto.xml"/>
- <!!-- Put custom build code here, this file is never overwritten by Smalltalk/X -->
-</project>
-'
-
- "Created: / 19-01-2015 / 07:35:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
lccmake_dot_mak
"the template code for the lccmake.bat file"
@@ -6131,33 +5904,33 @@
nonExistentClasses := Set new.
check :=
- [:eachClassName |
- |cls fn wasLoaded failedToLoad numClassInstvars|
-
- cls := Smalltalk classNamed:eachClassName.
- cls isNil ifTrue:[
- Transcript showCR:eachClassName.
- nonExistentClasses add:eachClassName.
- ].
- ].
+ [:eachClassName |
+ |cls fn wasLoaded failedToLoad numClassInstvars|
+
+ cls := Smalltalk classNamed:eachClassName.
+ cls isNil ifTrue:[
+ Transcript showCR:eachClassName.
+ nonExistentClasses add:eachClassName.
+ ].
+ ].
self allClassNames do:check.
self namesAndAttributesIn:(self additionalClassNamesAndAttributes) do:[:nm :attr |
- (attr isEmptyOrNil or:[(attr includes:#autoload) not]) ifTrue:[
- check value:nm
- ].
+ (attr isEmptyOrNil or:[(attr includes:#autoload) not]) ifTrue:[
+ check value:nm
+ ].
].
nonExistentClasses notEmpty ifTrue:[
- Transcript showCR:('"%1" and possibly more classes are missing.\Cannot generate a correct "abbrev.stc" file.' bindWith:nonExistentClasses).
- UserPreferences current suppressProjectDefinitionWarnings ifFalse:[
- (Dialog confirm:(Dialog classResources
- stringWithCRs:'"%1" and possibly more classes are missing.\Cannot generate a correct "abbrev.stc" file.\\Continue anyway?'
- with:nonExistentClasses anElement allBold)) ifFalse:[
- AbortOperationRequest raise.
- ].
- ].
- ^ false.
+ Transcript showCR:'"%1" and possibly more classes are missing.\Cannot generate a correct "abbrev.stc" file.' with:nonExistentClasses.
+ UserPreferences current suppressProjectDefinitionWarnings ifFalse:[
+ (Dialog confirm:(Dialog classResources
+ stringWithCRs:'"%1" and possibly more classes are missing.\Cannot generate a correct "abbrev.stc" file.\\Continue anyway?'
+ with:nonExistentClasses anElement allBold)) ifFalse:[
+ AbortOperationRequest raise.
+ ].
+ ].
+ ^ false.
].
^ true
@@ -7134,11 +6907,11 @@
libraryName := self libraryName.
(Smalltalk isClassLibraryLoaded:libraryName) ifTrue:[
- "already loaded"
- ^ true
+ "already loaded"
+ ^ true
].
Verbose ifTrue:[
- Transcript showCR:(' %1: loading classLibrary...' bindWith:self name).
+ Transcript showCR:' %1: loading classLibrary...' with:self name.
].
self activityNotification:'Loading classLibrary'.
@@ -7150,12 +6923,12 @@
self supportedOnPlatform ifFalse:[^ false].
self hasAllExtensionsLoaded ifFalse:[
- self breakPoint:#cg.
- Verbose ifTrue:[
- Transcript showCR:(' %1: filing in extensions...' bindWith:self name).
- ].
- Smalltalk loadExtensionsForPackage:self package.
- ^ true.
+ self breakPoint:#cg.
+ Verbose ifTrue:[
+ Transcript showCR:' %1: filing in extensions...' with:self name.
+ ].
+ Smalltalk loadExtensionsForPackage:self package.
+ ^ true.
].
^ false.
@@ -7191,7 +6964,7 @@
prereq := self effectiveMandatoryPreRequisites.
prereq notEmpty ifTrue:[
Verbose ifTrue:[
- Transcript showCR:(' %1 loading mandatory prerequisites...' bindWith:self name).
+ Transcript showCR:' %1 loading mandatory prerequisites...' with:self name.
].
self loadPackages:prereq asAutoloaded:asAutoloaded
].
@@ -7224,10 +6997,10 @@
prereq := self effectivePreRequisites.
prereq notEmpty ifTrue:[
- Verbose ifTrue:[
- Transcript showCR:(' %1 loading prerequisites...' bindWith:self name).
- ].
- self loadPackages:prereq asAutoloaded:asAutoloaded
+ Verbose ifTrue:[
+ Transcript showCR:' %1 loading prerequisites...' with:self name.
+ ].
+ self loadPackages:prereq asAutoloaded:asAutoloaded
].
!
@@ -7554,11 +7327,11 @@
|result|
result := self
- allPreRequisites:aSelector withParentDo:[:parent :prereq |
- prereq = self package ifTrue:[
- Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
- ].
- ].
+ allPreRequisites:aSelector withParentDo:[:parent :prereq |
+ prereq = self package ifTrue:[
+ Transcript showCR:'oops: %1 depends on itself' with:prereq
+ ].
+ ].
result remove:self package ifAbsent:[].
^ result.
@@ -7738,11 +7511,11 @@
|result|
result := self
- allPreRequisites:#referencedPreRequisites withParentDo:[:parent :prereq |
- prereq = self package ifTrue:[
- Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
- ].
- ].
+ allPreRequisites:#referencedPreRequisites withParentDo:[:parent :prereq |
+ prereq = self package ifTrue:[
+ Transcript showCR:'oops: %1 depends on itself' with:prereq
+ ].
+ ].
result remove:self package ifAbsent:[].
^ result.
@@ -8690,10 +8463,6 @@
"Modified: / 20-09-2006 / 15:00:00 / cg"
!
-isPluginDefinition
- ^ false
-!
-
isProjectDefinition
"concrete i.e. not abstract"