Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use local .m2 cache in build by default. #2710

Merged
merged 1 commit into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.io.OutputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
Expand Down Expand Up @@ -177,20 +179,22 @@ public void execute() throws BuildException {

private byte[] mavenFile(MavenCoordinate mc) throws IOException {
String cacheName = mc.toMavenPath();
File local = new File(new File(new File(new File(System.getProperty("user.home")), ".m2"), "repository"), cacheName.replace('/', File.separatorChar));
List<String> urls = new ArrayList<>();
if (local.isFile()) {
urls.add(local.toURI().toString());
}
for (String prefix : repos.split(" ")) {
urls.add(prefix + cacheName);
}
for (String url : urls) {
try {
if (url.startsWith("file:")) {
File file = new File(new URI(url));
if (!file.exists()) {
continue;
}
}
URL u = new URL(url);
log("Trying: " + url, Project.MSG_VERBOSE);
return downloadFromServer(u);
} catch (IOException ex) {
} catch (IOException | URISyntaxException ex) {
//Try the next URL
}
}
Expand Down
1 change: 1 addition & 0 deletions nbbuild/binaries-default-properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
<project name="binaries-default-properties" default="netbeans" basedir=".">
<property name="binaries.cache" location="${user.home}/.hgexternalcache"/>
<property name="binaries.server" value="https://netbeans.osuosl.org/binaries/"/>
<property name="binaries.repos" value="https://repo1.maven.org/maven2/"/>
</project>
14 changes: 7 additions & 7 deletions nbbuild/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<taskdef name="downloadbinaries" classname="org.netbeans.nbbuild.extlibs.DownloadBinaries" classpath="${build.ant.classes.dir}"/>
<taskdef name="configureproxy" classname="org.netbeans.nbbuild.extlibs.ConfigureProxy" classpath="${build.ant.classes.dir}"/>
<property name="have-downloadbinaries-task" value="true" />
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}">
<manifest dir="${nb_all}">
<include name="nbbuild/external/binaries-list"/>
<include name="platform/libs.junit4/external/binaries-list"/>
Expand Down Expand Up @@ -198,7 +198,7 @@ metabuild.hash=${metabuild.hash}</echo>
<target name="download-all-extbins" unless="ext.binaries.downloaded" depends="bootstrap">
<echo>Downloading external binaries (*/external/ directories)...</echo>
<!-- optionnal reporttofile used to speed resolving artefacts resolution for maven artefacts -->
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" >
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}" >
<manifest dir="${nb_all}">
<include name="**/external/binaries-list"/>
</manifest>
Expand Down Expand Up @@ -235,7 +235,7 @@ metabuild.hash=${metabuild.hash}</echo>
<map from="${nb_all}/" to=""/>
<globmapper from="*" to="*/external/binaries-list"/>
</pathconvert>
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}">
<manifest dir="${nb_all}" includes="${modules.binaries-list}"/>
</downloadbinaries>
</target>
Expand Down Expand Up @@ -468,7 +468,7 @@ metabuild.hash=${metabuild.hash}</echo>
</target>

<target name="-download-nb-windows-launchers" depends="init,-check-nb-cluster" if="has.nb.cluster" unless="do.build.windows.launchers">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}">
<manifest dir="${nb_all}" includes="nb/ide.launcher/external/binaries-list"/>
</downloadbinaries>

Expand Down Expand Up @@ -1310,7 +1310,7 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d
</fileset>
</subant>
<taskdef name="downloadbinaries" classname="org.netbeans.nbbuild.extlibs.DownloadBinaries" classpath="${nbantext.jar}"/>
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" clean="true">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}" clean="true">
<manifest dir="${nb_all}">
<include name="*/external/binaries-list"/>
<include name="contrib/*/external/binaries-list"/>
Expand Down Expand Up @@ -1689,7 +1689,7 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d
<pathconvert property="source.dirs" pathsep="," refid="source.dirset">
<regexpmapper from="${nb_all}/(.*)$" to="\1/**/*" handledirsep="yes"/>
</pathconvert>
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}"> <!--XXX-->
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}"> <!--XXX-->
<manifest dir="${nb_all}">
<include name="libs.antlr3.devel/external/binaries-list"/>
</manifest>
Expand Down Expand Up @@ -2172,7 +2172,7 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d
<taskdef name="exclusionsfromlicenseinfo" classname="org.netbeans.nbbuild.extlibs.ExclusionsFromLicenseInfo" classpath="${nbantext.jar}"/>
<taskdef name="reportFromLicenseinfo" classname="org.netbeans.nbbuild.extlibs.ReportFromLicenseinfo" classpath="${nbantext.jar}"/>

<downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
<downloadbinaries cache="${binaries.cache}" server="${binaries.server}" repos="${binaries.repos}">
<manifest dir="${nb_all}">
<include name="nbbuild/external/binaries-list"/>
</manifest>
Expand Down