Search in sources :

Example 1 with Gcc

use of org.gradle.nativeplatform.toolchain.Gcc in project gradle by gradle.

the class InstallExecutable method installWindows.

private void installWindows() {
    final File executable = getExecutableFile().get().getAsFile();
    installToDir(getLibDirectory().get().getAsFile());
    StringBuilder toolChainPath = new StringBuilder();
    NativeToolChain toolChain = getToolChain().get();
    if (toolChain instanceof Gcc) {
        // Gcc on windows requires the path to be set
        toolChainPath.append("SET PATH=");
        for (File pathEntry : ((Gcc) toolChain).getPath()) {
            toolChainPath.append(pathEntry.getAbsolutePath()).append(";");
        }
        toolChainPath.append("%PATH%");
    }
    String runScriptText = "\n@echo off" + "\nSETLOCAL" + "\n" + toolChainPath + "\nCALL \"%~dp0lib\\" + executable.getName() + "\" %*" + "\nEXIT /B %ERRORLEVEL%" + "\nENDLOCAL" + "\n";
    GFileUtils.writeFile(runScriptText, getRunScriptFile().get().getAsFile());
}
Also used : Gcc(org.gradle.nativeplatform.toolchain.Gcc) NativeToolChain(org.gradle.nativeplatform.toolchain.NativeToolChain) File(java.io.File) RegularFile(org.gradle.api.file.RegularFile) InputFile(org.gradle.api.tasks.InputFile)

Example 2 with Gcc

use of org.gradle.nativeplatform.toolchain.Gcc in project gradle by gradle.

the class InstallExecutable method installWindows.

private void installWindows(File executable, File runScript) {
    StringBuilder toolChainPath = new StringBuilder();
    NativeToolChain toolChain = getToolChain().get();
    if (toolChain instanceof Gcc) {
        // Gcc on windows requires the path to be set
        toolChainPath.append("SET PATH=");
        for (File pathEntry : ((Gcc) toolChain).getPath()) {
            toolChainPath.append(pathEntry.getAbsolutePath()).append(";");
        }
        toolChainPath.append("%PATH%");
    }
    String runScriptText = "\n@echo off" + "\nSETLOCAL" + "\n" + toolChainPath + "\nCALL \"%~dp0lib\\" + executable.getName() + "\" %*" + "\nEXIT /B %ERRORLEVEL%" + "\nENDLOCAL" + "\n";
    GFileUtils.writeFile(runScriptText, runScript);
}
Also used : Gcc(org.gradle.nativeplatform.toolchain.Gcc) NativeToolChain(org.gradle.nativeplatform.toolchain.NativeToolChain) File(java.io.File) OutputFile(org.gradle.api.tasks.OutputFile) RegularFile(org.gradle.api.file.RegularFile) InputFile(org.gradle.api.tasks.InputFile)

Aggregations

File (java.io.File)2 RegularFile (org.gradle.api.file.RegularFile)2 InputFile (org.gradle.api.tasks.InputFile)2 Gcc (org.gradle.nativeplatform.toolchain.Gcc)2 NativeToolChain (org.gradle.nativeplatform.toolchain.NativeToolChain)2 OutputFile (org.gradle.api.tasks.OutputFile)1