diff --git a/.gitignore b/.gitignore
index 734ffd405..c48d5586e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,7 +24,12 @@
.jdk
.jib
.classpath
-.idea
+.idea/workspace.xml
+.idea/modules.xml
+.idea/libraries
+.idea/shelf/
+.idea/tasks.xml
+.idea/usage.statistics.xml
.project
.settings
*.iml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 000000000..78ab71fd0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 000000000..3872e89ad
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 000000000..f3b1ce1e3
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 000000000..25a8e8295
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Clean.xml b/.idea/runConfigurations/Clean.xml
new file mode 100644
index 000000000..0984f5fb7
--- /dev/null
+++ b/.idea/runConfigurations/Clean.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Images.xml b/.idea/runConfigurations/Images.xml
new file mode 100644
index 000000000..9a1b46891
--- /dev/null
+++ b/.idea/runConfigurations/Images.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Test.xml b/.idea/runConfigurations/Test.xml
new file mode 100644
index 000000000..c24bd92c5
--- /dev/null
+++ b/.idea/runConfigurations/Test.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 0986182e6..d671a4e35 100644
--- a/README.md
+++ b/README.md
@@ -214,6 +214,28 @@ If you choose to use [Vim](https://vim.org) as your editor when working on Skara
probably also want to utilize the Makefile wrapper. The Makefile wrapper enables
to you to run `:make` and `:make tests` in Vim.
+### IntelliJ IDEA
+
+Skara has support for [IntellJ IDEA](https://www.jetbrains.com/idea/) out of the
+box, both the "Community" edition and the "Ultimate" edition. To work on Skara
+with IntelliJ IDEA you only have to "Open" the Skara directory.
+
+If you do not have a JDK 13 SDK set up in IntelliJ IDEA, then you need to set
+one up. IntelliJ IDEA will prompt you to set up a "Project SDK" when you open
+any Skara Java source code file. Press the "Setup SDK" button in the blue bar at
+the top of the Java source code file, then press "Configure" in the new dialog,
+then press the little "+" button in top-left corner in the next dialog and
+select a path containing a [JDK 13](https://jdk.java.net/13) home directory.
+
+There are currently three run configurations provided:
+
+- `Images` - create all jlinked images
+- `Test` - run all tests
+- `Clean` - remove all build and test artifacts
+
+To run any of the above configurations, click the "Run" top-level menu and then
+the "Run..." action (by default bound to the Alt+Shift+F10 key combination).
+
## Wiki
Project Skara's wiki is available at .
diff --git a/build.gradle b/build.gradle
index dbef0890f..fcd7aba01 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,12 @@ plugins {
id 'org.openjdk.skara.gradle.reproduce'
}
+def JAVA_HOMES = [
+ "LinuxX64": ".jdk/openjdk-13.0.1_linux-x64_bin/jdk-13.0.1",
+ "MacosX64": ".jdk/openjdk-13.0.1_osx-x64_bin/jdk-13.0.1.jdk/Contents/Home",
+ "WindowsX64": ".jdk/openjdk-13.0.1_windows-x64_bin"
+]
+
configure(subprojects.findAll() { it.name != 'bots' }) {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
@@ -34,6 +40,8 @@ configure(subprojects.findAll() { it.name != 'bots' }) {
apply plugin: 'org.openjdk.skara.gradle.version'
group = 'org.openjdk.skara'
+ sourceCompatibility = 13
+ targetCompatibility = 13
repositories {
mavenLocal()
@@ -51,8 +59,30 @@ configure(subprojects.findAll() { it.name != 'bots' }) {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.5.2'
}
- compileJava.options.encoding = 'UTF-8'
- compileTestJava.options.encoding = 'UTF-8'
+ compileJava {
+ gradle.taskGraph.whenReady { graph ->
+ if (!graph.hasTask(":offline")) {
+ dependsOn project(":").getTasksByName("download" + getOSAndCPU() + "JDK", false)
+ options.forkOptions.javaHome = file(project.rootDir.toString() + "/" + JAVA_HOMES[getOSAndCPU()])
+ options.compilerArgs += ['--release', '13']
+ options.fork = true
+ options.sourcepath = files(sourceSets.main.java.srcDirs)
+ }
+ }
+ options.encoding = 'UTF-8'
+ }
+
+ compileTestJava {
+ gradle.taskGraph.whenReady { graph ->
+ if (!graph.hasTask(":offline")) {
+ dependsOn project(":").getTasksByName("download" + getOSAndCPU() + "JDK", false)
+ options.forkOptions.javaHome = file(project.rootDir.toString() + "/" + JAVA_HOMES[getOSAndCPU()])
+ options.compilerArgs += ['--release', '13']
+ options.fork = true
+ }
+ }
+ options.encoding = 'UTF-8'
+ }
test {
useJUnitPlatform()
@@ -65,6 +95,13 @@ configure(subprojects.findAll() { it.name != 'bots' }) {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
+
+ gradle.taskGraph.whenReady { graph ->
+ if (!graph.hasTask(":offline")) {
+ dependsOn project(":").getTasksByName("download" + getOSAndCPU() + "JDK", false)
+ executable = file(project.rootDir.toString() + "/" + JAVA_HOMES[getOSAndCPU()] + "/bin/java" + (getOS() == "windows" ? ".exe" : ""))
+ }
+ }
}
publishing {
@@ -144,6 +181,15 @@ def getCPU() {
throw new GradleException("Unexpected CPU: " + cpu)
}
+def getOSAndCPU() {
+ return combineOSAndCPU(getOS(), getCPU())
+}
+
+def combineOSAndCPU(os, cpu) {
+ return os.substring(0, 1).toUpperCase() + os.substring(1) +
+ cpu.substring(0, 1).toUpperCase() + cpu.substring(1)
+}
+
task local(type: Copy) {
doFirst {
delete project.buildDir
@@ -153,9 +199,7 @@ task local(type: Copy) {
def cpu = getCPU()
if (os in ['linux', 'macos', 'windows'] && cpu == 'x64') {
- def target = os.substring(0, 1).toUpperCase() + os.substring(1) +
- cpu.substring(0, 1).toUpperCase() + cpu.substring(1)
- dependsOn ':cli:image' + target
+ dependsOn ':cli:image' + combineOSAndCPU(os, cpu)
} else {
dependsOn ':cli:imageLocal'
}
diff --git a/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/ImagesPlugin.java b/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/ImagesPlugin.java
index 01b9c2a69..a3053fa75 100644
--- a/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/ImagesPlugin.java
+++ b/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/ImagesPlugin.java
@@ -30,7 +30,9 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Map;
import java.io.File;
+import java.nio.file.Path;
public class ImagesPlugin implements Plugin {
private static String getOS() {
@@ -88,6 +90,7 @@ public ImageEnvironment create(String name) {
var projectPath = project.getPath();
var taskNames = new ArrayList();
var rootDir = project.getRootDir().toPath().toAbsolutePath();
+ var rootProject = project.getRootProject();
var buildDir = project.getBuildDir().toPath().toAbsolutePath();
imageEnvironmentContainer.all(new Action() {
@@ -102,8 +105,8 @@ public void execute(ImageEnvironment env) {
var subName = isLocal ? "Local" : osAndCpuPascalCased;
var downloadTaskName = "download" + subName + "JDK";
- if (!isLocal) {
- project.getTasks().register(downloadTaskName, DownloadJDKTask.class, (task) -> {
+ if (!isLocal && rootProject.getTasksByName(downloadTaskName, false).isEmpty()) {
+ project.getRootProject().getTasks().register(downloadTaskName, DownloadJDKTask.class, (task) -> {
task.getUrl().set(env.getUrl());
task.getSha256().set(env.getSha256());
task.getToDir().set(rootDir.resolve(".jdk"));
@@ -127,7 +130,7 @@ public void execute(ImageEnvironment env) {
}
if (!isLocal) {
- task.dependsOn(projectPath + ":" + downloadTaskName);
+ task.dependsOn(project.getRootProject().getTasksByName(downloadTaskName, false));
task.getUrl().set(env.getUrl());
} else {
task.getUrl().set("local");
@@ -137,6 +140,26 @@ public void execute(ImageEnvironment env) {
task.getCPU().set(cpu);
task.getLaunchers().set(env.getLaunchers());
task.getModules().set(env.getModules());
+ if (isLocal) {
+ task.getJLink().set(Path.of(System.getProperty("java.home"), "bin", "jlink").toAbsolutePath().toString());
+ } else {
+ var javaHomes = Map.of(
+ "linux_x64", ".jdk/openjdk-13.0.1_linux-x64_bin/jdk-13.0.1",
+ "macos_x64", ".jdk/openjdk-13.0.1_osx-x64_bin/jdk-13.0.1.jdk/Contents/Home",
+ "windows_x64", ".jdk\\openjdk-13.0.1_windows-x64_bin"
+ );
+ var currentOS = getOS();
+ var currentCPU = getCPU();
+ var javaHome = javaHomes.get(currentOS + "_" + currentCPU);
+ if (javaHome == null) {
+ throw new RuntimeException("No JDK found for " + currentOS + " " + currentCPU);
+ }
+ if (currentOS.equals("windows")) {
+ task.getJLink().set(rootDir.toString() + "\\" + javaHome + "\\bin\\jlink.exe");
+ } else {
+ task.getJLink().set(rootDir.toString() + "/" + javaHome + "/bin/jlink");
+ }
+ }
});
var launchersTaskName = "launchers" + subName;
@@ -214,7 +237,9 @@ public void execute(ImageEnvironment env) {
}
});
- taskNames.add(imageTaskName);
+ if (!isLocal) {
+ taskNames.add(imageTaskName);
+ }
}
});
diff --git a/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/LinkTask.java b/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/LinkTask.java
index 1cd6a8b7a..29964754d 100644
--- a/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/LinkTask.java
+++ b/buildSrc/images/src/main/java/org/openjdk/skara/gradle/images/LinkTask.java
@@ -43,6 +43,7 @@ public class LinkTask extends DefaultTask {
private final Property os;
private final Property cpu;
private final Property url;
+ private final Property jlink;
private final Property toDir;
private final MapProperty launchers;
private final ListProperty modules;
@@ -54,6 +55,7 @@ public LinkTask(ObjectFactory factory) {
os = factory.property(String.class);
cpu = factory.property(String.class);
url = factory.property(String.class);
+ jlink = factory.property(String.class);
toDir = factory.property(Path.class);
launchers = factory.mapProperty(String.class, String.class);
modules = factory.listProperty(String.class);
@@ -81,6 +83,11 @@ Property getUrl() {
return url;
}
+ @Input
+ Property getJLink() {
+ return jlink;
+ }
+
@Input
MapProperty getLaunchers() {
return launchers;
@@ -163,9 +170,8 @@ void link() throws IOException {
Collections.sort(modulePath);
Collections.sort(allModules);
- var jlink = Path.of(System.getProperty("java.home"), "bin", "jlink").toAbsolutePath().toString();
project.exec((spec) -> {
- spec.setCommandLine(jlink, "--module-path", String.join(File.pathSeparator, modulePath),
+ spec.setCommandLine(jlink.get(), "--module-path", String.join(File.pathSeparator, modulePath),
"--add-modules", String.join(",", allModules),
"--no-man-pages",
"--no-header-files",
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index d6d720cbe..b18f18472 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -19,5 +19,9 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
-distributionSha256Sum=5a3578b9f0bb162f5e08cf119f447dfb8fa950cedebb4d2a977e912a11a74b91
\ No newline at end of file
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionSha256Sum=a1eb4439c0a85bc7e64a22658d862e43b7d0ddfbf69a7abf6256e0b7514295df
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME