本文整理匯總了Java中org.gradle.api.logging.Logger.error方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.error方法的具體用法?Java Logger.error怎麽用?Java Logger.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.gradle.api.logging.Logger
的用法示例。
在下文中一共展示了Logger.error方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: waitForInitialDeviceList
import org.gradle.api.logging.Logger; //導入方法依賴的package包/類
/**
* Wait for the Android Debug Bridge to return an initial device list.
*/
protected static void waitForInitialDeviceList(final AndroidDebugBridge androidDebugBridge, Logger logger) {
if (!androidDebugBridge.hasInitialDeviceList()) {
logger.info("Waiting for initial device list from the Android Debug Bridge");
long limitTime = System.currentTimeMillis() + ADB_TIMEOUT_MS;
while (!androidDebugBridge.hasInitialDeviceList() && (System.currentTimeMillis() < limitTime)) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for initial device list from Android Debug Bridge");
}
}
if (!androidDebugBridge.hasInitialDeviceList()) {
logger.error("Did not receive initial device list from the Android Debug Bridge.");
}
}
}
示例2: parseClassesToMap
import org.gradle.api.logging.Logger; //導入方法依賴的package包/類
private static List<ClassMapping> parseClassesToMap(String[] renameClasses, Logger logger) {
ArrayList<ClassMapping> result = new ArrayList<>();
if (renameClasses == null) {
return result;
}
for (String classRenaming : renameClasses) {
int indexOfEquals = classRenaming.indexOf("=");
if (indexOfEquals > 0 && indexOfEquals < classRenaming.length()) {
String from = classRenaming.substring(0, indexOfEquals);
String to = classRenaming.substring(indexOfEquals + 1);
result.add(new ClassMapping(from, to));
} else {
logger.error("Unparseable mapping:" + classRenaming);
}
}
return result;
}
示例3: apply
import org.gradle.api.logging.Logger; //導入方法依賴的package包/類
@Override
public void apply(final Project project) {
Logger logger = project.getLogger();
logger.info("applying jsweet plugin");
if (!project.getPlugins().hasPlugin(JavaPlugin.class) && !project.getPlugins().hasPlugin(WarPlugin.class)) {
logger.error("No java or war plugin detected. Enable java or war plugin.");
throw new IllegalStateException("No java or war plugin detected. Enable java or war plugin.");
}
JSweetPluginExtension extension = project.getExtensions().create("jsweet", JSweetPluginExtension.class);
JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
SourceSetContainer sourceSets = javaPluginConvention.getSourceSets();
SourceSet mainSources = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
JSweetTranspileTask task = project.getTasks().create("jsweet", JSweetTranspileTask.class);
task.setGroup("generate");
task.dependsOn(JavaPlugin.COMPILE_JAVA_TASK_NAME);
task.setConfiguration(extension);
task.setSources(mainSources.getAllJava());
task.setClasspath(mainSources.getCompileClasspath());
JSweetCleanTask cleanTask = project.getTasks().create("jsweetClean", JSweetCleanTask.class);
cleanTask.setConfiguration(extension);
}
示例4: apply
import org.gradle.api.logging.Logger; //導入方法依賴的package包/類
@Override
public void apply(final Project project) {
boolean javaPlugin = project.getPlugins().hasPlugin(JavaPlugin.class);
boolean warPlugin = project.getPlugins().hasPlugin(WarPlugin.class);
final Logger logger = project.getLogger();
if (!(javaPlugin && warPlugin)) {
logger.error("st-js plugin can only be applied if jar or war plugin is applied, too!");
throw new IllegalStateException("st-js plugin can only be applied if jar or war plugin is applied, too!");
}
final JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
final SourceSet main = javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
final SourceDirectorySet allJava = main.getAllJava();
if (allJava.getSrcDirs().size() != 1) {
throw new IllegalStateException("Only a single source directory is supported!");
}
final GenerateStJsTask task = project.getTasks().create("stjs", GenerateStJsTask.class);
task.setClasspath(
main.getCompileClasspath()
);
task.setWar(warPlugin);
File generatedSourcesDirectory;
if (warPlugin) {
generatedSourcesDirectory = new File(project.getBuildDir(), "stjs");
project.getTasks().getByPath(WarPlugin.WAR_TASK_NAME).dependsOn(task);
} else {
generatedSourcesDirectory = main.getOutput().getClassesDir();
project.getTasks().getByPath(JavaPlugin.JAR_TASK_NAME).dependsOn(task);
}
task.setGeneratedSourcesDirectory(generatedSourcesDirectory);
task.setCompileSourceRoots(allJava);
task.setOutput(main.getOutput());
}
示例5: installPatchIfDeviceConnected
import org.gradle.api.logging.Logger; //導入方法依賴的package包/類
/**
* no device or too many device make install fail
*
* @param name
* @param patch
* @return
*/
private static boolean installPatchIfDeviceConnected(AndroidBuilder androidBuilder, File patch, String patchPkg,
Logger logger, String name) {
final AndroidDebugBridge androidDebugBridge = initAndroidDebugBridge(androidBuilder);
if (!androidDebugBridge.isConnected()) {
throw new RuntimeException("Android Debug Bridge is not connected.");
}
waitForInitialDeviceList(androidDebugBridge, logger);
List<IDevice> devices = Arrays.asList(androidDebugBridge.getDevices());
String PATCH_INSTALL_DIRECTORY = String.format("%s%s%s", PATCH_INSTALL_DIRECTORY_PREFIX, patchPkg,
PATCH_INSTALL_DIRECTORY_SUFFIX);
if (devices.size() == 0) {
throw new RuntimeException(String.format("%s%s%s%s%s",
"no device connected,please check whether the connection is "
+ "successful or copy ", patch,
" in build/outputs/awbs/libxxx.so ", PATCH_INSTALL_DIRECTORY,
" and restart you app"));
}
if (devices.size() > 1) {
throw new RuntimeException("too much devices be connected,please disconnect the others and try again");
}
CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
executor.setLogger(logger);
executor.setCaptureStdOut(true);
executor.setCaptureStdErr(true);
List<String> cmd = Arrays.asList("push", patch.getAbsolutePath(), PATCH_INSTALL_DIRECTORY + name);
try {
executor.executeCommand(androidBuilder.getSdkInfo().getAdb().getAbsolutePath(), cmd, false);
return true;
} catch (ExecutionException e) {
throw new RuntimeException("Error while trying to push patch to device ", e);
} finally {
String errout = executor.getStandardError();
if ((errout != null) && (errout.trim().length() > 0)) {
logger.error(errout);
}
}
}