Skip to content

Commit

Permalink
Merge branch 'feature/v1.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimerDude committed Jun 15, 2024
2 parents a05f66f + d80d4ec commit bd67045
Show file tree
Hide file tree
Showing 1,133 changed files with 55,438 additions and 45,475 deletions.
2 changes: 1 addition & 1 deletion com.xored.f4.astView/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: F4 AstView
Bundle-SymbolicName: com.xored.f4.astView;singleton:=true
Bundle-Version: 1.1.6.qualifier
Bundle-Version: 1.1.8.qualifier
Bundle-Vendor: Xored software, Inc.
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime,
Expand Down
2 changes: 1 addition & 1 deletion com.xored.f4.astView/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</parent>
<groupId>com.xored.f4</groupId>
<artifactId>com.xored.f4.astView</artifactId>
<version>1.1.6-SNAPSHOT</version>
<version>1.1.8-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
4 changes: 2 additions & 2 deletions com.xored.f4.builder.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: F4 Builder UI
Bundle-SymbolicName: com.xored.f4.builder.ui;singleton:=true
Bundle-Version: 1.1.6.qualifier
Bundle-Version: 1.1.8.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Xored software, Inc.
Require-Bundle: org.fantom.sys,
org.fantom.concurrent,
com.xored.fanide.core;bundle-version="1.1.6",
com.xored.fanide.core;bundle-version="1.1.8",
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui,
Expand Down
2 changes: 1 addition & 1 deletion com.xored.f4.builder.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</parent>
<groupId>com.xored.f4</groupId>
<artifactId>com.xored.f4.builder.ui</artifactId>
<version>1.1.6-SNAPSHOT</version>
<version>1.1.8-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
6 changes: 3 additions & 3 deletions com.xored.f4.builder/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: F4 Builder
Bundle-SymbolicName: com.xored.f4.builder;singleton:=true
Bundle-Version: 1.1.6.qualifier
Bundle-Version: 1.1.8.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.dltk.core,
org.eclipse.core.runtime,
Expand All @@ -17,8 +17,8 @@ Require-Bundle: org.eclipse.dltk.core,
org.fantom.compiler,
org.fantom.compilerJava,
com.xored.fantom.classfile;bundle-version="1.0.0",
com.xored.f4.core;bundle-version="1.1.6",
com.xored.f4.launching;bundle-version="1.1.6",
com.xored.f4.core;bundle-version="1.1.8",
com.xored.f4.launching;bundle-version="1.1.8",
org.fantom.concurrent,
org.eclipse.dltk.logconsole,
org.eclipse.core.externaltools;bundle-version="1.0.1"
Expand Down
Binary file modified com.xored.f4.builder/f4builder.pod
Binary file not shown.
6 changes: 5 additions & 1 deletion com.xored.f4.builder/fan/Builder.fan
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ abstract class Builder {
}

private CompilerErr projectErr(ProjectErr e) {
CompilerErr.make(e.msg, Loc.makeFile(fp.projectDir , e.line, 0), null, LogLevel.err)
CompilerErr.make(e.msg, Loc.makeFile(fp.projectDir, e.line, 0), null, LogLevel.err)
}

CompilerErr toCompilerErr(Err err, File? file) {
CompilerErr.make(err.msg, Loc.makeFile(file ?: fp.buildFile), null, LogLevel.err)
}

private static Void report(|Str|? consumer, StrBuf out, Str txt) {
Expand Down
78 changes: 64 additions & 14 deletions com.xored.f4.builder/fan/InternalBuilder.fan
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using f4core::FantomProject
using f4core::LogUtil
using compiler
using concurrent::Actor

using [java]org.eclipse.debug.core::DebugPlugin
using [java]org.eclipse.debug.core::ILaunchConfigurationWorkingCopy
Expand Down Expand Up @@ -45,7 +46,7 @@ class InternalBuilder : Builder {
}

logger := ConsoleLogger(consumer)
input := CompilerInput.make
input := CompilerInput()
try {
logBuf := StrBuf().add("\n")
meta := fp.meta.dup
Expand All @@ -63,14 +64,21 @@ class InternalBuilder : Builder {
input.srcFiles = fp.srcDirs
input.resFiles = fp.resDirs
input.jsFiles = fp.jsDirs
input.jsPropsFiles = fp.jsProps
input.outDir = compileDir
input.output = CompilerOutputMode.podFile
input.meta = meta
input.index = fp.index
input.includeDoc = fp.docApi
input.includeSrc = fp.docSrc

errs := compile(input)
// add some backdoors for F4 JS compilation
if (meta["f4.forceJs"] == "true")
input.forceJs = true
if (meta["f4.jsReflectClosures"] == "true")
input.jsReflectClosures = true

errs := compileFan(input)
consumer?.call(logBuf.toStr)

if (errs[0].size > 0)
Expand All @@ -84,16 +92,18 @@ class InternalBuilder : Builder {
oldPodFile := fp.podOutFile
newPodFile := compileDir + `${fp.podName}.pod`

if (!fp.javaDirs.isEmpty)
errs.add(compileJava(consumer, compileDir, resolvedPods))
if (fp.javaDirs.size > 0) {
javaErrs := compileJava(consumer, compileDir, resolvedPods)
errs.add(javaErrs)
}

if (newPodFile.exists) {

// while isPodChanged() is not absolutely needed, I do see more build thrashing without it,
// especially when building F4 itself. Given F4 needs it's pods in the project root dir, it may
// due to Builder (superclass) doing a zero depth refresh
// especially when building F4 itself. Given F4 needs it's pods in the project root dir,
// it may be due to Builder (superclass) doing a zero depth refresh
if (isPodChanged(newPodFile, oldPodFile)) {

// the old behaviour was thus (see below),
// but re-freshing (esp after we'd copied over new pod files)
// caused the entire project to re-build, and it would keep on
Expand All @@ -107,9 +117,24 @@ class InternalBuilder : Builder {
// // refresh Fantom stuff
// fp.project.refreshLocal(IResource.DEPTH_INFINITE, NullProgressMonitor())

// copy pod to outDir
consumer?.call("[DEBUG] Copying pod to ${oldPodFile.osPath}")
newPodFile.copyTo(oldPodFile, ["overwrite" : true])
try {
// copy pod to outDir
// but often (I'm looking at YOU - SkySpark!) the pod is locked and this throws an IoErr
consumer?.call("[DEBUG] Copying pod to ${oldPodFile.osPath}")
newPodFile.copyTo(oldPodFile, ["overwrite" : true])

} catch (Err err) {
// let's not cause a modal pop-up - but fail quietly in the background with a reported err
msg := "${oldPodFile.name} is locked by another process."
msg += "\nPlease end all programs using the .pod file and re-build the project."
msg += "\n${oldPodFile.osPath}"
msg += "\n"
msg += "\n" + err.msg
.replace("java.nio.file.FileSystemException: ", "java.nio.file.FileSystemException:\n ")
.replace(".pod: The process", ".pod\n The process")
com := CompilerErr.make(msg, Loc.makeFile(fp.buildFile), err, LogLevel.err)
errs.add([com])
}
}

// sometimes we re-build just to re-publish, so don't bother checking for pod changes
Expand All @@ -123,7 +148,7 @@ class InternalBuilder : Builder {
// so don't! Delete it when we build again - it all seems fine then.
// compileDir.delete
return errs.flatten

} catch (Err err) {
logger.err("Could not compile ${fp.podName}", err)
LogUtil.logErr(pluginId, "${err.typeof.qname} during build - ${err.msg}", err)
Expand All @@ -133,8 +158,29 @@ class InternalBuilder : Builder {
(input.ns as F4Namespace)?.close
}
}

private static Pod? findPod(Str podName) {
fp := Actor.locals["f4.fp"] as FantomProject
if (fp == null) throw Err("Wot no 'f4.fp' project in Actor.locals?")

podFile := fp.resolvedPods[podName]
if (podFile == null)
return null

// believe me -it is IMPOSSIBLE to create an FPod instance in this Fantom class
// Soooo many weird F4 compilation errors as soon as I reference the "fanx" java package
// much easier to just move everything to a Java class in a different pod
// which is why, I suspect, that JStubGenerator is NOT part of f4builder
// SlimerDude, June 2024
fpod := JStubGenerator.makePod(podName, podFile)

return fpod
}

private CompilerErr[][] compileFan(CompilerInput input) {
Actor.locals["f4.fp"] = this.fp
Actor.locals["f4.compilerEs.podFn"] = #findPod.func

private CompilerErr[][] compile(CompilerInput input) {
caughtErrs := CompilerErr[,]
compiler := Compiler(input)

Expand All @@ -145,6 +191,10 @@ class InternalBuilder : Builder {
LogUtil.logErr(pluginId, "${e.typeof.qname} during build - ${e.msg}", e)
caughtErrs.add(CompilerErr("${e.typeof.qname} ${e.msg} - see Error Log View for details", Loc("CompilerInput")))
}
finally {
Actor.locals.remove("f4.compilerEs.podFn")
Actor.locals.remove("f4.fp")
}
return [caughtErrs.addAll(compiler.errs), compiler.warns]
}

Expand All @@ -157,13 +207,13 @@ class InternalBuilder : Builder {
resolvedPods.each |File file, Str key| {
jmap.put(key, file)
}

// stub generation often "locks" the pod file so it cannot be updated or deleted
// this happens more often when working from flash drives
// reading from a different .pod file at least lets us update the original (with the jstubs)
newPodFile := compileDir + `jstub/${fp.podName}.pod`
podFile.copyTo(newPodFile, ["overwrite":true])
JStubGenerator.generateStubs(newPodFile.osPath, jtemp.osPath, jmap)
JStubGenerator.generateStubs(fp.podName, newPodFile.osPath, jtemp.osPath, jmap)

classpath := fp.classpath.join(File.pathSep) { it.osPath }
javaFiles := listFiles(fp.javaDirs).join(" ") { "\"${it}\"" }
Expand Down
2 changes: 1 addition & 1 deletion com.xored.f4.builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</parent>
<groupId>com.xored.f4</groupId>
<artifactId>com.xored.f4.builder</artifactId>
<version>1.1.6-SNAPSHOT</version>
<version>1.1.8-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
6 changes: 3 additions & 3 deletions com.xored.f4.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: F4 Core
Bundle-SymbolicName: com.xored.f4.core;singleton:=true
Bundle-Version: 1.1.6.qualifier
Bundle-Version: 1.1.8.qualifier
Require-Bundle: org.fantom.sys,
org.fantom.concurrent,
org.eclipse.core.resources,
Expand All @@ -14,8 +14,8 @@ Require-Bundle: org.fantom.sys,
org.eclipse.dltk.launching,
org.eclipse.dltk.logconsole,
com.xored.fanide.core,
com.xored.f4.parser;bundle-version="1.1.6",
com.xored.f4.model;bundle-version="1.1.6",
com.xored.f4.parser;bundle-version="1.1.8",
com.xored.f4.model;bundle-version="1.1.8",
org.eclipse.text,
org.eclipse.pde.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Expand Down
Binary file modified com.xored.f4.core/f4core.pod
Binary file not shown.
2 changes: 2 additions & 0 deletions com.xored.f4.core/fan/manifest/FantomProject.fan
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const class FantomProject {
const Depend[] rawDepends := Depend#.emptyList
const Uri[] resDirs := Uri#.emptyList
const Uri[] jsDirs := Uri#.emptyList
const Uri[] jsProps := Uri#.emptyList
const Uri[] javaDirs := Uri#.emptyList
const Str:Obj index := Str:Obj[:]
const Str:Str meta := Str:Str[:]
Expand Down Expand Up @@ -87,6 +88,7 @@ const class FantomProject {
podOutDir = manifest.outPodDir
resDirs = manifest.resDirs
jsDirs = manifest.jsDirs
jsProps = manifest.jsProps ?: manifest.resDirs // same logic as BuildPod
javaDirs = manifest.javaDirs
meta = manifest.meta.dup
index = manifest.index.dup
Expand Down
10 changes: 7 additions & 3 deletions com.xored.f4.core/fan/manifest/FantomProjectListener.fan
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ internal class DeltaVisitor2 {

WorkspaceChange workspaceChanges() {
WorkspaceChange {
it.closedProjects = this.closedProjects
it.openedProjects = this.openedProjects
it.updatedProjects = this.updatedProjects
it.closedProjects = this.closedProjects // we can't check the nature of closed projects --> java.lang.Exception: Project is not open.
it.openedProjects = this.openedProjects .findAll { isFantomProject(it) }
it.updatedProjects = this.updatedProjects .findAll { isFantomProject(it) }
}
}

private static Bool isFantomProject(IProject ip) {
ip.exists && ip.getNature(F4Nature.id) != null
}

private static Bool contentChanged(IResourceDelta delta) {
switch (delta.getKind) {
case IResourceDelta.CHANGED:
Expand Down
46 changes: 15 additions & 31 deletions com.xored.f4.core/fan/manifest/FantomProjectManager.fan
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,32 @@ internal class FantomProjectManagerState {
// closed or opened projects and for all projects with updated content

projectsToUpdate := [Str:IProject][:] { it.ordered = true }
projectsToRebuild := [Str:IProject][:] { it.ordered = true }


// update updated and opened Fantom projects
change.openedProjects.each {
// not sure why we need to check for Fantom projects?
if (isFantomProject(it)) projectsToUpdate[it.getName] = it
projectsToUpdate[it.getName] = it
}
change.updatedProjects.each {
// not sure why we need to check for Fantom projects?
if (isFantomProject(it)) projectsToUpdate[it.getName] = it
projectsToUpdate[it.getName] = it
}


// update the dependencies of parent projects
change.openedProjects.each {
parentProjects(it).each { projectsToRebuild[it.getName] = it }
parentProjects(it).each {
projectsToUpdate[it.getName] = it
}
}
change.closedProjects.each {
parentProjects(it).each { projectsToRebuild[it.getName] = it }
}


// remove all closed projects
change.closedProjects.each {
parentProjects(it).each {
// reset and re-resolve to remove these annoying errors:
// - Project A is missing required script project: 'Project B'
resetter.reset(it)
projectsToUpdate[it.getName] = it
}

// remove all closed projects
projectsToUpdate .remove(it.getName)
projectsToRebuild.remove(it.getName)
projects .remove(it.getName)
}

Expand All @@ -100,19 +100,7 @@ internal class FantomProjectManagerState {
// reset existing projects so pods get lazily resolved
projects[it.getName].reset
}

projectsToRebuild.vals.each {
fp := projects[it.getName]

// can't think why fp would be null but, you know, belts and braces when in the reactor!
if (fp != null) {
// reset and re-resolve to remove these annoying errors:
// - Project A is missing required script project: 'Project B'
fp.reset
fp.resolvedPods
}
}


return null
}

Expand Down Expand Up @@ -182,8 +170,4 @@ internal class FantomProjectManagerState {
projects[ip.getName] = fp
return true
}

private Bool isFantomProject(IProject ip) {
ip.exists && ip.getNature(F4Nature.id) != null
}
}
11 changes: 6 additions & 5 deletions com.xored.f4.core/fan/manifest/Manifest.fan
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class Manifest {
Str summary() { vals["summary"] ?: "" }
Uri? outPodDir() { vals["outPodDir"] != null ? Uri.fromStr(vals["outPodDir"]) : null }
Str[] depends() { vals["depends"] ?: Str[,] }
Uri[] resDirs() { resolveUris(vals["resDirs"]) }
Uri[] jsDirs() { resolveUris(vals["jsDirs"]) }
Uri[] javaDirs() { resolveUris(vals["javaDirs"]) }
Uri[] resDirs() { resolveUris(vals["resDirs"], false) }
Uri[] jsDirs() { resolveUris(vals["jsDirs"], false) }
Uri[]? jsProps() { resolveUris(vals["jsProps"], true ) }
Uri[] javaDirs() { resolveUris(vals["javaDirs"], false) }
Str:Obj index() { vals["index"] ?: [Str:Obj][:] }
Str:Str meta() { vals["meta"] ?: [Str:Str][:] }
Bool docApi() { vals["docApi"] ?: true }
Expand All @@ -56,10 +57,10 @@ class Manifest {
// Helper methods
//////////////////////////////////////////////////////////////////////////

private static Uri[] resolveUris(Obj? vals) {
private static Uri[]? resolveUris(Obj? vals, Bool nullable) {
res := Uri[,]
(vals as Str[])?.each { res.add(Uri.fromStr(it)) }
return res
return nullable && res.isEmpty ? null : res
}

private static Obj? resolveLiteral(Expr expr) {
Expand Down
Loading

0 comments on commit bd67045

Please sign in to comment.