From a43a6c6678ef5143e76fc2863b2cea49875ae795 Mon Sep 17 00:00:00 2001 From: Evgeny Goldin Date: Fri, 27 Jan 2012 00:50:36 +0200 Subject: [PATCH] Ant task - "stdlib" attribute added, "excludeStdlib" attribute removed; invokes "bootstrap.xml" and works recursively "clean" task - --- .../buildtools/ant/BytecodeCompilerTask.java | 24 +++++----- build-tools/build.xml | 47 ++++++++----------- .../jet/buildtools/core/BytecodeCompiler.java | 27 ++++------- build.xml | 1 + 4 files changed, 44 insertions(+), 55 deletions(-) diff --git a/build-tools/ant/src/org/jetbrains/jet/buildtools/ant/BytecodeCompilerTask.java b/build-tools/ant/src/org/jetbrains/jet/buildtools/ant/BytecodeCompilerTask.java index 636b71fd9d6..9bfafacf94e 100644 --- a/build-tools/ant/src/org/jetbrains/jet/buildtools/ant/BytecodeCompilerTask.java +++ b/build-tools/ant/src/org/jetbrains/jet/buildtools/ant/BytecodeCompilerTask.java @@ -16,29 +16,31 @@ import java.io.File; */ public class BytecodeCompilerTask extends Task { - private final BytecodeCompiler compiler = new BytecodeCompiler(); + private boolean includeRuntime = true; + private String stdlib; private File module; private File srcdir; private File file; private File destdir; private File destjar; - private boolean includeRuntime = true; - private boolean excludeStdlib = false; - public void setModule ( File module ) { this.module = module; } - public void setSrcdir ( File srcdir ) { this.srcdir = srcdir; } - public void setFile ( File file ) { this.file = file; } - public void setDestdir ( File destdir ) { this.destdir = destdir; } - public void setDestjar ( File destjar ) { this.destjar = destjar; } + + public void setStdlib ( String stdlib ) { this.stdlib = stdlib; } + public void setModule ( File module ) { this.module = module; } + public void setSrcdir ( File srcdir ) { this.srcdir = srcdir; } + public void setFile ( File file ) { this.file = file; } + public void setDestdir ( File destdir ) { this.destdir = destdir; } + public void setDestjar ( File destjar ) { this.destjar = destjar; } public void setIncludeRuntime ( boolean includeRuntime ) { this.includeRuntime = includeRuntime; } - public void setExcludeStdlib ( boolean excludeStdlib ) { this.excludeStdlib = excludeStdlib; } @Override public void execute() { + final BytecodeCompiler compiler = new BytecodeCompiler( this.stdlib ); + if (( this.srcdir != null ) || ( this.file != null )) { if (( this.destdir == null ) && ( this.destjar == null )) { @@ -51,10 +53,10 @@ public class BytecodeCompilerTask extends Task { log( String.format( "[%s] => [%s]", src, dest )); if ( this.destdir != null ) { - compiler.sourcesToDir( src, dest, this.excludeStdlib ); + compiler.sourcesToDir( src, dest ); } else { - compiler.sourcesToJar( src, dest, this.includeRuntime, this.excludeStdlib ); + compiler.sourcesToJar( src, dest, this.includeRuntime ); } } else if ( this.module != null ) { diff --git a/build-tools/build.xml b/build-tools/build.xml index e89f0c7aaac..8e60a1f36df 100644 --- a/build-tools/build.xml +++ b/build-tools/build.xml @@ -43,13 +43,11 @@ - - - - - - + + + + + @@ -60,7 +58,6 @@ - @@ -77,8 +74,11 @@ - - + + + + + @@ -86,10 +86,10 @@ - + - + @@ -98,9 +98,11 @@ - - - + + + + + @@ -110,14 +112,14 @@ - + - + @@ -125,7 +127,7 @@ - + @@ -325,15 +327,6 @@ - - - - - - - - - diff --git a/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java b/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java index 21b28468ee2..36825119b09 100644 --- a/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java +++ b/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java @@ -8,19 +8,14 @@ import org.jetbrains.jet.compiler.CompileEnvironment; */ public class BytecodeCompiler { - private final CompileEnvironment ENV = createCompileEnvironment(); + private final CompileEnvironment ENV; - public BytecodeCompiler () { - } - - - /** - * Creates and initializes new {@link CompileEnvironment} instance. - * @return new {@link CompileEnvironment} instance - */ - private CompileEnvironment createCompileEnvironment () { - return new CompileEnvironment(); + public BytecodeCompiler ( String stdlib ) { + ENV = new CompileEnvironment(); + if ( stdlib != null ) { + ENV.setStdlib( stdlib ); + } } @@ -39,10 +34,9 @@ public class BytecodeCompiler { * * @param source compilation source (directory or file) * @param destination compilation destination - * @param excludeStdlib whether Kotlin standard library is excluded in compilation */ - public void sourcesToDir ( String source, String destination, boolean excludeStdlib ) { - boolean success = ENV.compileBunchOfSources( source, null, destination, true); + public void sourcesToDir ( String source, String destination ) { + boolean success = ENV.compileBunchOfSources( source, null, destination, true ); if ( ! success ) { throw new RuntimeException( compilationError( source )); } @@ -55,10 +49,9 @@ public class BytecodeCompiler { * @param source compilation source (directory or file) * @param jar compilation destination jar * @param includeRuntime whether Kotlin runtime library is included in destination jar - * @param excludeStdlib whether Kotlin standard library is excluded in compilation */ - public void sourcesToJar ( String source, String jar, boolean includeRuntime, boolean excludeStdlib ) { - boolean success = ENV.compileBunchOfSources( source, jar, null, includeRuntime); + public void sourcesToJar ( String source, String jar, boolean includeRuntime ) { + boolean success = ENV.compileBunchOfSources( source, jar, null, includeRuntime ); if ( ! success ) { throw new RuntimeException( compilationError( source )); } diff --git a/build.xml b/build.xml index 5e97513a96f..b10f51103ba 100644 --- a/build.xml +++ b/build.xml @@ -99,6 +99,7 @@ +