Skip to content

Commit

Permalink
IGNITE-11189: Java 11 local build supported, profile Java9+ can be ac…
Browse files Browse the repository at this point in the history
…tivated to build using newer JDKs
  • Loading branch information
dspavlov committed Feb 22, 2019
1 parent 025562f commit 48be973
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.Set;
import org.apache.ignite.ml.math.primitives.vector.NamedVector;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.omg.CORBA.NamedValue;


/**
* Delegating named vector that delegates all operations to underlying vector and adds implementation of
Expand Down
53 changes: 53 additions & 0 deletions modules/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,59 @@
<version>2.8.0-SNAPSHOT</version>
<url>http://ignite.apache.org</url>



<profiles>
<profile>
<id>java-9+</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<properties>
<src.javaspecific.dir>src/main/java11</src.javaspecific.dir>
</properties>
</profile>

<profile>
<id>java-8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<src.javaspecific.dir>src/main/java8</src.javaspecific.dir>
</properties>
</profile>
</profiles>


<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${src.javaspecific.dir}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>




<dependencies>
<dependency>
<groupId>org.jodd</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.ignite.tools.javadoc;

import com.sun.javadoc.Tag;
import com.sun.source.doctree.DocTree;
import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.lang.model.element.Element;
import jdk.javadoc.doclet.Taglet;

/**
* Represents {@ignitelink Class} tag. This tag can
* be used as replacement of {@link Class} tag that references to the Ignite class that is not in classpath.
* Class and its arguments should have fully qualified names.
*/
public class IgniteLinkTaglet implements Taglet {
/** */
private static final String NAME = "ignitelink";

/**
* Return the name of this custom tag.
*/
@Override public String getName() {
return NAME;
}

@Override public String toString(List<? extends DocTree> tags, Element element) {
StringBuilder sb = new StringBuilder();

for (Iterator<? extends DocTree> iter = tags.iterator(); iter.hasNext(); ) {
DocTree next = iter.next();

sb.append(""); //todo IGNITE-11393 Implement toString for Java 9+
}

return sb.toString();
}

@Override public Set<Location> getAllowedLocations() {
return new HashSet<>();
}

/**
* Will return true since this is an inline tag.
*
* @return true since this is an inline tag.
*/
@Override public boolean isInlineTag() {
return true;
}

/**
* Register this Taglet.
*
* @param tagletMap the map to register this tag to.
*/
public static void register(Map<String, IgniteLinkTaglet> tagletMap) {
IgniteLinkTaglet tag = new IgniteLinkTaglet();

Taglet t = tagletMap.get(tag.getName());

if (t != null)
tagletMap.remove(tag.getName());

tagletMap.put(tag.getName(), tag);
}

/**
* Given the <code>Tag</code> representation of this custom tag, return its string representation.
* <p>
* Input: org.apache.ignite.grid.spi.indexing.h2.GridH2IndexingSpi#setIndexCustomFunctionClasses(Class[])
* <p>
* Output: <a href="../../../../../org/apache/ignite/grid/spi/indexing/h2/GridH2IndexingSpi.html#
* setIndexCustomFunctionClasses(java.lang.Class...)">
* <code>GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])</code></a>
*
* @param tag <code>Tag</code> representation of this custom tag.
*/
public String toString(Tag tag) {
if (tag.text() == null || tag.text().isEmpty())
return "";

File f = tag.position().file();

String curClass = f == null ? "" : f.getAbsolutePath().replace(File.separator, ".");

String packPref = "src.main.java.";

int idx = curClass.indexOf(packPref);

StringBuilder path = new StringBuilder();

if (idx != -1) {
curClass = curClass.substring(idx + packPref.length());

for (int i = 0, n = curClass.split("\\.").length - 2; i < n; i++)
path.append("../");
}

String[] tokens = tag.text().split("#");

int lastIdx = tokens[0].lastIndexOf('.');

String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length() ?
tokens[0].substring(lastIdx + 1) : tokens[0];

String fullyQClsName = tokens[0].replace(".", "/");

return "<a href=\"" + path.toString() + fullyQClsName + ".html" +
(tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") +
"\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1]) : "") + "</code></a>";
}
}
14 changes: 11 additions & 3 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,13 +1024,13 @@
</profile>

<profile>
<id>java-9</id>
<id>java-9+</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<properties>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<scala.library.version>2.12.6</scala.library.version>
</properties>
<dependencies/>
Expand All @@ -1053,6 +1053,14 @@
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --illegal-access=permit</argLine>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 48be973

Please sign in to comment.