Search in sources :

Example 1 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-elixir by KronicDeth.

the class ElixirTarget method computeDependencies.

public Collection<BuildTarget<?>> computeDependencies() {
    List<BuildTarget<?>> dependencies = new ArrayList<BuildTarget<?>>();
    Set<JpsModule> modules = JpsJavaExtensionService.dependencies(myModule).includedIn(JpsJavaClasspathKind.compile(isTests())).getModules();
    for (JpsModule module : modules) {
        if (module.getModuleType().equals(JpsElixirModuleType.INSTANCE)) {
            dependencies.add(new ElixirTarget(getElixirTargetType(), module));
        }
    }
    if (isTests()) {
        dependencies.add(new ElixirTarget(ElixirTargetType.PRODUCTION, myModule));
    }
    return dependencies;
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Example 2 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-elixir by KronicDeth.

the class MixBuilder method build.

@Override
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException {
    if (!holder.hasDirtyFiles() && !holder.hasRemovedFiles())
        return;
    JpsModule module = target.getModule();
    JpsProject project = module.getProject();
    ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions();
    if (!compilerOptions.myUseMixCompiler)
        return;
    String mixPath = getMixExecutablePath(project);
    if (mixPath == null) {
        String errorMessage = "Mix path is not set.";
        context.processMessage(new CompilerMessage(NAME, BuildMessage.Kind.ERROR, errorMessage));
        throw new ProjectBuildException(errorMessage);
    }
    JpsSdk<JpsDummyElement> sdk = ElixirTargetBuilderUtil.getSdk(context, module);
    String elixirPath = JpsElixirSdkType.getScriptInterpreterExecutable(sdk.getHomePath()).getAbsolutePath();
    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;
        runMix(elixirPath, mixPath, contentRootPath, compilerOptions.myAttachDebugInfoEnabled, context);
    }
}
Also used : ProjectBuildException(org.jetbrains.jps.incremental.ProjectBuildException) JpsModule(org.jetbrains.jps.model.module.JpsModule) CompilerMessage(org.jetbrains.jps.incremental.messages.CompilerMessage) JpsProject(org.jetbrains.jps.model.JpsProject) JpsDummyElement(org.jetbrains.jps.model.JpsDummyElement) ElixirCompilerOptions(org.elixir_lang.jps.model.ElixirCompilerOptions) File(java.io.File) URL(java.net.URL)

Example 3 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class DependencyResolvingBuilder method getRepositoryLibraries.

@NotNull
private static Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> getRepositoryLibraries(ModuleChunk chunk) {
    final Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> result = new SmartHashSet<>();
    for (JpsModule module : chunk.getModules()) {
        for (JpsDependencyElement dep : module.getDependenciesList().getDependencies()) {
            if (dep instanceof JpsLibraryDependency) {
                final JpsLibrary _lib = ((JpsLibraryDependency) dep).getLibrary();
                final JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>> lib = _lib != null ? _lib.asTyped(JpsMavenRepositoryLibraryType.INSTANCE) : null;
                if (lib != null) {
                    result.add(lib);
                }
            }
        }
    }
    return result;
}
Also used : JpsLibraryDependency(org.jetbrains.jps.model.module.JpsLibraryDependency) SmartHashSet(com.intellij.util.containers.SmartHashSet) JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsTypedLibrary(org.jetbrains.jps.model.library.JpsTypedLibrary) JpsDependencyElement(org.jetbrains.jps.model.module.JpsDependencyElement) RepositoryLibraryDescriptor(org.jetbrains.jps.maven.model.RepositoryLibraryDescriptor) JpsSimpleElement(org.jetbrains.jps.model.JpsSimpleElement) JpsLibrary(org.jetbrains.jps.model.library.JpsLibrary) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class FormsBuilderTest method testDoNotCopyRuntimeClassesIfOnlyAlienFormFilesExist.

public void testDoNotCopyRuntimeClassesIfOnlyAlienFormFilesExist() {
    JpsModule module = addModule("m", copyToProject("plugins/ui-designer/jps-plugin/testData/build/alienFormFile", "src"));
    buildAllModules().assertSuccessful();
    assertFalse(isRuntimeClassesCopied(module));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Example 5 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class FormsBuilderTest method testSimple.

public void testSimple() {
    JpsModule m = addModule("m", copyToProject(SIMPLE_FORM_PATH, "src"));
    buildAllModules().assertSuccessful();
    assertTrue(isRuntimeClassesCopied(m));
    assertInstrumented(m, "xxx/MyForm.class");
    buildAllModules().assertUpToDate();
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Aggregations

JpsModule (org.jetbrains.jps.model.module.JpsModule)128 File (java.io.File)33 NotNull (org.jetbrains.annotations.NotNull)15 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)15 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)14 JpsAndroidModuleExtensionImpl (org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl)13 JpsAndroidModuleProperties (org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)13 THashSet (gnu.trove.THashSet)11 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)11 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)10 JpsSimpleElement (org.jetbrains.jps.model.JpsSimpleElement)10 JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)10 ArrayList (java.util.ArrayList)9 HashMap (com.intellij.util.containers.HashMap)8 IOException (java.io.IOException)8 TObjectLongHashMap (gnu.trove.TObjectLongHashMap)7 JpsDependencyElement (org.jetbrains.jps.model.module.JpsDependencyElement)7 JpsDummyElement (org.jetbrains.jps.model.JpsDummyElement)6 Pair (com.intellij.openapi.util.Pair)5 Nullable (org.jetbrains.annotations.Nullable)5