Commits
Nothixal authored and md_5 committed eced56f204d
121 121 | } |
122 122 | } |
123 123 | |
124 124 | System.out.println( "Loading BuildTools version: " + buildVersion + " (#" + buildNumber + ")" ); |
125 125 | System.out.println( "Java Version: " + JavaVersion.getCurrentVersion() ); |
126 126 | System.out.println( "Current Path: " + CWD.getAbsolutePath() ); |
127 127 | |
128 128 | if ( CWD.getAbsolutePath().contains( "'" ) || CWD.getAbsolutePath().contains( "#" ) || CWD.getAbsolutePath().contains( "~" ) || CWD.getAbsolutePath().contains( "(" ) || CWD.getAbsolutePath().contains( ")" ) ) |
129 129 | { |
130 130 | System.err.println( Constants.SPECIAL_CHARACTERS_WARNING ); |
131 - | System.exit(1); |
131 + | System.exit( 1 ); |
132 132 | } |
133 133 | |
134 134 | if ( CWD.getAbsolutePath().contains( "Dropbox" ) || CWD.getAbsolutePath().contains( "OneDrive" ) ) |
135 135 | { |
136 136 | System.err.println( Constants.NON_STANDARD_PATH_WARNING ); |
137 - | System.exit(1); |
137 + | System.exit( 1 ); |
138 138 | } |
139 139 | |
140 140 | OptionParser parser = new OptionParser(); |
141 141 | OptionSpec<Void> help = parser.accepts( "help", "Show the help" ); |
142 142 | OptionSpec<Void> disableCertFlag = parser.accepts( "disable-certificate-check", "Disable HTTPS certificate check" ); |
143 143 | OptionSpec<Void> disableJavaCheck = parser.accepts( "disable-java-check", "Disable Java version check" ); |
144 144 | OptionSpec<Void> dontUpdateFlag = parser.accepts( "dont-update", "Don't pull updates from Git" ); |
145 145 | OptionSpec<Void> skipCompileFlag = parser.accepts( "skip-compile", "Skip compilation" ); |
146 146 | OptionSpec<Void> generateSourceFlag = parser.accepts( "generate-source", "Generate source jar" ); |
147 147 | OptionSpec<Void> generateDocsFlag = parser.accepts( "generate-docs", "Generate Javadoc jar" ); |
251 251 | |
252 252 | try |
253 253 | { |
254 254 | runProcess( CWD, "git", "--version" ); |
255 255 | } catch ( Exception ex ) |
256 256 | { |
257 257 | System.out.println( "Could not successfully run git. Please ensure it is installed and functioning. " + ex.getMessage() ); |
258 258 | System.exit( 1 ); |
259 259 | } |
260 260 | |
261 - | try |
262 - | { |
263 - | runProcess( CWD, "git", "config", "--global", "--includes", "user.name" ); |
264 - | } catch ( Exception ex ) |
265 - | { |
266 - | System.out.println( "Git name not set, setting it to default value." ); |
267 - | runProcess( CWD, "git", "config", "--global", "user.name", "BuildTools" ); |
268 - | } |
269 - | try |
270 - | { |
271 - | runProcess( CWD, "git", "config", "--global", "--includes", "user.email" ); |
272 - | } catch ( Exception ex ) |
273 - | { |
274 - | System.out.println( "Git email not set, setting it to default value." ); |
275 - | runProcess( CWD, "git", "config", "--global", "user.email", "unconfigured@null.spigotmc.org" ); |
276 - | } |
277 - | |
278 261 | try |
279 262 | { |
280 263 | runProcess( CWD, "java", "-version" ); |
281 264 | } catch ( Exception ex ) |
282 265 | { |
283 266 | System.out.println( "Could not successfully run Java." + ex.getMessage() ); |
284 267 | System.exit( 1 ); |
285 268 | } |
286 269 | |
287 270 | if ( !dontUpdate && !dev ) |
1001 984 | } |
1002 985 | |
1003 986 | private static int runProcess0(File workDir, String... command) throws Exception |
1004 987 | { |
1005 988 | Preconditions.checkArgument( workDir != null, "workDir" ); |
1006 989 | Preconditions.checkArgument( command != null && command.length > 0, "Invalid command" ); |
1007 990 | |
1008 991 | ProcessBuilder pb = new ProcessBuilder( command ); |
1009 992 | pb.directory( workDir ); |
1010 993 | pb.environment().put( "JAVA_HOME", System.getProperty( "java.home" ) ); |
994 + | pb.environment().put( "GIT_COMMITTER_NAME", "BuildTools" ); |
995 + | pb.environment().put( "GIT_COMMITTER_EMAIL", "unconfigured@null.spigotmc.org" ); |
1011 996 | pb.environment().remove( "M2_HOME" ); // Just let maven figure this out from where it is invoked |
1012 997 | if ( !pb.environment().containsKey( "MAVEN_OPTS" ) ) |
1013 998 | { |
1014 999 | pb.environment().put( "MAVEN_OPTS", "-Xmx1024M" ); |
1015 1000 | } |
1016 1001 | if ( !pb.environment().containsKey( "_JAVA_OPTIONS" ) ) |
1017 1002 | { |
1018 1003 | String javaOptions = "-Djdk.net.URLClassPath.disableClassPathURLCheck=true"; |
1019 1004 | |
1020 1005 | for ( String arg : ManagementFactory.getRuntimeMXBean().getInputArguments() ) |