Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Added support for building with Intellij Idea
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaky committed Jul 25, 2022
1 parent dfa6ca1 commit fbc3048
Show file tree
Hide file tree
Showing 87 changed files with 923 additions and 8,799 deletions.
10 changes: 9 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

set -e

ant_dir=./make/langtools/netbeans/nb-javac

# Build langtools
cd make/langtools
ant clean build
cd -

# Build nb-javac-android
JDK_8="/usr/lib/jvm/java-8-openjdk-amd64"
if [ -d "$JDK_8" ]; then
export JAVA_HOME=$JDK_8
fi

echo "Using JAVA_HOME: $JAVA_HOME"

ant -f ./make/langtools/netbeans/nb-javac -Dmaven.groupId=io.github.itsaky "$@"
ant -f $ant_dir -Dmaven.groupId=io.github.itsaky "$@"
12 changes: 12 additions & 0 deletions make/ide/idea/langtools/template/ant.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml">
<properties>
<property name="langtools.jdk.home" value="@IDEA_TARGET_JDK@" />
<property name="intellij.ismake" value="$IsMake$" />
</properties>
<executeOn event="afterCompilation" target="post-make" />
</buildFile>
</component>
</project>
22 changes: 22 additions & 0 deletions make/ide/idea/langtools/template/codeStyleSettings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="RIGHT_MARGIN" value="100" />
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

20 changes: 20 additions & 0 deletions make/ide/idea/langtools/template/compiler.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/src" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/test" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/build" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/make" includeSubdirectories="true" />
</excludeFromCompile>
<resourceExtensions />
<wildcardResourcePatterns />
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

9 changes: 9 additions & 0 deletions make/ide/idea/langtools/template/copyright/langtools.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright (c) &amp;#36;today.year, Oracle and/or its affiliates. All rights reserved.&#10;DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.&#10;&#10;This code is free software; you can redistribute it and/or modify it&#10;under the terms of the GNU General Public License version 2 only, as&#10;published by the Free Software Foundation. Oracle designates this&#10;particular file as subject to the &quot;Classpath&quot; exception as provided&#10;by Oracle in the LICENSE file that accompanied this code.&#10;&#10;This code is distributed in the hope that it will be useful, but WITHOUT&#10;ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&#10;FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License&#10;version 2 for more details (a copy is included in the LICENSE file that&#10;accompanied this code).&#10;&#10;You should have received a copy of the GNU General Public License version&#10;2 along with this work; if not, write to the Free Software Foundation,&#10;Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.&#10;&#10;Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA&#10;or visit www.oracle.com if you need additional information or have any&#10;questions." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="" />
<option name="myName" value="langtools" />
<option name="myLocal" value="true" />
</copyright>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="CopyrightManager">
<settings default="langtools">
<LanguageOptions name="JAVA">
<option name="fileLocation" value="1" />
</LanguageOptions>
</settings>
</component>
30 changes: 30 additions & 0 deletions make/ide/idea/langtools/template/inspectionProfiles/langtools.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="langtools" />
<option name="myLocal" value="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
<inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
<option name="queryNames">
<value />
</option>
<option name="updateNames">
<value />
</option>
</inspection_tool>
<inspection_tool class="RawUseOfParameterizedType" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreObjectConstruction" value="false" />
<option name="ignoreUncompilable" value="true" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
<option name="processCode" value="false" />
<option name="processLiterals" value="false" />
<option name="processComments" value="false" />
</inspection_tool>
<inspection_tool class="SuspiciousMethodCalls" enabled="true" level="WARNING" enabled_by_default="true">
<option name="REPORT_CONVERTIBLE_METHOD_CALLS" value="false" />
</inspection_tool>
</profile>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="langtools" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
29 changes: 29 additions & 0 deletions make/ide/idea/langtools/template/langtools.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java.compiler/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.compiler/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.javadoc/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.jdeps/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.jshell/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.compiler" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.javadoc" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.jdeps" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/make/langtools/tools" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/make/langtools/src/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.compiler" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.javadoc" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.jdeps" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/langtools/gensrc/jdk.jshell" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.compiler" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/java.compiler" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.jdeps" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.jshell" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.javadoc" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
</component>
</module>
18 changes: 18 additions & 0 deletions make/ide/idea/langtools/template/misc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="JTRegService">
<path>@IDEA_JTREG_HOME@</path>
<workDir>build</workDir>
<jre alt="true" value="@IDEA_TARGET_JDK@" />
<options>@XPATCH@</options>
<ant>
<target file="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" name="build-all-classes" />
</ant>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>
9 changes: 9 additions & 0 deletions make/ide/idea/langtools/template/modules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/langtools.iml" filepath="$PROJECT_DIR$/.idea/langtools.iml" />
</modules>
</component>
</project>

22 changes: 22 additions & 0 deletions make/ide/idea/langtools/template/runConfigurations/javac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="javac" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
<option name="VM_PARAMETERS" value='@XPATCH@' />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="langtools" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="Make" enabled="false" />
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" target="build-all-classes" />
</method>
</configuration>
</component>
22 changes: 22 additions & 0 deletions make/ide/idea/langtools/template/runConfigurations/javadoc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="javadoc" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="jdk.javadoc.internal.tool.Main" />
<option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED' />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="langtools" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="Make" enabled="false" />
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" target="build-all-classes" />
</method>
</configuration>
</component>
22 changes: 22 additions & 0 deletions make/ide/idea/langtools/template/runConfigurations/javap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="javap" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
<option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED' />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="langtools" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="Make" enabled="false" />
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" target="build-all-classes" />
</method>
</configuration>
</component>
20 changes: 20 additions & 0 deletions make/ide/idea/langtools/template/runConfigurations/jshell.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="jshell" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="jdk.internal.jshell.tool.JShellToolProvider" />
<option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED' />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="langtools" />
<envs />
<method>
<option name="Make" enabled="false" />
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" target="build-all-classes" />
</method>
</configuration>
</component>
22 changes: 22 additions & 0 deletions make/ide/idea/langtools/template/runConfigurations/sjavac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="sjavac" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
<option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.compiler/com.sun.tools.sjavac=ALL-UNNAMED' />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="langtools" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="Make" enabled="false" />
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/make/ide/idea/langtools/build.xml" target="build-all-classes" />
</method>
</configuration>
</component>
13 changes: 13 additions & 0 deletions make/ide/idea/langtools/template/src/idea/IdeaLoggerWrapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package idea;

import org.apache.tools.ant.Task;

/**
* This class implements a custom Ant task which replaces the standard Intellij IDEA Ant logger
* with a custom one which generates tighter output.
*/
public class IdeaLoggerWrapper extends Task {
public void execute() {
new LangtoolsIdeaAntLogger(getProject());
}
}
Loading

0 comments on commit fbc3048

Please sign in to comment.