Skip to content

Commit

Permalink
file null pointer fix, new build
Browse files Browse the repository at this point in the history
  • Loading branch information
knyga committed Apr 29, 2014
1 parent d9dec52 commit 830df61
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ With respect to internal and external dependencies.
Requires Java Runtime Environment version 7.

###How to run
`java -jar kjscompile.jar`
`java -jar kjscompiler.jar`

###Kjscompile.json
###Kjscompiler.json
Instead of kjscompile.json you can specify your own path to configuration file with `--settings %path%` attribute.

`basedir` - directory or array of directories with JavaScript files;
Expand Down
8 changes: 4 additions & 4 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="kjscompile" default="default" basedir=".">
<description>Builds, tests, and runs the project kjscompile.</description>
<project name="kjscompiles" default="default" basedir=".">
<description>Builds, tests, and runs the project kjscompiles.</description>
<import file="nbproject/build-impl.xml"/>

<target name="-post-jar">
<jar jarfile="kjscompile.jar">
<jar jarfile="kjscompiler.jar">
<zipfileset src="${dist.jar}" excludes="META-INF/*" />
<zipfileset src="lib/json-simple-1.1.1.jar" excludes="META-INF/*" />
<zipfileset src="lib/compiler.jar" excludes="META-INF/*" />
<manifest>
<attribute name="Main-Class" value="kjscompile.Program"/>
<attribute name="Main-Class" value="kjscompiler.Program"/>
</manifest>
</jar>
</target>
Expand Down
1 change: 0 additions & 1 deletion examples/chainDoubleInput/kjscompile.sh

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions examples/chainDoubleInput/kjscompiler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -jar ../../kjscompiler.jar
4 changes: 2 additions & 2 deletions examples/external/js.min/all.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
console.log("Except me. I do't care about order");console.log("I should be loaded first. You all depend on me");function addDiv(a){$(document).ready(function(){var b="\x3cdiv\x3e"+a+"\x3c/div\x3e";$("body").append(b)})};console.log("o2");addDiv("o2");console.log("o1");addDiv("o1");console.log("o3");addDiv("o3");console.log("o4");addDiv("o4");console.log("o5");addDiv("o5");
console.log("Except me. I do't care about order");console.log("I should be loaded first. You all depend on me");function addDiv(text){$(document).ready(function(){var cont="\x3cdiv\x3e"+text+"\x3c/div\x3e";$("body").append(cont)})};console.log("o2");addDiv("o2");console.log("o1");addDiv("o1");console.log("o3");addDiv("o3");console.log("o4");addDiv("o4");console.log("o5");addDiv("o5");
/**
@compile {false}
* @ignore
**/
1 change: 0 additions & 1 deletion examples/external/kjscompile.sh

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions examples/external/kjscompiler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -jar ../../kjscompiler.jar
1 change: 0 additions & 1 deletion examples/ignore/kjscompile.sh

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions examples/ignore/kjscompiler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -jar ../../kjscompiler.jar
Binary file renamed kjscompile.jar → kjscompiler.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/kjscompile/Program.java → src/kjscompiler/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class Program {

private static String settingsPath = "kjscompile.json";
private static String settingsPath = "kjscompiler.json";
private static final String settingsArgName = "settings", debugArgName = "debug";
private static Boolean isDebug = false;

Expand Down Expand Up @@ -174,7 +174,7 @@ private static void run() throws ParseException, IOException,
}


System.out.println("\n\n Thank you for using kJScompiler !\n Who said JavaScript can't be compiled ?\n");
System.out.println("\n\n Thank you for using kJScompiler!\n Who said JavaScript can't be compiled?\n");

System.exit(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public Settings(String path) throws ParseException, FileNotFoundException,
IOException {
JSONParser parser = new JSONParser();
File file = new File(path);
File dir = new File(file.exists()?file.getParent():".");
String parent = file.exists()?file.getParent():null;
File dir = new File(null == parent || parent.isEmpty()?".":parent);
FileReader fr = new FileReader(file);
char[] fileData = new char[(int) file.length()];
fr.read(fileData);
Expand Down

0 comments on commit 830df61

Please sign in to comment.