diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f811f6a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12f8644 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse +run + +# Files from Forge MDK +forge*changelog.txt diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..94c6738 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "runenv"] + path = runenv + url = https://github.com/amadornes/fg-multiproject-runenv.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3e0492c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 NĂ©stor Amador + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..df8026f --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# ForgeGradle Multiproject Template + +This repository provides a template for multiproject development environments using ForgeGradle. + +## Project structure +This template builds upon the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repo to provide the +binding logic that makes the multiproject environment work. + +The built-in `examplelib` and `examplemod` projects are standard Forge MDK projects, heavily trimmed down for the sake +of simplicity, and are unaware that they exist within a multiproject environment. + +## Setup +To set up a multiproject development environment, just clone this repository. +Optionally, you may delete the `.git` directory and initialize your own git repo in its place. +It is advised to keep the *runenv template* as a submodule, which allows you to easily pull new versions down the line. + +## Customization +The most basic form of customization comes in the form of adding new projects to `settings.gradle`. +Just add new `include 'YourProjectName'` lines in the same place you find the predefined ones. + +If you are authoring several mods that depend on each other, but you still want to be able to compile them on their own, +this template also allows it. +For example, if one of your projects depends on `fg.deobf("com.example:examplelib:1.2.3")`, you can define a +substitution in the root level buildscript: `substitute module("com.example:examplelib") using project(":examplelib")`. +This will make it so whatever depended on that artifact will now depend on the project in your dev environment instead. +Make sure to also define an exclusion for the same module in the `if` statement above it. That will ensure that +ForgeGradle doesn't try to unnecessarily resolve the artifact. + +Further customization can be done by either modifying the *runenv template*, or the `project('runenv')` closure in the +root level buildscript. + +## Generating runs +The run configurations for your multiproject environment should point to the *runenv template*. +You must run that project's `genRuns` task and use its classpath at runtime for all the projects to load. + +For datagen, you may still use each project's individual runs. + +## Known issues +Please check the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repository, as that will contain +the latest information regarding compatibility. + +## Contributions +Pull requests adding extended feature support and bugfixes are welcome. +Please keep them simple if possible. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..931f4f5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,49 @@ +plugins { + id("org.jetbrains.gradle.plugin.idea-ext") version "1.1" +} + +subprojects { + configurations.all { + if (it.name.startsWith("_")) { + // You must exclude the same modules you substitute here, because ForgeGradle + exclude group: "com.example", module: "examplelib" + return + } + + resolutionStrategy.dependencySubstitution { + // Apply substitutions for modules your projects depend on, replacing them with another project + substitute module("com.example:examplelib") using project(":examplelib") + } + + // Uncomment the following line if you are running into issues with dependency resolution. + // The reason is likely transitive dependencies bleeding into other projects and not + // being able to be resolved. Note that doing this will require you to manage certain + // kinds of dependencies (such as those needed at runtime) yourself: + // + // transitive false + } +} + +project('runenv') { + ext { + mcversion = '1.19' + forgeversion = '41.1.0' + // javaversion = 17 // Defaults to 17 already + // mappings = channel: 'official', version: '1.18.2' // Defaults to mojmap for the specified MC version + // runArgs = [ ] // Arguments applied to all runs + // runProps = [ name: value ] // Properties applied to all runs + } + repositories { + // Repositories for additional runtime dependencies go here + } + afterEvaluate { + dependencies { + // This is where any additional runtime dependencies for your dev environment go + } + } +} + +// Ensure the run directory is excluded from the idea module +idea.module { + excludeDirs << file("run") +} diff --git a/examplelib/.gitattributes b/examplelib/.gitattributes new file mode 100644 index 0000000..f811f6a --- /dev/null +++ b/examplelib/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/examplelib/.gitignore b/examplelib/.gitignore new file mode 100644 index 0000000..12f8644 --- /dev/null +++ b/examplelib/.gitignore @@ -0,0 +1,25 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse +run + +# Files from Forge MDK +forge*changelog.txt diff --git a/examplelib/build.gradle b/examplelib/build.gradle new file mode 100644 index 0000000..9a52fa0 --- /dev/null +++ b/examplelib/build.gradle @@ -0,0 +1,105 @@ +buildscript { + repositories { + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + } +} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'eclipse' +apply plugin: 'maven-publish' + +version = _version +group = 'com.example' +archivesBaseName = 'ExampleLib' + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +minecraft { + mappings channel: 'official', version: _mcversion + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + runs { + client { + workingDirectory project.file('run/client') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + examplelib { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run/server') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + examplelib { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run/data') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + args '--mod', 'examplelib', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + + mods { + examplelib { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { +} + +dependencies { + minecraft "net.minecraftforge:forge:${_mcversion}-${_forgeversion}" +} + +jar { + manifest { + attributes([ + "Specification-Title" : "examplelib", + "Specification-Vendor" : "exampleauthor", + "Specification-Version" : "1", + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "exampleauthor", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file://${rootProject.projectDir}/mcmodsrepo" + } + } +} diff --git a/examplelib/gradle.properties b/examplelib/gradle.properties new file mode 100644 index 0000000..a28f336 --- /dev/null +++ b/examplelib/gradle.properties @@ -0,0 +1,3 @@ +_version=0.0.1 +_mcversion=1.19 +_forgeversion=41.1.0 diff --git a/examplelib/src/main/java/com/example/examplelib/ExampleLib.java b/examplelib/src/main/java/com/example/examplelib/ExampleLib.java new file mode 100644 index 0000000..b588f1e --- /dev/null +++ b/examplelib/src/main/java/com/example/examplelib/ExampleLib.java @@ -0,0 +1,25 @@ +package com.example.examplelib; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@Mod("examplelib") +public class ExampleLib +{ + private static final Logger LOGGER = LogManager.getLogger(); + + public ExampleLib() { + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + } + + private void setup(final FMLCommonSetupEvent event) { + LOGGER.info("Hello from the library's preinit"); + } + + public static void printTheThing() { + LOGGER.info("I'm the library and I was asked to print the thing!"); + } +} diff --git a/examplelib/src/main/resources/META-INF/mods.toml b/examplelib/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..ae04eba --- /dev/null +++ b/examplelib/src/main/resources/META-INF/mods.toml @@ -0,0 +1,25 @@ +modLoader="javafml" +loaderVersion="[37,)" +license="MIT" + +[[mods]] +modId="examplelib" +version="${file.jarVersion}" +displayName="Example Lib" +authors="Example Author" +description=''' +This is an example library +''' + +[[dependencies.examplelib]] + modId="forge" + mandatory=true + versionRange="[37,)" + ordering="NONE" + side="BOTH" +[[dependencies.examplelib]] + modId="minecraft" + mandatory=true + versionRange="[1.17.1,1.18)" + ordering="NONE" + side="BOTH" diff --git a/examplelib/src/main/resources/pack.mcmeta b/examplelib/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..c536b8d --- /dev/null +++ b/examplelib/src/main/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "examplelib resources", + "pack_format": 6, + "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." + } +} diff --git a/examplemod/.gitattributes b/examplemod/.gitattributes new file mode 100644 index 0000000..f811f6a --- /dev/null +++ b/examplemod/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/examplemod/.gitignore b/examplemod/.gitignore new file mode 100644 index 0000000..12f8644 --- /dev/null +++ b/examplemod/.gitignore @@ -0,0 +1,25 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse +run + +# Files from Forge MDK +forge*changelog.txt diff --git a/examplemod/build.gradle b/examplemod/build.gradle new file mode 100644 index 0000000..96c195a --- /dev/null +++ b/examplemod/build.gradle @@ -0,0 +1,107 @@ +buildscript { + repositories { + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + } +} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'eclipse' +apply plugin: 'maven-publish' + +version = _version +group = 'com.example' +archivesBaseName = 'ExampleMod' + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +minecraft { + mappings channel: 'official', version: _mcversion + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + runs { + client { + workingDirectory project.file('run/client') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run/server') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run/data') + + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + + mods { + examplemod { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { +} + +dependencies { + minecraft "net.minecraftforge:forge:${_mcversion}-${_forgeversion}" + + implementation fg.deobf("com.example:examplelib:${_libversion}") +} + +jar { + manifest { + attributes([ + "Specification-Title" : "examplemod", + "Specification-Vendor" : "exampleauthor", + "Specification-Version" : "1", + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "exampleauthor", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file://${rootProject.projectDir}/mcmodsrepo" + } + } +} diff --git a/examplemod/gradle.properties b/examplemod/gradle.properties new file mode 100644 index 0000000..1008f89 --- /dev/null +++ b/examplemod/gradle.properties @@ -0,0 +1,5 @@ +_version=0.0.1 +_mcversion=1.19 +_forgeversion=41.1.0 + +_libversion=1.2.3 diff --git a/examplemod/src/main/java/com/example/examplemod/ExampleMod.java b/examplemod/src/main/java/com/example/examplemod/ExampleMod.java new file mode 100644 index 0000000..c46dfcd --- /dev/null +++ b/examplemod/src/main/java/com/example/examplemod/ExampleMod.java @@ -0,0 +1,23 @@ +package com.example.examplemod; + +import com.example.examplelib.ExampleLib; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@Mod("examplemod") +public class ExampleMod +{ + private static final Logger LOGGER = LogManager.getLogger(); + + public ExampleMod() { + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + } + + private void setup(final FMLCommonSetupEvent event) { + LOGGER.info("Hello from the mod's preinit"); + ExampleLib.printTheThing(); + } +} diff --git a/examplemod/src/main/resources/META-INF/mods.toml b/examplemod/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..4039865 --- /dev/null +++ b/examplemod/src/main/resources/META-INF/mods.toml @@ -0,0 +1,31 @@ +modLoader="javafml" +loaderVersion="[37,)" +license="MIT" + +[[mods]] +modId="examplemod" +version="${file.jarVersion}" +displayName="Example Mod" +authors="Example Author" +description=''' +This is an example mod +''' + +[[dependencies.examplemod]] + modId="examplelib" + mandatory=true + versionRange="[0,)" + ordering="NONE" + side="BOTH" +[[dependencies.examplemod]] + modId="forge" + mandatory=true + versionRange="[37,)" + ordering="NONE" + side="BOTH" +[[dependencies.examplemod]] + modId="minecraft" + mandatory=true + versionRange="[1.17.1,1.18)" + ordering="NONE" + side="BOTH" diff --git a/examplemod/src/main/resources/pack.mcmeta b/examplemod/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..c536b8d --- /dev/null +++ b/examplemod/src/main/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "examplelib resources", + "pack_format": 6, + "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..878bf1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0595cf7 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# 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 +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +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" -a "$nonstop" = "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 or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..ac1b06f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/runenv b/runenv new file mode 160000 index 0000000..14b8ff2 --- /dev/null +++ b/runenv @@ -0,0 +1 @@ +Subproject commit 14b8ff21f4d5632a0b6b49ee32acb1d53e205fb0 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..1c37609 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +rootProject.name = 'Multiproject' // Optionally set a custom name for the root + +// This is where all the projects in this environment are registered +// Use the relative path to the directory where their buildscript is in your includes +include 'examplelib' +include 'examplemod' + +// This must always be here +include 'runenv'