Skip to content

Commit

Permalink
[Jenkins-Build] Build SWT-natives against Java-17 JDK header files
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Apr 23, 2023
1 parent 6dfd30b commit 3d0f870
Show file tree
Hide file tree
Showing 17 changed files with 9,380 additions and 15 deletions.
41 changes: 27 additions & 14 deletions Jenkinsfile
Expand Up @@ -91,6 +91,27 @@ pipeline {
ant -f eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml new_build_with_create_file -DTAG=HEAD
'''
}
script { // Stash jdk-headers for transfer to the natives build machines
if ( params.forceNativeBuilds || (fileExists ('tmp/build_changed.txt') && fileExists ('tmp/natives_changed.txt')) ){
// def javaHomeLinux = tool(type:'jdk', name:'temurin-jdk11-latest')
// def javaHomeWin32 = tool(type:'jdk', name:'temurin-jdk11-latest-win')
// def javaHomeMacos = tool(type:'jdk', name:'temurin-jdk11-latest-mac')
dir('eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI') {
dir('common/jdk.headers') {
stash name:"jdk.headers.common", includes: "include/"
}
dir('cocoa/jdk.headers') {
stash name:"jdk.headers.macosx", includes: "include/"
}
dir('gtk/jdk.headers') {
stash name:"jdk.headers.linux", includes: "include/"
}
dir('win32/jdk.headers') {
stash name:"jdk.headers.win32", includes: "include/"
}
}
}
}
}
}
stage('Build SWT-binaries, if needed') {
Expand Down Expand Up @@ -136,22 +157,14 @@ pipeline {
def (ws, os, arch) = env.PLATFORM.split('\\.')
echo "OS: ${os}"
echo "ARCH: ${arch}"
def javaHome = env.JAVA_HOME
// Some of the native-build agents don't have their JAVA_HOME properly set. Actually that should be done in the agents
//TODO: ask the infra-team to fix the setup. This is a infra-setup detail and should not be handled in the pipeline.
if(os =='linux' && arch == 'aarch64'){
def armJDK = '/usr/lib/jvm/java-11-openjdk-arm64'
javaHome = fileExists(armJDK) ? armJDK : '/usr/lib/jvm/java-11-openjdk'
} else if (os =='linux' && arch == 'ppc64le') {
javaHome = '/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-3.el8.ppc64le'
} else if (os =='linux' && arch == 'x86_64') {
javaHome = tool(type:'jdk', name:'temurin-jdk11-latest')
} else if(os == 'macosx') {
javaHome = tool(type:'jdk', name:'temurin-jdk11-latest')
dir('jdk.headers') {
unstash "jdk.headers.common"
unstash "jdk.headers.${os}"
}
echo 'JAVA_HOME: ' + javaHome
def jdkHeaderHome = "${WORKSPACE}/jdk.headers"
echo 'SWT_JAVA_HOME: ' + jdkHeaderHome
// TODO: don't zip the sources and just (un)stash them unzipped! That safes the unzipping and removal of the the zip
withEnv(['MODEL=' + arch, "OUTPUT_DIR=${WORKSPACE}/libs", 'JAVA_HOME=' + javaHome]) {
withEnv(['MODEL=' + arch, "OUTPUT_DIR=${WORKSPACE}/libs", 'JAVA_HOME=' + jdkHeaderHome, 'SWT_JAVA_HOME=' + jdkHeaderHome]) {
if(isUnix()){
sh '''
unzip -aa org.eclipse.swt.${PLATFORM}.master.zip
Expand Down
@@ -0,0 +1,77 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#ifndef _JAVASOFT_JAWT_MD_H_
#define _JAVASOFT_JAWT_MD_H_

#include "jawt.h"

#ifdef __OBJC__
#import <QuartzCore/CALayer.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*
* MacOS specific declarations for AWT native interface.
* See notes in jawt.h for an example of use.
*/

/*
* When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
* flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
* return false. This is to maintain compatibility with applications that used the
* interface with Java 6 which had multiple rendering models. This flag is not necessary
* when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
*
* Example:
* JAWT awt;
* awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
* jboolean success = JAWT_GetAWT(env, &awt);
*/
#define JAWT_MACOSX_USE_CALAYER 0x80000000

/*
* When the native Cocoa toolkit is in use, the pointer stored in
* JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
* JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
* specified layer to be overlaid on the Components rectangle. If the window the
* Component belongs to has a CALayer attached to it, this layer will be accessible via
* the windowLayer property.
*/
#ifdef __OBJC__
@protocol JAWT_SurfaceLayers
@property (readwrite, retain) CALayer *layer;
@property (readonly) CALayer *windowLayer;
@end
#endif

#ifdef __cplusplus
}
#endif

#endif /* !_JAVASOFT_JAWT_MD_H_ */
@@ -0,0 +1,66 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#ifndef __has_attribute
#define __has_attribute(x) 0
#endif

#ifndef JNIEXPORT
#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
#ifdef ARM
#define JNIEXPORT __attribute__((externally_visible,visibility("default")))
#else
#define JNIEXPORT __attribute__((visibility("default")))
#endif
#else
#define JNIEXPORT
#endif
#endif

#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
#ifdef ARM
#define JNIIMPORT __attribute__((externally_visible,visibility("default")))
#else
#define JNIIMPORT __attribute__((visibility("default")))
#endif
#else
#define JNIIMPORT
#endif

#define JNICALL

typedef int jint;
#ifdef _LP64
typedef long jlong;
#else
typedef long long jlong;
#endif

typedef signed char jbyte;

#endif /* !_JAVASOFT_JNI_MD_H_ */
Expand Up @@ -18,7 +18,12 @@ cd `dirname $0`
if [ -d /System/Library/Frameworks/JavaVM.framework/Headers ]; then
export CFLAGS_JAVA_VM="-I /System/Library/Frameworks/JavaVM.framework/Headers"
else
export CFLAGS_JAVA_VM="-I $(/usr/libexec/java_home)/include -I $(/usr/libexec/java_home)/include/darwin"
if [ ! -z ${SWT_JAVA_HOME} ] && [ -d ${SWT_JAVA_HOME} ]; then
jdkHeaderHome=${SWT_JAVA_HOME}
else
jdkHeaderHome=$(/usr/libexec/java_home)
fi
export CFLAGS_JAVA_VM="-I ${jdkHeaderHome}/include -I ${jdkHeaderHome}/include/darwin"
fi

if [ "x${MODEL}" = "xx86_64" ]; then
Expand Down

0 comments on commit 3d0f870

Please sign in to comment.