Commits
md_5 authored e1b1e1bbad6
91 91 | private static boolean dontUpdate; |
92 92 | private static List<Compile> compile; |
93 93 | private static boolean generateSource; |
94 94 | private static boolean generateDocs; |
95 95 | private static boolean dev; |
96 96 | private static boolean remapped; |
97 97 | private static List<PullRequest> pullRequests; |
98 98 | private static String applyPatchesShell = "sh"; |
99 99 | private static boolean didClone = false; |
100 100 | // |
101 - | private static BuildInfo buildInfo = new BuildInfo( "dev", "Development", 0, null, new BuildInfo.Refs( "master", "master", "master", "master" ) ); |
101 + | private static BuildInfo buildInfo = BuildInfo.DEV; |
102 102 | // |
103 103 | private static File msysDir; |
104 104 | private static File maven; |
105 105 | |
106 106 | public static void main(String[] args) throws Exception |
107 107 | { |
108 108 | logOutput(); |
109 109 | |
110 110 | // May be null |
111 111 | String buildVersion = Builder.class.getPackage().getImplementationVersion(); |
155 155 | |
156 156 | OptionParser parser = new OptionParser(); |
157 157 | OptionSpec<Void> help = parser.accepts( "help", "Show the help" ); |
158 158 | OptionSpec<Void> disableCertFlag = parser.accepts( "disable-certificate-check", "Disable HTTPS certificate check" ); |
159 159 | OptionSpec<Void> disableJavaCheck = parser.accepts( "disable-java-check", "Disable Java version check" ); |
160 160 | OptionSpec<Void> dontUpdateFlag = parser.accepts( "dont-update", "Don't pull updates from Git" ); |
161 161 | OptionSpec<Void> skipCompileFlag = parser.accepts( "skip-compile", "Skip compilation" ); |
162 162 | OptionSpec<Void> generateSourceFlag = parser.accepts( "generate-source", "Generate source jar" ); |
163 163 | OptionSpec<Void> generateDocsFlag = parser.accepts( "generate-docs", "Generate Javadoc jar" ); |
164 164 | OptionSpec<Void> devFlag = parser.accepts( "dev", "Development mode" ); |
165 + | OptionSpec<Void> experimentalFlag = parser.accepts( "experimental", "Build experimental version" ); |
165 166 | OptionSpec<Void> remappedFlag = parser.accepts( "remapped", "Produce and install extra remapped jars" ); |
166 167 | OptionSpec<File> outputDir = parser.acceptsAll( Arrays.asList( "o", "output-dir" ), "Final jar output directory" ).withRequiredArg().ofType( File.class ).defaultsTo( CWD ); |
167 168 | OptionSpec<String> jenkinsVersion = parser.accepts( "rev", "Version to build" ).withRequiredArg().defaultsTo( "latest" ); |
168 169 | OptionSpec<Compile> toCompile = parser.accepts( "compile", "Software to compile" ).withRequiredArg().ofType( Compile.class ).withValuesConvertedBy( new EnumConverter<Compile>( Compile.class ) |
169 170 | { |
170 171 | } ).withValuesSeparatedBy( ',' ); |
171 172 | OptionSpec<Void> compileIfChanged = parser.accepts( "compile-if-changed", "Run BuildTools only when changes are detected in the repository" ); |
172 173 | OptionSpec<PullRequest> buildPullRequest = parser.acceptsAll( Arrays.asList( "pull-request", "pr" ), "Build specific pull requests" ).withOptionalArg().withValuesConvertedBy( new PullRequest.PullRequestConverter() ); |
173 174 | |
174 175 | OptionSet options = parser.parse( args ); |
179 180 | System.exit( 0 ); |
180 181 | } |
181 182 | if ( options.has( disableCertFlag ) ) |
182 183 | { |
183 184 | disableHttpsCertificateCheck(); |
184 185 | } |
185 186 | dontUpdate = options.has( dontUpdateFlag ); |
186 187 | generateSource = options.has( generateSourceFlag ); |
187 188 | generateDocs = options.has( generateDocsFlag ); |
188 189 | dev = options.has( devFlag ); |
190 + | // Experimental implies dev but with different refs |
191 + | if ( options.has( experimentalFlag ) ) |
192 + | { |
193 + | dev = true; |
194 + | buildInfo = BuildInfo.EXPERIMENTAL; |
195 + | } |
189 196 | remapped = options.has( remappedFlag ); |
190 197 | compile = options.valuesOf( toCompile ); |
191 198 | pullRequests = options.valuesOf( buildPullRequest ); |
192 199 | validatedPullRequestsOptions(); |
193 200 | if ( options.has( skipCompileFlag ) ) |
194 201 | { |
195 202 | compile = Collections.singletonList( Compile.NONE ); |
196 203 | System.err.println( "--skip-compile is deprecated, please use --compile NONE" ); |
197 204 | } |
198 205 | if ( ( dev || dontUpdate ) && options.has( jenkinsVersion ) ) |