130 }
131 }
132 for (String arg : args) {
133 launcher.addToolArg(arg);
134 }
135 try {
136 return ProcessTools.executeCommand(new ProcessBuilder(launcher.getCommand()).redirectErrorStream(true));
137 } catch (Throwable e) {
138 throw new Error("Can't start test process: " + e, e);
139 }
140 }
141
142 public static void printUsage() {
143 System.err.println("Usage: " + AotCompiler.class.getName()
144 + " -class <class> -libname <.so name>"
145 + " [-compile <compileItems>]* [-extraopt <java option>]*");
146 }
147
148 public static String resolveLinker() {
149 Path linker = null;
150 // 1st, check if PATH has ld
151 for (String path : System.getenv("PATH").split(File.pathSeparator)) {
152 if (Files.exists(Paths.get(path).resolve("ld"))) {
153 // there is ld in PATH, jaotc is supposed to find it by its own
154 return null;
155 }
156 }
157 // there is no ld in PATH, will use ld from devkit
158 // artifacts are got from common/conf/jib-profiles.js
159 try {
160 if (Platform.isWindows()) {
161 if (Platform.isX64()) {
162 @Artifact(organization = "jpg.infra.builddeps",
163 name = "devkit-windows_x64",
164 revision = "VS2013SP4+1.0",
165 extension = "tar.gz")
166 class DevkitWindowsX64 { }
167 String artifactName = "jpg.infra.builddeps."
168 + "devkit-windows_x64-"
169 + "VS2013SP4+1.0";
170 Path devkit = ArtifactResolver.resolve(DevkitWindowsX64.class)
171 .get(artifactName);
172 linker = devkit.resolve("VC")
173 .resolve("bin")
174 .resolve("amd64")
175 .resolve("link.exe");
176 }
258 linker = devkit.resolve("arm-linux-gnueabihf")
259 .resolve("bin")
260 .resolve("ld");
261 } else if (Platform.isX64()) {
262 @Artifact(organization = "jpg.infra.builddeps",
263 name = "devkit-linux_x64",
264 revision = "gcc4.9.2-OEL6.4+1.1",
265 extension = "tar.gz")
266 class DevkitLinuxX64 { }
267
268 String artifactName = "jpg.infra.builddeps."
269 + "devkit-linux_x64-"
270 + "gcc4.9.2-OEL6.4+1.1";
271 Path devkit = ArtifactResolver.resolve(DevkitLinuxX64.class)
272 .get(artifactName);
273 linker = devkit.resolve("bin")
274 .resolve("ld");
275 }
276 }
277 } catch (FileNotFoundException e) {
278 throw new Error("artifact resolution error: " + e, e);
279 }
280 if (linker != null) {
281 return linker.toAbsolutePath().toString();
282 }
283 return null;
284 }
285 }
|
130 }
131 }
132 for (String arg : args) {
133 launcher.addToolArg(arg);
134 }
135 try {
136 return ProcessTools.executeCommand(new ProcessBuilder(launcher.getCommand()).redirectErrorStream(true));
137 } catch (Throwable e) {
138 throw new Error("Can't start test process: " + e, e);
139 }
140 }
141
142 public static void printUsage() {
143 System.err.println("Usage: " + AotCompiler.class.getName()
144 + " -class <class> -libname <.so name>"
145 + " [-compile <compileItems>]* [-extraopt <java option>]*");
146 }
147
148 public static String resolveLinker() {
149 Path linker = null;
150 // if non windows, 1st, check if PATH has ld
151 if (!Platform.isWindows()) {
152 String bin = "ld";
153 for (String path : System.getenv("PATH").split(File.pathSeparator)) {
154 if (Files.exists(Paths.get(path).resolve(bin))) {
155 // there is linker in PATH, jaotc is supposed to find it by its own
156 return null;
157 }
158 }
159 }
160 // there is no ld in PATH, will use ld from devkit
161 // artifacts are got from common/conf/jib-profiles.js
162 try {
163 if (Platform.isWindows()) {
164 if (Platform.isX64()) {
165 @Artifact(organization = "jpg.infra.builddeps",
166 name = "devkit-windows_x64",
167 revision = "VS2013SP4+1.0",
168 extension = "tar.gz")
169 class DevkitWindowsX64 { }
170 String artifactName = "jpg.infra.builddeps."
171 + "devkit-windows_x64-"
172 + "VS2013SP4+1.0";
173 Path devkit = ArtifactResolver.resolve(DevkitWindowsX64.class)
174 .get(artifactName);
175 linker = devkit.resolve("VC")
176 .resolve("bin")
177 .resolve("amd64")
178 .resolve("link.exe");
179 }
261 linker = devkit.resolve("arm-linux-gnueabihf")
262 .resolve("bin")
263 .resolve("ld");
264 } else if (Platform.isX64()) {
265 @Artifact(organization = "jpg.infra.builddeps",
266 name = "devkit-linux_x64",
267 revision = "gcc4.9.2-OEL6.4+1.1",
268 extension = "tar.gz")
269 class DevkitLinuxX64 { }
270
271 String artifactName = "jpg.infra.builddeps."
272 + "devkit-linux_x64-"
273 + "gcc4.9.2-OEL6.4+1.1";
274 Path devkit = ArtifactResolver.resolve(DevkitLinuxX64.class)
275 .get(artifactName);
276 linker = devkit.resolve("bin")
277 .resolve("ld");
278 }
279 }
280 } catch (FileNotFoundException e) {
281 System.err.println("artifact resolution error: " + e);
282 // let jaotc try to find linker
283 return null;
284 }
285 if (linker != null) {
286 return linker.toAbsolutePath().toString();
287 }
288 return null;
289 }
290 }
|