├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── NOTICE.md ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── groovy └── net │ └── minecrell │ └── vanillagradle │ ├── VanillaClientPlugin.groovy │ ├── VanillaPlugin.groovy │ ├── VanillaServerPlugin.groovy │ └── merged │ ├── VanillaMergedExtension.groovy │ └── VanillaMergedPlugin.groovy └── resources └── META-INF └── gradle-plugins ├── net.minecrell.vanillagradle.client.properties ├── net.minecrell.vanillagradle.merged.properties └── net.minecrell.vanillagradle.server.properties /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.bat text eol=crlf 3 | gradlew text eol=lf 4 | *.sh text eol=lf 5 | 6 | ################# 7 | ## Java 8 | ################# 9 | *.java text 10 | *.java diff=java 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ########################## 2 | #### General 3 | ########################## 4 | # https://gist.github.com/octocat/9257657 5 | 6 | *.log 7 | *.bak 8 | 9 | ################# 10 | ## Compiled source 11 | ################# 12 | *.com 13 | *.class 14 | *.dll 15 | *.exe 16 | *.o 17 | *.so 18 | 19 | ################# 20 | ## Archives 21 | ################# 22 | # https://github.com/github/gitignore/blob/master/Global/Archives.gitignore 23 | 24 | # It's better to unpack these files and commit the raw source because 25 | # git has its own built in compression methods. 26 | *.7z 27 | *.jar 28 | *.rar 29 | *.zip 30 | *.gz 31 | *.bzip 32 | *.bz2 33 | *.xz 34 | *.lzma 35 | *.cab 36 | 37 | #packing-only formats 38 | *.iso 39 | *.tar 40 | 41 | #package management formats 42 | *.dmg 43 | *.xpi 44 | *.gem 45 | *.egg 46 | *.deb 47 | *.rpm 48 | *.msi 49 | *.msm 50 | *.msp 51 | 52 | ########################## 53 | #### Operating Systems 54 | ########################## 55 | 56 | ################# 57 | ## Windows 58 | ################# 59 | # https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 60 | 61 | # Windows image file caches 62 | Thumbs.db 63 | ehthumbs.db 64 | 65 | # Folder config file 66 | Desktop.ini 67 | 68 | # Recycle Bin used on file shares 69 | $RECYCLE.BIN/ 70 | 71 | # Windows Installer files 72 | *.cab 73 | *.msi 74 | *.msm 75 | *.msp 76 | 77 | # Windows shortcuts 78 | *.lnk 79 | 80 | ################# 81 | ## OSX 82 | ################# 83 | # https://github.com/github/gitignore/blob/master/Global/OSX.gitignore 84 | 85 | .DS_Store 86 | .AppleDouble 87 | .LSOverride 88 | 89 | # Icon must end with two \r 90 | Icon 91 | 92 | 93 | # Thumbnails 94 | ._* 95 | 96 | # Files that might appear on external disk 97 | .Spotlight-V100 98 | .Trashes 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | ################# 108 | ## Linux 109 | ################# 110 | # https://github.com/github/gitignore/blob/master/Global/Linux.gitignore 111 | 112 | *~ 113 | 114 | # KDE directory preferences 115 | .directory 116 | 117 | ########################## 118 | #### IDE 119 | ########################## 120 | 121 | ################# 122 | ## Eclipse 123 | ################# 124 | # https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore 125 | 126 | # Don't commit project files 127 | .classpath 128 | .project 129 | 130 | *.pydevproject 131 | .metadata 132 | .gradle 133 | bin/ 134 | tmp/ 135 | *.tmp 136 | *.bak 137 | *.swp 138 | *~.nib 139 | local.properties 140 | .settings/ 141 | .loadpath 142 | 143 | # External tool builders 144 | .externalToolBuilders/ 145 | 146 | # Locally stored "Eclipse launch configurations" 147 | *.launch 148 | 149 | # CDT-specific 150 | .cproject 151 | 152 | # PDT-specific 153 | .buildpath 154 | 155 | # sbteclipse plugin 156 | .target 157 | 158 | # TeXlipse plugin 159 | .texlipse 160 | 161 | ################# 162 | ## NetBeans 163 | ################# 164 | # https://github.com/github/gitignore/blob/master/Global/NetBeans.gitignore 165 | 166 | nbproject/private/ 167 | build/ 168 | nbbuild/ 169 | dist/ 170 | nbdist/ 171 | nbactions.xml 172 | nb-configuration.xml 173 | 174 | ################# 175 | ## JetBrains 176 | ################# 177 | # https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore 178 | 179 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 180 | 181 | *.iml 182 | 183 | ## Directory-based project format: 184 | .idea/ 185 | # if you remove the above rule, at least ignore the following: 186 | 187 | # User-specific stuff: 188 | # .idea/workspace.xml 189 | # .idea/tasks.xml 190 | # .idea/dictionaries 191 | 192 | # Sensitive or high-churn files: 193 | # .idea/dataSources.ids 194 | # .idea/dataSources.xml 195 | # .idea/sqlDataSources.xml 196 | # .idea/dynamic.xml 197 | # .idea/uiDesigner.xml 198 | 199 | # Gradle: 200 | # .idea/gradle.xml 201 | # .idea/libraries 202 | 203 | # Mongo Explorer plugin: 204 | # .idea/mongoSettings.xml 205 | 206 | ## File-based project format: 207 | *.ipr 208 | *.iws 209 | 210 | ## Plugin-specific files: 211 | 212 | # IntelliJ 213 | out/ 214 | 215 | # mpeltonen/sbt-idea plugin 216 | .idea_modules/ 217 | 218 | # JIRA plugin 219 | atlassian-ide-plugin.xml 220 | 221 | # Crashlytics plugin (for Android Studio and IntelliJ) 222 | com_crashlytics_export_strings.xml 223 | 224 | ########################## 225 | #### Project 226 | ########################## 227 | 228 | ################# 229 | ## Java 230 | ################# 231 | # https://github.com/github/gitignore/blob/master/Java.gitignore 232 | 233 | *.class 234 | 235 | # Mobile Tools for Java (J2ME) 236 | .mtj.tmp/ 237 | 238 | # Package Files # 239 | *.jar 240 | *.war 241 | *.ear 242 | 243 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 244 | hs_err_pid* 245 | 246 | ################# 247 | ## Gradle 248 | ################# 249 | # https://github.com/github/gitignore/blob/master/Gradle.gitignore 250 | 251 | .gradle 252 | build/ 253 | 254 | # Ignore Gradle GUI config 255 | gradle-app.setting 256 | 257 | # Allow the Gradle wrapper 258 | !gradle-wrapper.jar 259 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: groovy 4 | jdk: 5 | - openjdk7 6 | - oraclejdk7 7 | - oraclejdk8 8 | 9 | notifications: 10 | email: false 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | VanillaGradle - ForgeGradle extension for Vanilla libraries 2 | Copyright (c) 2015, Minecrell 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | VanillaGradle is based on [ForgeGradle](https://github.com/MinecraftForge/ForgeGradle) licensed under the 2 | [GNU Lesser General Public License v2.1](https://github.com/MinecraftForge/ForgeGradle/blob/99002a1cc0074e5e61208b290d2ce602cbe41d69/LICENSE). 3 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-gradle-plugin' 3 | id 'groovy' 4 | 5 | id 'eclipse' 6 | id 'idea' 7 | 8 | id 'maven-publish' 9 | id 'com.gradle.plugin-publish' version '0.9.7' 10 | 11 | id 'net.minecrell.licenser' version '0.3' 12 | } 13 | 14 | group = 'net.minecrell' 15 | version = '2.2-7-SNAPSHOT' 16 | description = 'ForgeGradle 2 extension for Vanilla mods' 17 | 18 | sourceCompatibility = '1.6' 19 | targetCompatibility = '1.6' 20 | 21 | archivesBaseName = project.name.toLowerCase() 22 | 23 | repositories { 24 | jcenter() 25 | maven { 26 | name = 'forge' 27 | url = 'http://files.minecraftforge.net/maven' 28 | } 29 | } 30 | 31 | dependencies { 32 | compile localGroovy() 33 | compileOnly 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' 34 | } 35 | 36 | license { 37 | include '**/*.java' 38 | include '**/*.groovy' 39 | } 40 | 41 | task sourceJar(type: Jar) { 42 | classifier = 'sources' 43 | from sourceSets.main.allSource 44 | } 45 | 46 | pluginBundle { 47 | website = 'https://github.com/Minecrell/VanillaGradle' 48 | vcsUrl = website 49 | description = project.description 50 | tags = ['minecraft', 'mcp', 'sponge'] 51 | 52 | plugins { 53 | serverPlugin { 54 | id = 'net.minecrell.vanillagradle.server' 55 | displayName = 'VanillaGradle server plugin' 56 | description = 'Provides a MCP workspace for the Vanilla server with all run tasks disabled' 57 | } 58 | clientPlugin { 59 | id = 'net.minecrell.vanillagradle.client' 60 | displayName = 'VanillaGradle client plugin' 61 | description = 'Provides a MCP workspace for the Vanilla client with all run tasks disabled' 62 | } 63 | 64 | mergedPlugin { 65 | id = 'net.minecrell.vanillagradle.merged' 66 | displayName = 'VanillaGradle merged plugin' 67 | description = 'Provides a MCP workspace with Vanilla client and server sources merged' 68 | } 69 | } 70 | 71 | mavenCoordinates { 72 | artifactId = project.archivesBaseName 73 | } 74 | } 75 | 76 | publishing { 77 | publications { 78 | mavenJava(MavenPublication) { 79 | artifactId project.archivesBaseName 80 | 81 | from components.java 82 | 83 | artifact sourceJar 84 | 85 | repositories { 86 | maven { 87 | url = System.getenv('REPO_' + (version.endsWith('-SNAPSHOT') ? 'SNAPSHOTS' : 'RELEASES')) ?: "$buildDir/repo" 88 | } 89 | } 90 | } 91 | } 92 | } 93 | 94 | task wrapper(type: Wrapper) { 95 | gradleVersion = '3.3' 96 | } 97 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Minecrell/VanillaGradle/a243dfa09702c8879ba5b5cd4be126f0ee7cb444/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Feb 23 22:00:52 CET 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save ( ) { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'VanillaGradle' 2 | -------------------------------------------------------------------------------- /src/main/groovy/net/minecrell/vanillagradle/VanillaClientPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * VanillaGradle - ForgeGradle extension for Vanilla libraries 3 | * Copyright (c) 2015, Minecrell 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | 24 | package net.minecrell.vanillagradle 25 | 26 | import static net.minecraftforge.gradle.common.Constants.JAR_CLIENT_FRESH 27 | import static net.minecraftforge.gradle.common.Constants.MCP_INJECT 28 | import static net.minecraftforge.gradle.common.Constants.MCP_PATCHES_CLIENT 29 | import static net.minecraftforge.gradle.common.Constants.TASK_DL_CLIENT 30 | 31 | import groovy.transform.CompileStatic 32 | 33 | @CompileStatic 34 | class VanillaClientPlugin extends VanillaPlugin { 35 | 36 | @Override 37 | protected String getJarName() { 38 | "minecraft" 39 | } 40 | 41 | @Override 42 | protected void createDecompTasks(String globalPattern, String localPattern) { 43 | makeDecompTasks(globalPattern, localPattern, 44 | delayedFile(JAR_CLIENT_FRESH), TASK_DL_CLIENT, delayedFile(MCP_PATCHES_CLIENT), delayedFile(MCP_INJECT)) 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/groovy/net/minecrell/vanillagradle/VanillaPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * VanillaGradle - ForgeGradle extension for Vanilla libraries 3 | * Copyright (c) 2015, Minecrell 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | 24 | package net.minecrell.vanillagradle 25 | 26 | import static net.minecraftforge.gradle.common.Constants.CONFIG_MC_DEPS 27 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_DC_RESOLVED 28 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_DP_RESOLVED 29 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_MC 30 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_PROVIDED 31 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_START 32 | import static net.minecraftforge.gradle.user.UserConstants.TASK_DD_COMPILE 33 | import static net.minecraftforge.gradle.user.UserConstants.TASK_DD_PROVIDED 34 | import static net.minecraftforge.gradle.user.UserConstants.TASK_MAKE_START 35 | import static net.minecraftforge.gradle.user.UserConstants.TASK_SETUP_DECOMP 36 | import static net.minecraftforge.gradle.user.UserConstants.TASK_SETUP_DEV 37 | 38 | import net.minecraftforge.gradle.user.ReobfMappingType 39 | import net.minecraftforge.gradle.user.ReobfTaskFactory 40 | import net.minecraftforge.gradle.user.UserBaseExtension 41 | import net.minecraftforge.gradle.user.UserVanillaBasePlugin 42 | import org.gradle.api.artifacts.Configuration 43 | import org.gradle.api.plugins.JavaPlugin 44 | import org.gradle.api.plugins.JavaPluginConvention 45 | import org.gradle.api.tasks.JavaExec 46 | import org.gradle.plugins.ide.idea.model.IdeaModel 47 | 48 | abstract class VanillaPlugin extends UserVanillaBasePlugin { 49 | 50 | @Override 51 | protected void applyVanillaUserPlugin() { 52 | // Scan resource directory for access transformers 53 | extension.atSource(((JavaPluginConvention) project.convention.plugins.java).sourceSets.main) 54 | } 55 | 56 | @Override 57 | protected void setupReobf(ReobfTaskFactory.ReobfTaskWrapper reobf) { 58 | super.setupReobf(reobf) 59 | 60 | // Re-obfuscate to SEARGE by default 61 | reobf.mappingType = ReobfMappingType.SEARGE; 62 | } 63 | 64 | @Override 65 | protected void afterEvaluate() { 66 | super.afterEvaluate() 67 | 68 | // Create dummy task for API source set if it doesn't exist 69 | if (project.tasks.findByName('compileApiJava') == null) { 70 | project.task('compileApiJava') 71 | } 72 | 73 | // Remove start dependency 74 | project.configurations.getByName(CONFIG_START).dependencies.clear() 75 | } 76 | 77 | @Override 78 | protected void makeDecompTasks(String globalPattern, String localPattern, 79 | Object inputJar, String inputTask, Object mcpPatchSet, Object mcpInject) { 80 | super.makeDecompTasks(globalPattern, localPattern, inputJar, inputTask, mcpPatchSet, mcpInject) 81 | 82 | project.tasks.with { 83 | getByName(TASK_SETUP_DEV).dependsOn.remove 'makeStart' 84 | getByName(TASK_SETUP_DECOMP).dependsOn.remove 'makeStart' 85 | getByName(TASK_MAKE_START).enabled = false 86 | withType(JavaExec) { t -> 87 | if (t.dependsOn.contains('makeStart')) { 88 | t.enabled = false 89 | } 90 | } 91 | } 92 | } 93 | 94 | @Override 95 | protected void configureCompilation() { 96 | project.with { 97 | Configuration[] mcConfigs = [ 98 | configurations.getByName(CONFIG_MC), 99 | configurations.getByName(CONFIG_MC_DEPS), 100 | configurations.getByName(CONFIG_DC_RESOLVED), 101 | ] 102 | Configuration[] provided = [ 103 | configurations.getByName(CONFIG_PROVIDED), 104 | configurations.getByName(CONFIG_DP_RESOLVED), 105 | ] 106 | 107 | // For compile we map all dependencies to PROVIDED 108 | configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME).with { 109 | extendsFrom(mcConfigs) 110 | extendsFrom(provided) 111 | } 112 | 113 | // For the test, we map it to COMPILE (so it is available for tests) 114 | configurations.getByName(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME).extendsFrom(mcConfigs) 115 | configurations.getByName(JavaPlugin.TEST_COMPILE_ONLY_CONFIGURATION_NAME).extendsFrom(provided) 116 | } 117 | } 118 | 119 | @Override 120 | protected void configureEclipse() { 121 | // Classpath should be handled by compileOnly configuration 122 | 123 | // Other dependencies 124 | project.tasks.eclipseClasspath.dependsOn TASK_DD_COMPILE, TASK_DD_PROVIDED 125 | } 126 | 127 | @Override 128 | protected void configureIntellij() { 129 | project.with { 130 | extensions.getByType(IdeaModel).module.with { 131 | excludeDirs.addAll files('.gradle', 'build', '.idea', 'out').files 132 | 133 | // Classpath should be handled by compileOnly configuration 134 | 135 | // Fix problems with resource files 136 | inheritOutputDirs = true 137 | } 138 | 139 | // Add deobf task dependencies 140 | tasks.ideaModule.dependsOn TASK_DD_COMPILE, TASK_DD_PROVIDED 141 | } 142 | } 143 | 144 | 145 | @Override 146 | protected final boolean hasServerRun() { 147 | false 148 | } 149 | 150 | @Override 151 | protected final boolean hasClientRun() { 152 | false 153 | } 154 | 155 | @Override 156 | protected final String getClientTweaker(UserBaseExtension ext) { 157 | "" 158 | } 159 | 160 | @Override 161 | protected final String getServerTweaker(UserBaseExtension ext) { 162 | "" 163 | } 164 | 165 | @Override 166 | protected final String getClientRunClass(UserBaseExtension ext) { 167 | "" 168 | } 169 | 170 | @Override 171 | protected final List getClientJvmArgs(UserBaseExtension ext) { 172 | [] 173 | } 174 | 175 | @Override 176 | protected final String getServerRunClass(UserBaseExtension ext) { 177 | "" 178 | } 179 | 180 | @Override 181 | protected final List getServerJvmArgs(UserBaseExtension ext) { 182 | [] 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /src/main/groovy/net/minecrell/vanillagradle/VanillaServerPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * VanillaGradle - ForgeGradle extension for Vanilla libraries 3 | * Copyright (c) 2015, Minecrell 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | 24 | package net.minecrell.vanillagradle 25 | 26 | import static net.minecraftforge.gradle.common.Constants.CONFIG_MC_DEPS 27 | import static net.minecraftforge.gradle.common.Constants.CONFIG_MC_DEPS_CLIENT 28 | import static net.minecraftforge.gradle.common.Constants.JAR_SERVER_PURE 29 | import static net.minecraftforge.gradle.common.Constants.MCP_INJECT 30 | import static net.minecraftforge.gradle.common.Constants.MCP_PATCHES_SERVER 31 | import static net.minecraftforge.gradle.common.Constants.TASK_SPLIT_SERVER 32 | 33 | import groovy.transform.CompileStatic 34 | 35 | @CompileStatic 36 | class VanillaServerPlugin extends VanillaPlugin { 37 | 38 | @Override 39 | protected void applyVanillaUserPlugin() { 40 | super.applyVanillaUserPlugin() 41 | 42 | // Remove client dependencies 43 | def config = project.configurations.getByName(CONFIG_MC_DEPS) 44 | config.extendsFrom = config.extendsFrom - [project.configurations.getByName(CONFIG_MC_DEPS_CLIENT)] 45 | } 46 | 47 | @Override 48 | protected String getJarName() { 49 | "minecraft_server" 50 | } 51 | 52 | @Override 53 | protected void createDecompTasks(String globalPattern, String localPattern) { 54 | makeDecompTasks(globalPattern, localPattern, 55 | delayedFile(JAR_SERVER_PURE), TASK_SPLIT_SERVER, delayedFile(MCP_PATCHES_SERVER), delayedFile(MCP_INJECT)) 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/groovy/net/minecrell/vanillagradle/merged/VanillaMergedExtension.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * VanillaGradle - ForgeGradle extension for Vanilla libraries 3 | * Copyright (c) 2015, Minecrell 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | 24 | package net.minecrell.vanillagradle.merged 25 | 26 | import net.minecraftforge.gradle.common.Constants 27 | import net.minecraftforge.gradle.user.UserBaseExtension 28 | 29 | class VanillaMergedExtension extends UserBaseExtension { 30 | 31 | Object mainClass 32 | 33 | VanillaMergedExtension(VanillaMergedPlugin plugin) { 34 | super(plugin) 35 | } 36 | 37 | String getMainClass() { 38 | return Constants.resolveString(this.mainClass) 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/groovy/net/minecrell/vanillagradle/merged/VanillaMergedPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * VanillaGradle - ForgeGradle extension for Vanilla libraries 3 | * Copyright (c) 2015, Minecrell 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | 24 | package net.minecrell.vanillagradle.merged 25 | 26 | import static net.minecraftforge.gradle.common.Constants.DIR_LOCAL_CACHE 27 | import static net.minecraftforge.gradle.common.Constants.JAR_MERGED 28 | import static net.minecraftforge.gradle.common.Constants.JSON_VERSION 29 | import static net.minecraftforge.gradle.common.Constants.MCP_INJECT 30 | import static net.minecraftforge.gradle.common.Constants.MCP_PATCHES_MERGED 31 | import static net.minecraftforge.gradle.common.Constants.REPLACE_CACHE_DIR 32 | import static net.minecraftforge.gradle.common.Constants.REPLACE_MC_VERSION 33 | import static net.minecraftforge.gradle.common.Constants.TASK_DL_VERSION_JSON 34 | import static net.minecraftforge.gradle.common.Constants.TASK_MERGE_JARS 35 | import static net.minecraftforge.gradle.user.UserConstants.CONFIG_MC 36 | import static net.minecraftforge.gradle.user.UserConstants.TASK_SETUP_CI 37 | import static net.minecraftforge.gradle.user.UserConstants.TASK_SETUP_DEV 38 | 39 | import net.minecraftforge.gradle.common.Constants 40 | import net.minecraftforge.gradle.user.UserBasePlugin 41 | 42 | class VanillaMergedPlugin extends UserBasePlugin { 43 | 44 | private static final String MCP_INSERT = Constants.REPLACE_MCP_CHANNEL + "/" + Constants.REPLACE_MCP_VERSION 45 | private static final String CLEAN_ROOT = REPLACE_CACHE_DIR + "/net/minecraft/minecraft_merged/" + REPLACE_MC_VERSION + "/" + MCP_INSERT 46 | 47 | @Override 48 | protected void applyUserPlugin() { 49 | // patterns 50 | def cleanSuffix = "%s-" + REPLACE_MC_VERSION 51 | def dirtySuffix = "%s-" + REPLACE_MC_VERSION + "-PROJECT(" + project.name + ")" 52 | 53 | makeDecompTasks( 54 | CLEAN_ROOT + "/minecraft_merged" + cleanSuffix, 55 | DIR_LOCAL_CACHE + "/minecraft_merged" + dirtySuffix, 56 | delayedFile(JAR_MERGED), 57 | TASK_MERGE_JARS, 58 | delayedFile(MCP_PATCHES_MERGED), 59 | delayedFile(MCP_INJECT) 60 | ) 61 | 62 | // Add version JSON task to CI and dev workspace tasks 63 | project.tasks.getByName(TASK_SETUP_CI).dependsOn(TASK_DL_VERSION_JSON) 64 | project.tasks.getByName(TASK_SETUP_DEV).dependsOn(TASK_DL_VERSION_JSON) 65 | } 66 | 67 | @Override 68 | protected void afterDecomp(boolean isDecomp, boolean useLocalCache, String mcConfig) { 69 | project.allprojects { 70 | addFlatRepo(it, "VanillaMcRepo", delayedFile(useLocalCache ? DIR_LOCAL_CACHE : CLEAN_ROOT).call()) 71 | } 72 | 73 | // Add the MC dependency 74 | def group = "net.minecraft" 75 | def artifact = "minecraft_merged" + (isDecomp ? "Src" : "Bin") 76 | def version = delayedString(REPLACE_MC_VERSION).call() + (useLocalCache ? "-PROJECT(" + project.name + ")" : "") 77 | 78 | project.dependencies.add(CONFIG_MC, [group: group, name: artifact, version: version]) 79 | } 80 | 81 | @Override 82 | protected void afterEvaluate() { 83 | def jsonFile = delayedFile(JSON_VERSION).call() 84 | if (jsonFile.exists()) { 85 | parseAndStoreVersion(jsonFile, jsonFile.parentFile) 86 | } 87 | 88 | super.afterEvaluate() 89 | } 90 | 91 | @Override 92 | protected boolean hasServerRun() { 93 | return true 94 | } 95 | 96 | @Override 97 | protected boolean hasClientRun() { 98 | return true 99 | } 100 | 101 | @Override 102 | protected Object getStartDir() { 103 | return delayedFile(DIR_LOCAL_CACHE + '/start') 104 | } 105 | 106 | @Override 107 | protected String getClientTweaker(VanillaMergedExtension ext) { 108 | return '' 109 | } 110 | 111 | @Override 112 | protected String getServerTweaker(VanillaMergedExtension ext) { 113 | return '' 114 | } 115 | 116 | @Override 117 | protected String getClientRunClass(VanillaMergedExtension ext) { 118 | return ext.mainClass 119 | } 120 | 121 | @Override 122 | protected List getClientRunArgs(VanillaMergedExtension ext) { 123 | return ext.resolvedClientRunArgs 124 | } 125 | 126 | @Override 127 | protected List getClientJvmArgs(VanillaMergedExtension ext) { 128 | return ext.resolvedClientJvmArgs 129 | } 130 | 131 | @Override 132 | protected String getServerRunClass(VanillaMergedExtension ext) { 133 | return ext.mainClass 134 | } 135 | 136 | @Override 137 | protected List getServerRunArgs(VanillaMergedExtension ext) { 138 | return ext.resolvedServerRunArgs 139 | } 140 | 141 | @Override 142 | protected List getServerJvmArgs(VanillaMergedExtension ext) { 143 | return ext.resolvedServerJvmArgs 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle-plugins/net.minecrell.vanillagradle.client.properties: -------------------------------------------------------------------------------- 1 | implementation-class=net.minecrell.vanillagradle.VanillaClientPlugin 2 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle-plugins/net.minecrell.vanillagradle.merged.properties: -------------------------------------------------------------------------------- 1 | implementation-class=net.minecrell.vanillagradle.merged.VanillaMergedPlugin 2 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle-plugins/net.minecrell.vanillagradle.server.properties: -------------------------------------------------------------------------------- 1 | implementation-class=net.minecrell.vanillagradle.VanillaServerPlugin 2 | --------------------------------------------------------------------------------