dweiss commented on a change in pull request #1390: LUCENE-9266 remove gradle wrapper jar from source URL: https://github.com/apache/lucene-solr/pull/1390#discussion_r401172383
########## File path: buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java ########## @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://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. + */ +package org.apache.lucene.gradle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.math.BigInteger; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.nio.file.Files; +import java.security.MessageDigest; + +public class WrapperDownloader { + public static void main(String[] args) throws Exception { + if (args.length != 3) { + System.err.println("Usage: java WrapperDownloader.java <version> <destination> <checksum>"); + System.exit(1); + } + + File jar = new File(args[1]); + if (!jar.exists()) { Review comment: I think it should be exactly the same version as the one we "require". Same as with JAR dependencies. If the checksum of the existing (or downloaded) file doesn't match, we can issue a warning and overwrite it with a newly downloaded one (after verifying its checksum). This gives us the liberty to update gradle wrapper on different branches, for example: if you switch branches, the wrapper would be re-downloaded and upgraded for you to match the branch's required version. I specifically don't *want* people to have the liberty of running arbitrary gradle versions (or wrapper versions). This is where I got burned many times before. If we are to drop versioned wrapper jar it has to be matching exactly what is required by each git revision of the code (so that branch switching works seamlessly and everyone is using the same version on the same git revision). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org