mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r=sebastian
The sub-project definitions are still in the object directory (and still installed by |mach gradle-install); over time, we'll migrate them out. The Gradle wrapper and {settings,build}.gradle in topsrcdir are identical to those in mobile/android/gradle. I don't like the duplication, but I also don't want the burden of keeping the two configurations identical. We'll move away from the configuration using mobile/android/gradle as quickly as we can.
This commit is contained in:
parent
a36f43d298
commit
304165afc6
@ -52,8 +52,12 @@ _OPT\.OBJ/
|
|||||||
\.cproject$
|
\.cproject$
|
||||||
\.settings/
|
\.settings/
|
||||||
|
|
||||||
# Ignore the directory that JetBrains IDEs create
|
# Ignore the files and directory that JetBrains IDEs create.
|
||||||
\.idea/
|
\.idea/
|
||||||
|
\.iml$
|
||||||
|
|
||||||
|
# Gradle cache.
|
||||||
|
^.gradle/
|
||||||
|
|
||||||
# Python stuff installed at build time.
|
# Python stuff installed at build time.
|
||||||
^python/psutil/.*\.so
|
^python/psutil/.*\.so
|
||||||
|
102
build.gradle
Normal file
102
build.gradle
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
// Expose the per-object-directory configuration to all projects.
|
||||||
|
ext {
|
||||||
|
mozconfig = gradle.mozconfig
|
||||||
|
topsrcdir = gradle.mozconfig.topsrcdir
|
||||||
|
topobjdir = gradle.mozconfig.topobjdir
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDir "${topobjdir}/gradle/build"
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
|
||||||
|
// For spoon-gradle-plugin SNAPSHOT release. This needs to go before
|
||||||
|
// the snapshots repository, otherwise we find a remote 1.0.3-SNAPSHOT
|
||||||
|
// that doesn't include nalexander's local changes.
|
||||||
|
maven {
|
||||||
|
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
|
||||||
|
}
|
||||||
|
// For spoon SNAPSHOT releases.
|
||||||
|
maven {
|
||||||
|
url 'https://oss.sonatype.org/content/repositories/snapshots'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Unit testing support was added in 1.1.0. IntelliJ 14.1.4 and Android
|
||||||
|
// Studio 1.2.1.1 appear to work fine with plugin version 1.3.0.
|
||||||
|
classpath 'com.android.tools.build:gradle:1.3.0'
|
||||||
|
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.3-SNAPSHOT') {
|
||||||
|
// Without these, we get errors linting.
|
||||||
|
exclude module: 'guava'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task generateCodeAndResources(type:Exec) {
|
||||||
|
workingDir "${topobjdir}"
|
||||||
|
|
||||||
|
commandLine mozconfig.substs.GMAKE
|
||||||
|
args '-C'
|
||||||
|
args "${topobjdir}/mobile/android/base"
|
||||||
|
args 'gradle-targets'
|
||||||
|
|
||||||
|
// Only show the output if something went wrong.
|
||||||
|
ignoreExitValue = true
|
||||||
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
errorOutput = standardOutput
|
||||||
|
doLast {
|
||||||
|
if (execResult.exitValue != 0) {
|
||||||
|
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip unit test for all build variants, unless if it was specifically requested by user.
|
||||||
|
// The enabled property for the unit test tasks is reset based on the command line task names just before the task execution.
|
||||||
|
// I bet there is a easier/cleaner way to do this, but this gets the job done for now.
|
||||||
|
Pattern pattern = Pattern.compile('.*test(.+UnitTest)?.*')
|
||||||
|
boolean startTasksIncludeTest = gradle.startParameter.taskNames.any {
|
||||||
|
taskName ->
|
||||||
|
taskName.matches(pattern)
|
||||||
|
}
|
||||||
|
gradle.taskGraph.beforeTask {
|
||||||
|
Task task ->
|
||||||
|
if (task.name.matches(pattern)) {
|
||||||
|
task.enabled = startTasksIncludeTest
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
subprojects {
|
||||||
|
if (!hasProperty('android')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
android.applicationVariants.all {
|
||||||
|
preBuild.dependsOn rootProject.generateCodeAndResources
|
||||||
|
}
|
||||||
|
android.libraryVariants.all {
|
||||||
|
preBuild.dependsOn rootProject.generateCodeAndResources
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
idea {
|
||||||
|
project {
|
||||||
|
languageLevel = '1.7'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Sun Oct 18 17:00:46 PDT 2015
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
160
gradlew
vendored
Executable file
160
gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
@ -23,7 +23,7 @@ buildscript {
|
|||||||
// the snapshots repository, otherwise we find a remote 1.0.3-SNAPSHOT
|
// the snapshots repository, otherwise we find a remote 1.0.3-SNAPSHOT
|
||||||
// that doesn't include nalexander's local changes.
|
// that doesn't include nalexander's local changes.
|
||||||
maven {
|
maven {
|
||||||
url "file://${topsrcdir}/mobile/android/gradle/m2repo"
|
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
|
||||||
}
|
}
|
||||||
// For spoon SNAPSHOT releases.
|
// For spoon SNAPSHOT releases.
|
||||||
maven {
|
maven {
|
||||||
|
43
settings.gradle
Normal file
43
settings.gradle
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// You might think topsrcdir is '.', but that's not true when the Gradle build
|
||||||
|
// is launched from within IntelliJ.
|
||||||
|
def topsrcdir = rootProject.projectDir.absolutePath
|
||||||
|
|
||||||
|
def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
|
||||||
|
def proc = commandLine.execute(null, new File(topsrcdir))
|
||||||
|
def standardOutput = new ByteArrayOutputStream()
|
||||||
|
proc.consumeProcessOutput(standardOutput, standardOutput)
|
||||||
|
proc.waitFor()
|
||||||
|
|
||||||
|
// Only show the output if something went wrong.
|
||||||
|
if (proc.exitValue() != 0) {
|
||||||
|
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n${standardOutput.toString()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
|
def slurper = new JsonSlurper()
|
||||||
|
def json = slurper.parseText(standardOutput.toString())
|
||||||
|
|
||||||
|
include ':app'
|
||||||
|
include ':base'
|
||||||
|
include ':omnijar'
|
||||||
|
include ':thirdparty'
|
||||||
|
|
||||||
|
def gradleRoot = new File("${json.topobjdir}/mobile/android/gradle")
|
||||||
|
project(':app').projectDir = new File(gradleRoot, 'app')
|
||||||
|
project(':base').projectDir = new File(gradleRoot, 'base')
|
||||||
|
project(':omnijar').projectDir = new File(gradleRoot, 'omnijar')
|
||||||
|
project(':thirdparty').projectDir = new File(gradleRoot, 'thirdparty')
|
||||||
|
|
||||||
|
if (json.substs.MOZ_INSTALL_TRACKING) {
|
||||||
|
include ':thirdparty_adjust_sdk'
|
||||||
|
project(':thirdparty_adjust_sdk').projectDir = new File(gradleRoot, 'thirdparty_adjust_sdk')
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Gradle instance is shared between settings.gradle and all the
|
||||||
|
// other build.gradle files (see
|
||||||
|
// http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
|
||||||
|
// We use this ext property to pass the per-object-directory mozconfig
|
||||||
|
// between scripts. This lets us execute set-up code before we gradle
|
||||||
|
// tries to configure the project even once, and as a side benefit
|
||||||
|
// saves invoking |mach environment| multiple times.
|
||||||
|
gradle.ext.mozconfig = json
|
Loading…
Reference in New Issue
Block a user