Skip to content
Merged
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
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20191024113542
20191025154731
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20191024113542
20191025154731
5 changes: 4 additions & 1 deletion sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public class CorePlugin extends Plugin {
*
*/
public static String VERSION = "3.2.4.08";
// BH 2019.10.24 support for multiple buildStart
// BH 2019.10.25 -- 3.2.4.09 adds j2s.compiler.java.version (default 8)
// BH 2019.10.25 -- 3.2.4.09 adds j2s.break.on.error (default false)
// BH 2019.10.25 -- 3.2.4.09 fixes missing resource copy for git projects
// BH 2019.10.24 -- 3.2.4.08 support for multiple buildStart
// TODO/NOTE final static int FOO = (/**@j2sNative 5 || */3) stated but not recognized when used as its new value
// BH 2/3/2019 -- 3.2.4.07 fixes "final static Float = (float)" missing definition
// BH 1/2/2019 -- 3.2.4.06 fixes try(resources) with more than one resource missing semicolon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.sf.j2s.core;

import java.util.ArrayList;
import java.util.Date;

import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IJavaProject;
Expand All @@ -21,7 +22,7 @@ public class Java2ScriptCompilationParticipant extends org.eclipse.jdt.core.comp
private static String isActiveNotified = "";

public Java2ScriptCompilationParticipant() {
System.out.println("CompilationParticipant started");
System.out.println("J2S CompilationParticipant started");
}

/**
Expand All @@ -42,9 +43,11 @@ public Java2ScriptCompilationParticipant() {
public boolean isActive(IJavaProject project) {
boolean isj2s = Java2ScriptCompiler.isActive(project);
String loc = " " + project.getProject().getLocation().toString() + " ";
if (isActiveNotified.indexOf(loc) < 0) {
System.out.println("j2s isActive " + isj2s + loc);
isActiveNotified += loc;
// notify only if changed
if (isActiveNotified.indexOf(isj2s + loc) < 0) {
System.out.println("J2S isActive " + isj2s + loc);
isActiveNotified = isActiveNotified.replace((!isj2s) + loc, "");
isActiveNotified += isj2s + loc;
}
return isj2s;
}
Expand All @@ -66,7 +69,7 @@ public boolean isActive(IJavaProject project) {
*/
@Override
public int aboutToBuild(IJavaProject project) {
System.out.println("j2s aboutToBuild " + project.getProject().getName() + " " + project.getProject().getLocation());
System.out.println("J2S aboutToBuild " + project.getProject().getName() + " " + project.getProject().getLocation());
if (contexts == null)
contexts = new ArrayList<>();
return READY_FOR_BUILD;
Expand All @@ -82,7 +85,7 @@ public int aboutToBuild(IJavaProject project) {
*/
@Override
public void cleanStarting(IJavaProject project) {
System.out.println("j2s cleanStarting " + project.getProject().getLocation());
System.out.println("J2S cleanStarting " + project.getProject().getLocation());
isCleanBuild = true;
}

Expand All @@ -103,7 +106,7 @@ public void buildStarting(BuildContext[] files, boolean isBatch) {
if (files.length == 0)
return;
contexts.add(files);
System.out.println("j2s buildStarting " + files.length + " files, contexts.size() = " + contexts.size() + ", isBatch=" + isBatch);
System.out.println("J2S buildStarting " + files.length + " files, contexts.size() = " + contexts.size() + ", isBatch=" + isBatch);
}

/**
Expand All @@ -117,20 +120,20 @@ public void buildStarting(BuildContext[] files, boolean isBatch) {
*/
@Override
public void buildFinished(IJavaProject project) {
if (contexts != null) {
if (contexts != null && contexts.size() > 0) {
Java2ScriptCompiler j2sCompiler = new Java2ScriptCompiler();
boolean breakOnError = j2sCompiler.doBreakOnError();
j2sCompiler.startBuild(isCleanBuild);
if (!j2sCompiler.initializeProject(project, true)) {
System.out.println(".j2s disabled");
System.out.println("J2S .j2s disabled");
return;
}
System.out.println("j2s building JavaScript " + project.getProject().getName() + " "
+ project.getProject().getLocation());
boolean breakOnError = j2sCompiler.doBreakOnError();
System.out.println("J2S building JavaScript " + project.getProject().getName() + " "
+ project.getProject().getLocation() + " " + new Date());
int ntotal = 0, nerror = 0;
for (int j = 0; j < contexts.size(); j++) {
BuildContext[] files = contexts.get(j);
System.out.println("j2s building JavaScript for " + files.length + " file"+plural(files.length));
System.out.println("J2S building JavaScript for " + files.length + " file"+plural(files.length));

for (int i = 0, n = files.length; i < n; i++) {
// trying to keep the progess monitor running - didn't work
Expand All @@ -139,37 +142,38 @@ public void buildFinished(IJavaProject project) {
// } catch (InterruptedException e) {
// // ignore
// }
// System.out.println("j2s file"
// System.out.println("J2S file"
// + " name=" + files[i].getFile().getName()
// + " fullpath=" + files[i].getFile().getFullPath()
// + " location=" + files[i].getFile().getLocation());
//
IFile f = files[i].getFile();
String filePath = f.getLocation().toString();
if (j2sCompiler.excludeFile(f)) {
System.out.println("j2s excluded " + filePath);
System.out.println("J2S excluded " + filePath);
} else {
System.out.println("j2s transpiling (" + (i + 1) + "/" + n + ") " + filePath);
System.out.println("J2S transpiling (" + (i + 1) + "/" + n + ") " + filePath);
if (j2sCompiler.compileToJavaScript(f)) {
ntotal++;
} else {
nerror++;
System.out.println("j2s Error processing " + filePath);
System.out.println("J2S Error processing " + filePath);
if (breakOnError)
break;
}
}
}
}
j2sCompiler.finalizeProject();
contexts = null;
System.out.println(
"j2s buildFinished " + ntotal + " file"+plural(ntotal) + " transpiled for " + project.getProject().getLocation());
System.out.println("j2s buildFinished nerror = " + nerror);
"J2S buildFinished " + ntotal + " file"+plural(ntotal) + " transpiled for " + project.getProject().getLocation());
System.out.println("J2S buildFinished nerror = " + nerror + " " + new Date());
}
isCleanBuild = false;
}

private static String plural(int n) {
static String plural(int n) {
return (n == 1 ? "" : "s");
}

Expand Down
Loading