Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Build standalone modules (jars) to be uploaded to remote repositories #83

Merged
merged 40 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f2c4c57
load native libraries from resources in jar
johanvos May 17, 2018
b5ca1be
include native libs in the jar.
johanvos May 18, 2018
178aa90
Merge remote-tracking branch 'upstream/master' into nativelibs
johanvos May 23, 2018
8d8320b
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos May 23, 2018
ceb27b5
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 3, 2018
c5082c1
Merge remote-tracking branch 'upstream/master' into nativelibs
johanvos Jun 4, 2018
0cc3eb8
build platform-dependent jars
johanvos Jun 4, 2018
c3d6573
use StackWalker.getCallerClass() to find who is calling the NativeLib…
johanvos Jun 5, 2018
8ad2d14
build publication artifacts in separate directory (don't override SDK…
johanvos Jun 8, 2018
7390c36
fix wildcard imports
johanvos Jun 8, 2018
bf8e543
Merge branch 'develop' into nativelibs
johanvos Jun 8, 2018
0dcf1e7
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 12, 2018
6c05dcf
use platform names in publications
johanvos Jun 12, 2018
c23cc29
cache native libaries in {user, version}-specific directory
johanvos Jun 12, 2018
5cca74e
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 14, 2018
7d9fab0
rename maven group id from openjfx to org.openjfx
johanvos Jun 14, 2018
b6208b6
Only load libraries that are explicitly requested. Dependencies are i…
johanvos Jun 14, 2018
b617ee9
checksum inputstream and existing file to see if they are different
johanvos Jun 14, 2018
ba0e919
Add dependencies for MacOSX media
johanvos Jun 15, 2018
66b00cb
allow to upload artifacts to a remote repository
johanvos Jun 15, 2018
7c9751d
remove unneeded definition
johanvos Jun 15, 2018
6f40e17
Merge remote-tracking branch 'upstream/master' into nativelibs
johanvos Jun 18, 2018
2210efc
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 18, 2018
b0a82cb
first set the version info of JavaFX, then load the libraries.
johanvos Jun 18, 2018
ea2be5e
fix dependency names for mac
johanvos Jun 18, 2018
087b4fb
Add a top-level pom that detects the operation system and sets the va…
johanvos Jun 18, 2018
eff462a
add empty dependencies for all platform by default
johanvos Jun 24, 2018
01848ed
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 24, 2018
3c669ec
remove x-bit
johanvos Jun 27, 2018
6583485
fix whitespace, remove unused tmpdir, clarify we copy to cache.
johanvos Jun 27, 2018
594f3ad
restore blank line
johanvos Jun 27, 2018
7324b33
read inputstream before hashing
johanvos Jun 27, 2018
f971dc5
use Files.delete instead of File.delete
johanvos Jun 27, 2018
5e51513
Merge remote-tracking branch 'upstream/master' into nativelibs
johanvos Jun 29, 2018
c92c6cc
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jun 29, 2018
8145959
read inputstream (for digest processing) in bigger chunks.
johanvos Jun 29, 2018
ad7b02f
Merge remote-tracking branch 'upstream/develop' into nativelibs
johanvos Jul 11, 2018
5e5c576
simply javafx.pom
johanvos Jul 12, 2018
18ad2a4
add log info about the maven version
johanvos Jul 12, 2018
007dfe7
javafx.pom now uses MAVEN_VERSION, defined in build.gradle
johanvos Jul 12, 2018
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
156 changes: 154 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ ext.IS_MAC = OS_NAME.contains("mac") || OS_NAME.contains("darwin")
ext.IS_WINDOWS = OS_NAME.contains("windows")
ext.IS_LINUX = OS_NAME.contains("linux")

ext.MAVEN_GROUP_ID = "org.openjfx"
ext.MAVEN_VERSION = "11.0.0-SNAPSHOT"

// Verify that the architecture & OS are supported configurations. Note that
// at present building on PI is not supported, but we would only need to make
// some changes on assumptions on what should be built (like SWT / Swing) and
Expand Down Expand Up @@ -1514,6 +1517,103 @@ void addJSL(Project project, String name, String pkg, List<String> addExports, C

}

void addMavenPublication(Project project, boolean hasNative, List<String> projectDependencies) {
project.apply plugin: 'maven-publish'

project.group = MAVEN_GROUP_ID
project.version = MAVEN_VERSION

if (project.name == 'base') {
project.publishing {
publications {
javafx(MavenPublication) {
artifactId = 'javafx'
artifacts = []
}
}
}
}

gradle.taskGraph.whenReady { g ->
project.tasks.findAll { it.name == 'generatePomFileForJavafxPublication'}.each { it ->
it.doLast {
copy {
into project.file("${project.buildDir}/publications/javafx")
from file("${rootProject.projectDir}/javafx.pom")
rename "javafx.pom", "pom-default.xml"
}
}
}
}

project.publishing {
repositories {
maven {
def repositoryUrl = project.hasProperty('repositoryUrl') ? project.getProperty('repositoryUrl') : ""
def repositoryUsername = project.hasProperty('repositoryUsername') ? project.getProperty('repositoryUsername') : ""
def repositoryPassword = project.hasProperty('repositoryPassword') ? project.getProperty('repositoryPassword') : ""
url repositoryUrl
credentials {
username repositoryUsername
password repositoryPassword
}
}
}
}

compileTargets { t ->
project.publishing {
publications {
maven(MavenPublication) {
artifactId = project.moduleName

artifact project.tasks."moduleEmptyPublicationJar$t.capital"
artifact project.tasks."modularPublicationJar$t.capital" {
classifier "$t.name"
}

pom.withXml {
Node parent = asNode().appendNode("parent")
parent.appendNode("groupId", MAVEN_GROUP_ID)
parent.appendNode("artifactId", "javafx")
parent.appendNode("version", MAVEN_VERSION)

Node dependencies = asNode().appendNode("dependencies")

Node projectDependencyLinux = dependencies.appendNode("dependency")
projectDependencyLinux.appendNode("groupId", MAVEN_GROUP_ID)
projectDependencyLinux.appendNode("artifactId", project.moduleName)
projectDependencyLinux.appendNode("version", MAVEN_VERSION)
projectDependencyLinux.appendNode("classifier", "\${javafx.platform.linux}")

Node projectDependencyMac = dependencies.appendNode("dependency")
projectDependencyMac.appendNode("groupId", MAVEN_GROUP_ID)
projectDependencyMac.appendNode("artifactId", project.moduleName)
projectDependencyMac.appendNode("version", MAVEN_VERSION)
projectDependencyMac.appendNode("classifier", "\${javafx.platform.mac}")

Node projectDependencyWin = dependencies.appendNode("dependency")
projectDependencyWin.appendNode("groupId", MAVEN_GROUP_ID)
projectDependencyWin.appendNode("artifactId", project.moduleName)
projectDependencyWin.appendNode("version", MAVEN_VERSION)
projectDependencyWin.appendNode("classifier", "\${javafx.platform.win}")

if (!projectDependencies.empty) {
projectDependencies.each { dep ->
Node projectDependency = dependencies.appendNode("dependency")
projectDependency.appendNode("groupId", MAVEN_GROUP_ID)
projectDependency.appendNode("artifactId", "javafx.$dep")
projectDependency.appendNode("version", MAVEN_VERSION)
}
}
}
}
}

}
}
}

/**
* Parses a JDK version string. The string must be in one of the following
* two formats:
Expand Down Expand Up @@ -1814,6 +1914,8 @@ project(":base") {
sourceSets.main.java.srcDirs += "$buildDir/gensrc/java"

compileJava.dependsOn processVersionInfo
addMavenPublication(project, true, [])

}

// The graphics module is needed for any graphical JavaFX application. It requires
Expand All @@ -1826,6 +1928,7 @@ project(":graphics") {
project.ext.includeSources = true
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.graphics"
project.ext.mavenPublish = true

getConfigurations().create("antlr");

Expand Down Expand Up @@ -2237,6 +2340,9 @@ project(":graphics") {
}
}
}

addMavenPublication(project, true, [ 'base' ])

}

project(":controls") {
Expand Down Expand Up @@ -2295,6 +2401,9 @@ project(":controls") {
into project.moduleShimsDir
include "**/*.bss"
})

addMavenPublication(project, false, [ 'graphics' ])

}

project(":swing") {
Expand Down Expand Up @@ -2331,6 +2440,8 @@ project(":swing") {
}

compileJava.options.compilerArgs.addAll(qualExportsSwing)

addMavenPublication(project, false, [ 'graphics' ])
}

project(":swt") {
Expand Down Expand Up @@ -2423,6 +2534,9 @@ project(":fxml") {
// FIXME: change this to also allow JDK 9 boot jdk
classpath += files("$JDK_HOME/jre/lib/ext/nashorn.jar")
}

addMavenPublication(project, false, [ 'controls' ])

}

project(":fxpackagerservices") {
Expand Down Expand Up @@ -3623,6 +3737,9 @@ project(":media") {
dependsOn buildNativeTargets
}
}

addMavenPublication(project, true, [ 'graphics' ])

}

project(":web") {
Expand Down Expand Up @@ -3853,6 +3970,9 @@ project(":web") {
if (IS_COMPILE_WEBKIT) {
assemble.dependsOn compileJavaDOMBinding, drtJar
}

addMavenPublication(project, true, [ 'controls', 'media' ])

}

// This project is for system tests that need to run with a full SDK.
Expand Down Expand Up @@ -4188,7 +4308,6 @@ allprojects {
if (rootProject.hasProperty("EXTRA_COMPILE_ARGS") && project.hasProperty('compileTestJava')) {
project.compileTestJava.options.compilerArgs.addAll(EXTRA_COMPILE_ARGS.split(' '))
}

}

/******************************************************************************
Expand Down Expand Up @@ -4860,6 +4979,7 @@ compileTargets { t ->

// Create modular jars
def srcClassesDir = "${buildDir}/${platformPrefix}module-classes"
def srcLibsDir = "${buildDir}/${platformPrefix}module-lib"
def dstModularJarDir = "${standaloneLibDir}"
def modularJarName = "${moduleName}.jar"
def modularJarTask = project.task("modularJarStandalone$t.capital", type: Jar, dependsOn: project.assemble) {
Expand All @@ -4879,7 +4999,6 @@ compileTargets { t ->
}

// Copy other lib files
def srcLibsDir = "${buildDir}/${platformPrefix}module-lib"
def dstLibsDir = "${standaloneLibDir}"
def copyLibFilesTask = project.task("copyLibFilesStandalone$t.capital", type: Copy, dependsOn: copyNativeFilesTask) {
from srcLibsDir
Expand Down Expand Up @@ -4931,6 +5050,39 @@ compileTargets { t ->

// ============================================================

// Maven Publications
def publicationDirName = "${platformPrefix}publications"
def publicationDir = "${rootProject.buildDir}/${publicationDirName}"

moduleProjList.each { project ->
// Create publications to be uploaded

def moduleName = project.ext.moduleName
def buildDir = project.buildDir

def dstModularJarDir="${publicationDir}"
def srcClassesDir = "${buildDir}/${platformPrefix}module-classes"
def srcLibsDir = "${buildDir}/${platformPrefix}module-lib"

def modularEmptyPublicationJarName = "${moduleName}.jar"
def modularEmptyPublicationJarTask = project.task("moduleEmptyPublicationJar${t.capital}", type: Jar) {
destinationDir = file("${dstModularJarDir}")
archiveName = modularEmptyPublicationJarName
}

def modularPublicationJarName = "${moduleName}-${t.name}.jar"
def modularPublicationJarTask = project.task("modularPublicationJar${t.capital}", type: Jar, dependsOn: modularEmptyPublicationJarTask) {
destinationDir = file("${dstModularJarDir}")
archiveName = modularPublicationJarName
from srcLibsDir
from srcClassesDir
}

buildModulesTask.dependsOn(modularPublicationJarTask)

}
// ============================================================

def buildRunArgsTask = task("buildRunArgs$t.capital",
group: "Build", dependsOn: buildModulesTask) {
outputs.file(runArgsFile);
Expand Down
69 changes: 69 additions & 0 deletions javafx.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>11.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>openjfx</name>
<description>OpenJFX JavaFX</description>
<properties>
<javafx.version>11.0.0-SNAPSHOT</javafx.version>
Copy link
Collaborator

@kevinrushforth kevinrushforth Jul 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this OK to hard-code to the SNAPSHOT version?

<javafx.platform>${os.name}</javafx.platform>
<javafx.platform.linux>linux</javafx.platform.linux>
<javafx.platform.mac>mac</javafx.platform.mac>
<javafx.platform.win>win</javafx.platform.win>
</properties>
<dependencyManagement>
</dependencyManagement>
<profiles>
<profile>
<id>linux</id>
<activation>
<os>
<name>linux</name>
</os>
</activation>
<properties>
<os.name>linux</os.name>
</properties>
</profile>
<profile>
<id>macosx</id>
<activation>
<os>
<name>mac os x</name>
</os>
</activation>
<properties>
<os.name>mac</os.name>
</properties>
</profile>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<os.name>win</os.name>
</properties>
</profile>
<profile>
<id>javafx.platform.custom</id>
<activation>
<property>
<name>javafx.platform</name>
</property>
</activation>
<properties>
<javafx.platform.linux>${javafx.platform}</javafx.platform.linux>
<javafx.platform.mac>${javafx.platform}</javafx.platform.mac>
<javafx.platform.win>${javafx.platform}</javafx.platform.win>
</properties>
</profile>
</profiles>
</project>
Loading