Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build jps-builder using only Java 1.6 compatible .classes #323

Merged
merged 1 commit into from
Jun 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Build jps-builder using only Java 1.6 compatible .classes
Fixes #290
Fixes #293
Fixes #295
Fixes #302
Fixes #313

In IntelliJ 14.1, all of openapi.jar targets Java 1.6 (with
MAJOR.MINOR 50.0), but in IntelliJ 2016.1, some of openapi.jar targets
only Java 1.8 (with MAJOR.MINOR 52.0), since jps-builders require parts
of openapi.jars and must target Java 1.6 even for IntelliJ 2016.1, the
52.0 .classes needed to be ported into org.elixir_lang.jps.builder, so
that the 52.0 version in openapi.jar wouldn't be attempted to be loaded.

This ended up being 5 classes:

* ExecutionException
* GeneralCommandLine
* ParametersList
* ParamsGroup
* ProcessNotCreatedException

Only GeneralCommandLine was used directly, all others are dependencies
of it.
  • Loading branch information
KronicDeth committed Jun 11, 2016
commit 01d0aef82622376f7877b8faf16ec1bb12958892
9 changes: 9 additions & 0 deletions .idea/libraries/idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 46 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ doctoc .

#### IntelliJ IDEA

##### For Plugin
An IntelliJ Platform Plugin SDK must be setup to develop plugins, but the paths are tied to the version of IntellIJ IDEA
you have installed, so you will likely need to fix the paths to match your environment.

Expand All @@ -101,7 +102,7 @@ you have installed, so you will likely need to fix the paths to match your envir
1. You can download [JDK 1.6 from Apple](https://support.apple.com/kb/DL1572?locale=en_US)
3. Click OK
5. In the “Select Home Directory for IntelliJ Platform Plugin SDK” select the IntelliJ IDEA Community Edition
Contents: `/Applications/IntelliJ IDEA 15 CE.app/Contents`.
Contents: `/Applications/IntelliJ IDEA 14.1 CE.app/Contents`.
**NOTE: Use Community Edition even if you have IntelliJ IDEA Ultimate Edition installed, so that the built
plugin works with Community Edition.**
6. In the “Select Internal Java Platform” window
Expand All @@ -114,6 +115,50 @@ you have installed, so you will likely need to fix the paths to match your envir
4. In the “Detected Roots” window, click “OK” to add all roots.
8. Click OK to close “Project Structure”

##### For JPS Builder Compile Server

Compile servers must be compatible all the way back to Java 1.6, but they also link to `openapi.jar`, which in new IntelliJ versions, like 2016.1, contains Java 1.8 only (`MAJOR.MINOR` `52.0`) `.class` files. To ensure the jps-builder module is built so it will only use Java 1.6 compatible `.class` files in IntelliJ 14.1 through IntelliJ 2016.1, a separate, minimal IntelliJ Platform Plugin SDK is used for the `jps-builder` and `jps-shared` modules.

1. Files > Project Structure
2. In the "Project Structure" window
1. Select Platform Settings > SDKs
2. Click “+”
3. Chose “IntelliJ Platform Plugin SDK”
4. A modal **may** pop-up saying “Cannot Create SDK”, “You need to configure a Java SDK first”.
1. Click OK
2. In the “Select Home Directory for JDK” select the JDK 1.6 directory:
“/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home”.
**NOTE: JDK 1.6 is used, even though it is unsupported by Oracle, to give the greatest compatibility with
older JetBrains IDE versions**
1. You can download [JDK 1.6 from Apple](https://support.apple.com/kb/DL1572?locale=en_US)
3. Click OK
5. In the “Select Home Directory for IntelliJ Platform Plugin SDK” select the IntelliJ IDEA Community Edition
Contents: `/Applications/IntelliJ IDEA 14.1 CE.app/Contents`.
**NOTE: Use Community Edition even if you have IntelliJ IDEA Ultimate Edition installed, so that the built
plugin works with Community Edition.**
6. In the “Select Internal Java Platform” window
1. Select “1.6”
2. Click OK
7. Select the “IntelliJ IDEA Community Edition” SDK.
1. Change the Name to "IntelliJ IDEA Community Edition (JPS-Builder)"
2. Minimize the number of jars included from "IntelliJ IDEA Community Edition"
1. Select all `/Applications/IntelliJ IDEA 14.1 CE.app/Contents` jars
2. Unselect (with Cmd+Click) the minimal jars needed
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/annotations.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jdom.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jps-model.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jps-server.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/openapi.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/trove4j.jar`
* `/Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/util.jar`
3. Click the - Icon to remove the unneeded jars
3. Add the Sourcepath
1. Select the Sourcepath tab
2. Click the + Icon
3. Select “~/git/JetBrains/intellij-community”
4. In the “Detected Roots” window, click “OK” to add all roots.
8. Click OK to close “Project Structure”

#### IntelliJ Erlang

In order to integrate with [IntelliJ Erlang](https://github.com/ignatov/intellij-erlang), we need it as a jar to access
Expand Down
2 changes: 1 addition & 1 deletion intellij-elixir.iml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<excludeFolder url="file://$MODULE_DIR$/dependencies" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="IntelliJ IDEA Community Edition IC-141.3056.4" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="JUnit4">
Expand Down
4 changes: 3 additions & 1 deletion jps-builder/jps-builder.iml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="IntelliJ IDEA Community Edition IC-141.3056.4 (JPS-Builder)" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="jps-shared" />
<orderEntry type="library" scope="TEST" name="idea" level="project" />
<orderEntry type="library" scope="TEST" name="junit-4.12" level="project" />
</component>
</module>
32 changes: 30 additions & 2 deletions jps-builder/src/org/elixir_lang/jps/builder/ElixirBuilder.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
package org.elixir_lang.jps.builder;

import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
// 52.0 in openapi.jar
// import com.intellij.execution.ExecutionException;
// 52.0 in openapi.jar
//import com.intellij.execution.configurations.GeneralCommandLine;
// 50.0 in util.jar
import com.intellij.execution.process.BaseOSProcessHandler;
// 50.0 in util.jar
import com.intellij.execution.process.ProcessAdapter;
// 50.0 in util.jar
import com.intellij.openapi.diagnostic.Logger;
// 50.0 in util.jar
import com.intellij.openapi.util.io.FileUtil;
// 49.0 in util.jar
import com.intellij.openapi.util.io.FileUtilRt;
// 50.0 in util.jar
import com.intellij.openapi.util.text.StringUtil;
// 50.0 in util.jar
import com.intellij.util.CommonProcessors;
// 49.0 in util.jar
import com.intellij.util.Function;
// 50.0 in util.jar
import com.intellij.util.containers.ContainerUtil;
// 49.0 in trove4j.jar
import gnu.trove.THashSet;
import org.elixir_lang.jps.mix.JpsMixConfigurationExtension;
import org.elixir_lang.jps.model.ElixirCompilerOptions;
Expand All @@ -19,21 +31,37 @@
import org.elixir_lang.jps.model.JpsElixirSdkType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.builders.BuildOutputConsumer;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.builders.DirtyFilesHolder;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.builders.FileProcessor;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.CompileContext;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.ProjectBuildException;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.TargetBuilder;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.messages.BuildMessage;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.messages.CompilerMessage;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.resources.ResourcesBuilder;
// 50.0 in jsp-builders.jar
import org.jetbrains.jps.incremental.resources.StandardResourceBuilderEnabler;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.JpsDummyElement;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.JpsProject;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.java.JavaSourceRootType;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.library.sdk.JpsSdk;
// 50.0 in openapi.jar
import org.jetbrains.jps.model.module.*;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016 Luke Imhoff
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.elixir_lang.jps.builder;

public class ExecutionException extends Exception {
public ExecutionException(final String s) {
super(s);
}

public ExecutionException(final Throwable cause) {
super(cause == null ? null : cause.getMessage(), cause);
}

public ExecutionException(final String s, Throwable cause) {
super(s, cause);
}
}
Loading