|
@@ -1,16 +1,30 @@ |
1 |
1 |
|
package com.esotericsoftware.scar; |
2 |
2 |
|
|
|
3 |
+ |
import com.esotericsoftware.filesystem.FilePath; |
|
4 |
+ |
import com.esotericsoftware.filesystem.Paths; |
|
5 |
+ |
import com.esotericsoftware.filesystem.RootedPaths; |
|
6 |
+ |
import com.esotericsoftware.filesystem.ZipFactory; |
|
7 |
+ |
import com.esotericsoftware.scar.support.Parameter; |
|
8 |
+ |
import com.esotericsoftware.scar.support.ProjectFactory; |
|
9 |
+ |
import com.esotericsoftware.utils.FileUtil; |
|
10 |
+ |
import com.esotericsoftware.utils.Util; |
|
11 |
+ |
import com.esotericsoftware.utils.WrappedIOException; |
|
12 |
+ |
import org.litesoft.logger.Logger; |
|
13 |
+ |
import org.litesoft.logger.LoggerFactory; |
|
14 |
+ |
|
|
15 |
+ |
import javax.tools.JavaCompiler; |
|
16 |
+ |
import javax.tools.ToolProvider; |
3 |
17 |
|
import java.io.*; |
4 |
|
- |
import java.util.*; |
5 |
|
- |
import java.util.jar.*; |
6 |
|
- |
import java.util.zip.*; |
7 |
|
- |
import javax.tools.*; |
8 |
|
- |
|
9 |
|
- |
import org.litesoft.logger.*; |
10 |
|
- |
|
11 |
|
- |
import com.esotericsoftware.filesystem.*; |
12 |
|
- |
import com.esotericsoftware.scar.support.*; |
13 |
|
- |
import com.esotericsoftware.utils.*; |
|
18 |
+ |
import java.util.ArrayList; |
|
19 |
+ |
import java.util.Arrays; |
|
20 |
+ |
import java.util.List; |
|
21 |
+ |
import java.util.jar.Attributes; |
|
22 |
+ |
import java.util.jar.JarEntry; |
|
23 |
+ |
import java.util.jar.JarOutputStream; |
|
24 |
+ |
import java.util.jar.Manifest; |
|
25 |
+ |
import java.util.zip.ZipEntry; |
|
26 |
+ |
import java.util.zip.ZipInputStream; |
|
27 |
+ |
import java.util.zip.ZipOutputStream; |
14 |
28 |
|
|
15 |
29 |
|
/** |
16 |
30 |
|
* Generic Data structure that contains information needed to perform tasks. |
|
@@ -18,6 +32,8 @@ |
18 |
32 |
|
@SuppressWarnings("UnusedDeclaration") |
19 |
33 |
|
public class Project extends ProjectParameters |
20 |
34 |
|
{ |
|
35 |
+ |
private static final String JAVA_SOURCE_TARGET_VERSION = "1.6"; |
|
36 |
+ |
|
21 |
37 |
|
protected static final Logger LOGGER = LoggerFactory.getLogger( Project.class ); |
22 |
38 |
|
|
23 |
39 |
|
private static final String META_INF_MANIFEST_MF = "META-INF/MANIFEST.MF"; |
|
@@ -35,9 +51,14 @@ |
35 |
51 |
|
applyDefaults(); |
36 |
52 |
|
} |
37 |
53 |
|
|
|
54 |
+ |
public String getSourceJavaVersion() |
|
55 |
+ |
{ |
|
56 |
+ |
return JAVA_SOURCE_TARGET_VERSION; |
|
57 |
+ |
} |
|
58 |
+ |
|
38 |
59 |
|
public String getTargetJavaVersion() |
39 |
60 |
|
{ |
40 |
|
- |
return "1.6"; |
|
61 |
+ |
return JAVA_SOURCE_TARGET_VERSION; |
41 |
62 |
|
} |
42 |
63 |
|
|
43 |
64 |
|
protected void packageClean() |
|
@@ -724,8 +745,8 @@ |
724 |
745 |
|
args.add( "-d" ); |
725 |
746 |
|
args.add( pClassesDir ); |
726 |
747 |
|
args.add( "-g:source,lines" ); |
727 |
|
- |
args.add( "-target" ); |
728 |
|
- |
args.add( getTargetJavaVersion() ); |
|
748 |
+ |
args.add( "-source" ); |
|
749 |
+ |
args.add( getSourceJavaVersion() ); |
729 |
750 |
|
args.addAll( pSource.getFullPaths() ); |
730 |
751 |
|
if ( !pClasspath.isEmpty() ) |
731 |
752 |
|
{ |
|
@@ -747,8 +768,13 @@ |
747 |
768 |
|
int zError = compiler.run( getCompile_in(), getCompile_out(), getCompile_err(), pCompileArgs.toArray( new String[pCompileArgs.size()] ) ); |
748 |
769 |
|
if ( zError != 0 ) |
749 |
770 |
|
{ |
750 |
|
- |
throw new RuntimeException( |
751 |
|
- |
"Error (" + zError + ") during compilation of project: " + this + "\nSource: " + pSource.count() + " files\nClasspath: " + pClasspath + "\nCompilerArgs: " + pCompileArgs + "\nSource: " + pSource.toString( " " ) ); |
|
771 |
+ |
String zMessage = "Error (" + zError + ") during compilation of project: " + this + |
|
772 |
+ |
"\nSource: " + pSource.count() + " files\nCompilerArgs: " + pCompileArgs; |
|
773 |
+ |
if (LOGGER.debug.isEnabled()) |
|
774 |
+ |
{ |
|
775 |
+ |
zMessage += "\nClasspath: " + pClasspath + "\nSource: " + pSource.toString(" "); |
|
776 |
+ |
} |
|
777 |
+ |
throw new RuntimeException(zMessage); |
752 |
778 |
|
} |
753 |
779 |
|
try |
754 |
780 |
|
{ |