Skip to content

Commit

Permalink
RT-31500: Gradle: build in debug mode by default
Browse files Browse the repository at this point in the history
Reviewed-by: Felipe
  • Loading branch information
kevinrushforth committed Oct 7, 2013
1 parent 25ad084 commit 7e466b2
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,10 @@ if (hasProperty("FULL_TEST")) {
}
ext.IS_FULL_TEST = isFullTest;

// Specify the build configuration (Release or Debug)
defineProperty("CONF", "Release")
ext.IS_DEBUG = CONF == "Debug"
// Specify the build configuration (Release, Debug, or DebugNative)
defineProperty("CONF", "Debug")
ext.IS_DEBUG_JAVA = CONF == "Debug" || CONF == "DebugNative"
ext.IS_DEBUG_NATIVE = CONF == "DebugNative"

// Defines the compiler warning levels to use. If empty, then no warnings are generated. If
// not empty, then the expected syntax is as a space or comma separated list of names, such
Expand Down Expand Up @@ -1654,7 +1655,7 @@ allprojects {
// TODO need to file issue with Gradle
compile.options.useAnt = true
compile.options.debug = true // we always generate debugging info in the class files
compile.options.debugOptions.debugLevel = IS_DEBUG ? "source,lines,vars" : "source,lines"
compile.options.debugOptions.debugLevel = IS_DEBUG_JAVA ? "source,lines,vars" : "source,lines"
compile.options.fork = true
compile.options.forkOptions.executable = JAVAC
compile.options.warnings = IS_LINT
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/android.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def ccOptFlags = ["-fpic", "-ffunction-sections", "-funwind-tables","-fstack-pro
def ccWarnFlags = ["-Wa,--noexecstack", "-Wno-psabi"]
def ccArchFlags = ["-mthumb", "-msoft-float", "-D__ARM_ARCH_5__", "-D__ARM_ARCH_5T__", "-D__ARM_ARCH_5E__",
"-D__ARM_ARCH_5TE__", "-march=armv5te" , "-mtune=xscale"]
def ccDebugFlags = [IS_DEBUG ? "-DDEBUG" : "-DNDEBUG"]
def ccDebugFlags = [IS_DEBUG_NATIVE ? "-DDEBUG" : "-DNDEBUG"]
def ccDefaultIncludeFlags = ["-I$ndk/platforms/$ndk_target/arch-arm/usr/include"]

def linkFlags = ["--sysroot=$sysroot",
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/armv6hf.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def commonFlags = [
// Specify the compilation parameters and link parameters
def ccFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def linkFlags = ["-shared", commonFlags].flatten()

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/armv6sf.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def commonFlags = [
// Specify the compilation parameters and link parameters
def ccFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def linkFlags = ["-shared", commonFlags].flatten()

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/ios.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def ccFlags = [
"-miphoneos-version-min=6.0", "-fmessage-length=0", "-std=c99", "-fno-common",
"-Wall", "-fno-strict-aliasing", "-fwrapv", "-fpascal-strings", "-fobjc-abi-version=2", "-fobjc-legacy-dispatch",
"-I$JDK_HOME/include", "-I$JDK_HOME/include/darwin", "-c",
IS_DEBUG ? ["-O0", "-DDEBUG", "-g"] : ["-O3", "-DNDEBUG"]].flatten()
IS_DEBUG_NATIVE ? ["-O0", "-DDEBUG", "-g"] : ["-O3", "-DNDEBUG"]].flatten()

def compiler = "clang"
def linker = "libtool"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/linux.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def commonFlags = [
// Specify the compilation parameters and link parameters
def ccFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def linkFlags = ["-shared", commonFlags].flatten()

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/mac.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def ccFlags = [
"-I$JDK_HOME/include",
"-I$JDK_HOME/include/darwin",
commonParams,
IS_DEBUG ? "-DDEBUG" : ["-O3", "-DNDEBUG"]].flatten()
IS_DEBUG_NATIVE ? "-DDEBUG" : ["-O3", "-DNDEBUG"]].flatten()

def compiler = COMPILE_PARFAIT ? "parfait-gcc" : "gcc";
def cc_compiler = COMPILE_PARFAIT ? "parfait-cc" : "cc";
Expand Down Expand Up @@ -154,7 +154,7 @@ MAC.launcher.ccFlags = [
"-mmacosx-version-min=$MACOSX_MIN_VERSION",
"-arch", "x86_64",
"-framework", "Cocoa",
IS_DEBUG ? ["-DDEBUG", "-O0"] : ["-O3", "-DNDEBUG"]].flatten()
IS_DEBUG_NATIVE ? ["-DDEBUG", "-O0"] : ["-O3", "-DNDEBUG"]].flatten()
MAC.launcher.linker = linker
MAC.launcher.linkFlags = ["-ldl"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LinkTask extends DefaultTask {
} else {
args("-o", "$lib");
}
if (project.IS_DEBUG && !project.IS_WINDOWS) args("-g");
if (project.IS_DEBUG_NATIVE && !project.IS_WINDOWS) args("-g");
if (linkParams != null) args(linkParams);
if (project.IS_WINDOWS){
final String libPath = lib.toString();
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/win.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def ccFlags = ["/nologo", "/W3", "/EHsc", "/c",
"/D_STATIC_CPPLIB", "/D_DISABLE_DEPRECATE_STATIC_CPPLIB", "/DINLINE=__inline",
"/DUNICODE", "/D_UNICODE", "/DWIN32", "/DIAL", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
"/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
IS_DEBUG ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD"]].flatten();
IS_DEBUG_NATIVE ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD"]].flatten();

def linkFlags = ["/nologo", "/dll", "/manifest", "/opt:REF", "/incremental:no"];
if (IS_DEBUG) linkFlags.add("/debug");
if (IS_DEBUG_NATIVE) linkFlags.add("/debug");

setupTools("windows_tools",
{ propFile ->
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/x86egl.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def commonFlags = [
// Specify the compilation parameters and link parameters
def ccFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
IS_DEBUG ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def linkFlags = ["-shared", commonFlags].flatten()

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties.template
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@
#JDK_DOCS = file:///Library/Java/JavaVirtualMachines/jdk1.8.0/Content/Home/docs/api
#JDK_DOCS = relative/path/to/docs/api

# Specify the build configuration (Release or Debug). The default setting is Release.
# Specify the build configuration: Release, Debug, or DebugNative. The default setting is Debug.

#CONF = Debug
#CONF = Release

# Enables the use of the "use depend" feature. This speeds up incremental builds, but at the
# cost of accuracy. Under normal circumstances, if you modify a single source file in the
Expand Down

0 comments on commit 7e466b2

Please sign in to comment.