private static void doBuildWithMix(Target target, CompileContext context, JpsModule module, CompilerOptions compilerOptions) throws ProjectBuildException, IOException { JpsSdk<SdkProperties> sdk = BuilderUtil.getSdk(context, module); for (String contentRootUrl : module.getContentRootsList().getUrls()) { String contentRootPath = new URL(contentRootUrl).getPath(); File contentRootDir = new File(contentRootPath); File mixConfigFile = new File(contentRootDir, MIX_CONFIG_FILE_NAME); if (!mixConfigFile.exists()) continue; String task = target.isTests() ? "test" : "compile"; runMix(sdk, module, contentRootPath, task, compilerOptions, context); } }
private static void addModuleToCodePath(@NotNull GeneralCommandLine commandLine, @NotNull JpsModule module, boolean forTests, @NotNull CompileContext context) throws ProjectBuildException { File outputDirectory = getBuildOutputDirectory(module, forTests, context); commandLine.addParameters(ADD_PATH_TO_FRONT_OF_CODE_PATH, outputDirectory.getPath()); for (String rootUrl : module.getContentRootsList().getUrls()) { try { String path = new URL(rootUrl).getPath(); commandLine.addParameters(ADD_PATH_TO_FRONT_OF_CODE_PATH, path); } catch (MalformedURLException e) { context.processMessage(new CompilerMessage(ElIXIRC_NAME, BuildMessage.Kind.ERROR, "Failed to find content root for module: " + module.getName())); } } }
if(srcPaths.length > 0 || outputPath != null){ for(String srcPath : srcPaths){ module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(srcPath)); module.addSourceRoot(JpsPathUtil.pathToUrl(srcPath), JavaSourceRootType.SOURCE);
@Override public void build(@NotNull MonkeyBuildTarget target, @NotNull DirtyFilesHolder<MonkeySourceRootDescriptor, MonkeyBuildTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException { LOG.debug(target.getPresentableName()); // TODO(mliia): after for-production is built, for-tests says files are not dirty if (!target.isTests() && !holder.hasDirtyFiles() && !holder.hasRemovedFiles()) { return; } JpsModule jpsModule = target.getModule(); if (jpsModule.getModuleType() != JpsMonkeyModuleType.INSTANCE) return; JpsTypedModule<JpsSimpleElement<JpsMonkeyModuleProperties>> module = jpsModule.asTyped(JpsMonkeyModuleType.INSTANCE); assert module != null; JpsMonkeyModuleProperties monkeyModuleProperties = getModuleProperties(target); JpsSdk<JpsDummyElement> sdk = getSdk(context, jpsModule); JpsMonkeySdkType.SdkVersion sdkVersion = JpsMonkeySdkType.getSdkVersion(sdk); if (target.isTests() && !JpsMonkeySdkType.hasUnitTestsSupport(sdkVersion)) { return; } for (String contentRootUrl : jpsModule.getContentRootsList().getUrls()) { String outputPrg = buildPrgForSimulator(target, context, contentRootUrl, sdk, false, monkeyModuleProperties); File outputPrgFile = new File(outputPrg); Set<String> sourcePaths = Collections.singleton(contentRootUrl); outputConsumer.registerOutputFile(outputPrgFile, sourcePaths); } }