Skip to content

Commit

Permalink
修复kotlin编译打包classpath设置bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchengdong committed Jul 4, 2019
1 parent 9005c68 commit 935f6ed
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ class JarUtil {
List<String> classPath,
CompileOptions compileOptions,
boolean vars) {

def classpathSeparator = ";"
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
classpathSeparator = ":"
}

boolean keepParameters = vars && Jvm.current().javaVersion >= JavaVersion.VERSION_1_8
List<String> javaFiles = new ArrayList<>()
Expand Down Expand Up @@ -137,7 +140,7 @@ class JarUtil {

if (classPath.size() > 0) {
args.add('-classpath')
args.add(classPath.join(";"))
args.add(classPath.join(classpathSeparator))
}

ExitCode exitCode = compiler.exec(System.out, (String[]) args.toArray())
Expand All @@ -151,10 +154,6 @@ class JarUtil {
}

if (!javaFiles.isEmpty()) {
def classpathSeparator = ";"
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
classpathSeparator = ":"
}
def command = "javac " + (keepParameters ? "-parameters" : "") + " -d . -encoding UTF-8 -target " + compileOptions.targetCompatibility.toString() + " -source " + compileOptions.sourceCompatibility.toString() + (classPath.size() > 0 ? (" -classpath " + classPath.join(classpathSeparator) + " ") : "") + javaFiles.join(' ')
def p = (command).execute(null, classesDir)

Expand Down

0 comments on commit 935f6ed

Please sign in to comment.