Skip to content

Commit c1c624d

Browse files
committed
Create two mcp module for GitHub and FileSystem.
1 parent 923129e commit c1c624d

File tree

20 files changed

+3852
-0
lines changed

20 files changed

+3852
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import java.util.Properties;
18+
19+
public class MavenWrapperDownloader {
20+
21+
private static final String WRAPPER_VERSION = "0.5.5";
22+
/**
23+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
24+
*/
25+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
26+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
27+
28+
/**
29+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
30+
* use instead of the default one.
31+
*/
32+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
33+
".mvn/wrapper/maven-wrapper.properties";
34+
35+
/**
36+
* Path where the maven-wrapper.jar will be saved to.
37+
*/
38+
private static final String MAVEN_WRAPPER_JAR_PATH =
39+
".mvn/wrapper/maven-wrapper.jar";
40+
41+
/**
42+
* Name of the property which should be used to override the default download url for the wrapper.
43+
*/
44+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
45+
46+
public static void main(String args[]) {
47+
System.out.println("- Downloader started");
48+
File baseDirectory = new File(args[0]);
49+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
50+
51+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
52+
// wrapperUrl parameter.
53+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
54+
String url = DEFAULT_DOWNLOAD_URL;
55+
if (mavenWrapperPropertyFile.exists()) {
56+
FileInputStream mavenWrapperPropertyFileInputStream = null;
57+
try {
58+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
59+
Properties mavenWrapperProperties = new Properties();
60+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
61+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
62+
} catch (IOException e) {
63+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
64+
} finally {
65+
try {
66+
if (mavenWrapperPropertyFileInputStream != null) {
67+
mavenWrapperPropertyFileInputStream.close();
68+
}
69+
} catch (IOException e) {
70+
// Ignore ...
71+
}
72+
}
73+
}
74+
System.out.println("- Downloading from: " + url);
75+
76+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
77+
if (!outputFile.getParentFile().exists()) {
78+
if (!outputFile.getParentFile().mkdirs()) {
79+
System.out.println(
80+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
81+
}
82+
}
83+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
84+
try {
85+
downloadFileFromURL(url, outputFile);
86+
System.out.println("Done");
87+
System.exit(0);
88+
} catch (Throwable e) {
89+
System.out.println("- Error downloading");
90+
e.printStackTrace();
91+
System.exit(1);
92+
}
93+
}
94+
95+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
96+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
97+
String username = System.getenv("MVNW_USERNAME");
98+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
99+
Authenticator.setDefault(new Authenticator() {
100+
@Override
101+
protected PasswordAuthentication getPasswordAuthentication() {
102+
return new PasswordAuthentication(username, password);
103+
}
104+
});
105+
}
106+
URL website = new URL(urlString);
107+
ReadableByteChannel rbc;
108+
rbc = Channels.newChannel(website.openStream());
109+
FileOutputStream fos = new FileOutputStream(destination);
110+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
111+
fos.close();
112+
rbc.close();
113+
}
114+
115+
}

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar

bin/.metadata/jni-config.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"name":"com.apple.eawt._AppEventHandler",
4+
"methods":[{"name":"handleNativeNotification","parameterTypes":["int"] }]
5+
},
6+
{
7+
"name":"com.apple.eawt._AppMenuBarHandler",
8+
"methods":[{"name":"initMenuStates","parameterTypes":["boolean","boolean","boolean","boolean"] }]
9+
},
10+
{
11+
"name":"java.awt.event.InputEvent",
12+
"methods":[{"name":"getButtonDownMasks","parameterTypes":[] }]
13+
},
14+
{
15+
"name":"java.lang.String",
16+
"methods":[{"name":"lastIndexOf","parameterTypes":["int"] }, {"name":"substring","parameterTypes":["int"] }]
17+
},
18+
{
19+
"name":"java.lang.System",
20+
"methods":[{"name":"getProperty","parameterTypes":["java.lang.String"] }, {"name":"load","parameterTypes":["java.lang.String"] }, {"name":"setProperty","parameterTypes":["java.lang.String","java.lang.String"] }]
21+
},
22+
{
23+
"name":"org.tinystruct.system.Dispatcher",
24+
"methods":[{"name":"main","parameterTypes":["java.lang.String[]"] }]
25+
},
26+
{
27+
"name":"sun.awt.AWTAutoShutdown",
28+
"methods":[{"name":"notifyToolkitThreadBusy","parameterTypes":[] }, {"name":"notifyToolkitThreadFree","parameterTypes":[] }]
29+
},
30+
{
31+
"name":"sun.lwawt.macosx.LWCToolkit",
32+
"methods":[{"name":"installToolkitThreadInJava","parameterTypes":[] }]
33+
}
34+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"type":"agent-extracted",
4+
"classes":[
5+
]
6+
}
7+
]
8+

bin/.metadata/proxy-config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[
2+
]

bin/.metadata/reflect-config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"name":"org.tinystruct.system.Dispatcher",
4+
"queryAllPublicMethods":true,
5+
"methods":[{"name":"open","parameterTypes":[] }]
6+
}
7+
]

bin/.metadata/resource-config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"resources":{
3+
"includes":[{
4+
"pattern":"\\QMETA-INF/services/java.lang.System$LoggerFinder\\E"
5+
}, {
6+
"pattern":"\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E"
7+
}, {
8+
"pattern":"\\Qapplication.properties\\E"
9+
}]},
10+
"bundles":[{
11+
"name":"sun.awt.resources.awt",
12+
"classNames":["sun.awt.resources.awt"]
13+
}, {
14+
"name":"sun.awt.resources.awtosx",
15+
"classNames":["sun.awt.resources.awtosx"]
16+
}]
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"types":[
3+
],
4+
"lambdaCapturingTypes":[
5+
],
6+
"proxies":[
7+
]
8+
}

bin/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# tinystruct

0 commit comments

Comments
 (0)