private void configureApiTool(final Project project) { project.getTasks() .withType(ApiToolTask.class, task -> { ConventionMapping mapping = task.getConventionMapping(); mapping.map("mainClassName", () -> project.getProperties().get("mainClassName")); }); Map<String, Object> options = new HashMap<>(); options.put(Task.TASK_TYPE, ApiToolTask.class); options.put(Task.TASK_DEPENDS_ON, "classes"); options.put(Task.TASK_NAME, "joobyApiTool"); options .put(Task.TASK_DESCRIPTION, "Export your HTTP API to open standards like Swagger and RAML"); options.put(Task.TASK_GROUP, "jooby"); project.getTasks().create(options); }
private void configureJoobyAssets(final Project project) { project.getTasks() .withType(AssetTask.class, task -> { ConventionMapping mapping = task.getConventionMapping(); mapping.map("env", () -> "dist"); mapping.map("maxAge", () -> "365d"); mapping.map("mainClassName", () -> project.getProperties().get("mainClassName")); mapping.map("output", () -> new JoobyProject(project).classes()); mapping.map("assemblyOutput", () -> new File(project.getBuildDir(), "__public_")); }); Map<String, Object> options = new HashMap<>(); options.put(Task.TASK_TYPE, AssetTask.class); options.put(Task.TASK_DEPENDS_ON, "classes"); options.put(Task.TASK_NAME, "joobyAssets"); options.put(Task.TASK_DESCRIPTION, "Process, optimize and compress static files"); options.put(Task.TASK_GROUP, "jooby"); project.getTasks().create(options); }
private void configureJoobyRun(final Project project) { project.getTasks() .withType(JoobyTask.class, joobyRun -> { ConventionMapping mapping = joobyRun.getConventionMapping(); mapping.map("classpath", () -> new JoobyProject(project).classpath()); mapping.map("src", () -> new JoobyProject(project).sources()); mapping.map("mainClassName", () -> project.getProperties().get("mainClassName")); mapping.map("srcExtensions", () -> Arrays.asList(".java", ".conf", ".properties", ".kt")); mapping.map("compiler", () -> { File eclipseClasspath = new File(project.getProjectDir(), ".classpath"); return eclipseClasspath.exists() ? "off" : "on"; }); Gradle gradle = project.getGradle(); mapping.map("block", () -> !gradle.getStartParameter().isContinuous()); mapping.map("logLevel", () -> gradle.getStartParameter().getLogLevel().name()); }); Map<String, Object> options = new HashMap<>(); options.put(Task.TASK_TYPE, JoobyTask.class); options.put(Task.TASK_DEPENDS_ON, "classes"); options.put(Task.TASK_NAME, "joobyRun"); options.put(Task.TASK_DESCRIPTION, "Run, debug and hot reload applications"); options.put(Task.TASK_GROUP, "jooby"); project.getTasks().create(options); }
/** * gradle.properties配置pyramid.debug=true才能允许输出debug日志 * 这个是初始化配置的方法,在每个plugin.apply第一行调用 * * @param project * @return */ public static void resetDebug(Project project) { Map<String, ?> propMap = project.getProperties(); Object debug = propMap.get("pyramid.debug"); DEBUG = (debug != null && "true".equalsIgnoreCase(debug.toString())); }
private Map<String, String> getExtraInstrumentationTestRunnerArgsMap() { Map<String, String> argsMap = Maps.newHashMap(); for (Map.Entry<String, ?> entry : project.getProperties().entrySet()) { if (entry.getKey().startsWith(TEST_RUNNER_ARGS_PROP)) { String argName = entry.getKey().substring(TEST_RUNNER_ARGS_PROP.length()); String argValue = entry.getValue().toString(); argsMap.put(argName, argValue); } } return argsMap; }
public String getIosSignIdentity() { return project.hasProperty("bugvm.iosSignIdentity") ? project.getProperties().get("bugvm.iosSignIdentity").toString() : iosSignIdentity; }
public String getIosProvisioningProfile() { return project.hasProperty("bugvm.iosProvisioningProfile") ? project.getProperties().get("bugvm.iosProvisioningProfile").toString() : iosProvisioningProfile; }
public String getIosSimulatorSdk() { return project.hasProperty("bugvm.iosSimulatorSdk") ? project.getProperties().get("bugvm.iosSimulatorSdk").toString() : iosSimulatorSdk; }
public boolean isIosSkipSigning() { return project.hasProperty("bugvm.iosSkipSigning") ? Boolean.parseBoolean(project.getProperties().get("bugvm.iosSkipSigning").toString()) : iosSkipSigning; }
public int getDebugPort() { return project.hasProperty("bugvm.debugPort") ? Integer.parseInt(project.getProperties().get("bugvm.debugPort").toString()) : debugPort; }
public boolean isSkipLaunch() { return project.hasProperty("bugvm.skipLaunch") ? Boolean.parseBoolean(project.getProperties().get("bugvm.skipLaunch").toString()) : skipLaunch; }
public boolean isDebug() { return project.hasProperty("bugvm.debug") ? Boolean.parseBoolean(project.getProperties().get("bugvm.debug").toString()) : debug; }
public String getArchs() { if (project.hasProperty("bugvm.archs")) { return project.getProperties().get("bugvm.archs").toString(); } return archs; }
protected com.bugvm.compiler.target.ios.DeviceType getDeviceType(com.bugvm.compiler.target.ios.DeviceType.DeviceFamily family) { String deviceName = (String) project.getProperties().get("bugvm.device.name"); String sdkVersion = (String) project.getProperties().get("bugvm.sdk.version"); return com.bugvm.compiler.target.ios.DeviceType.getBestDeviceType(getArch(), family, deviceName, sdkVersion); } }
public List<ValueSource> createValueSources(Model model, File projectDir, ModelBuildingRequest request, ModelProblemCollector collector) { List<ValueSource> sources = new ArrayList<>(); sources.addAll(super.createValueSources(model, projectDir, request, collector)); sources.add(new PropertiesBasedValueSource(System.getProperties())); sources.add(new MapBasedValueSource(project.getProperties())); return sources; } }
private SourceSet getMainSourceSet() { Project project = getProject(); SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets"); return sourceSets.getByName("main"); }
private void forEachUnalignedInput(InputProcessor processor) { String archivesBaseName = (String)getProject().getProperties().get("archivesBaseName"); Pattern unalignedPattern = Pattern.compile( archivesBaseName + "-" + outputBaseName + "_(.*)-unaligned.apk"); for (File file : getInputFiles()) { Matcher unaligned = unalignedPattern.matcher(file.getName()); if (unaligned.matches() && isFilter(unaligned.group(1))) { processor.process(unaligned.group(1), file); } } }
private SourceSetHelper getSourceSet(String name) { SourceSetContainer sourceSets = (SourceSetContainer) this.project.getProperties().get("sourceSets"); SourceSet sourceSet = sourceSets.getByName(name); return new SourceSetHelper(sourceSet); }
private String getApkName(final String split) { String archivesBaseName = (String)getProject().getProperties().get("archivesBaseName"); String apkName = archivesBaseName + "-" + getOutputBaseName() + "_" + split; return apkName + (getSigningConfig() == null ? "-unsigned.apk" : "-unaligned.apk"); }
@NonNull public String getApkLocation() { String apkLocation = getDefaultApkLocation(); if (project.hasProperty(PROPERTY_APK_LOCATION)) { apkLocation = (String) project.getProperties().get(PROPERTY_APK_LOCATION); } return apkLocation; } }