代码拉取完成,页面将自动刷新
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
apply plugin: "maven"
apply plugin: "signing"
project.defaultTasks = ["uploadArchives"]
project.buildDir = 'bin/MAVEN'
project.group = "org.lwjgl"
project.version = lwjglVersion
// Set build variables based on build type (release, continuous integration, development)
enum BuildType {
LOCAL,
SNAPSHOT,
RELEASE
}
class Deployment {
BuildType type
String repo
String user
String password
}
Deployment deployment
if ( hasProperty("release") ) {
deployment = new Deployment(
type: BuildType.RELEASE,
repo: "https://oss.sonatype.org/service/local/staging/deploy/maven2/",
user: sonatypeUsername,
password: sonatypePassword
)
} else if ( hasProperty("snapshot") ) {
project.version += "-SNAPSHOT"
deployment = new Deployment(
type: BuildType.SNAPSHOT,
repo: "https://oss.sonatype.org/content/repositories/snapshots/",
user: sonatypeUsername,
password: sonatypePassword
)
} else {
deployment = new Deployment(
type: BuildType.LOCAL,
repo: repositories.mavenLocal().url
)
}
println "${deployment.type.name()} BUILD"
enum Platforms {
LINUX("linux"),
MACOS("macos"),
WINDOWS("windows")
static final Platforms[] JAVA_ONLY = []
static final Platforms[] ALL = values()
final String name
Platforms(String name) {
this.name = name
}
}
enum Artifacts {
CORE("lwjgl", "LWJGL", "The LWJGL core library.", Platforms.ALL),
ASSIMP(
"lwjgl-assimp", "LWJGL - Assimp bindings",
"A portable Open Source library to import various well-known 3D model formats in a uniform manner.",
Platforms.ALL
),
BGFX(
"lwjgl-bgfx", "LWJGL - bgfx bindings",
"A cross-platform, graphics API agnostic rendering library. It provides a high performance, low level abstraction for common platform graphics APIs like OpenGL, Direct3D and Apple Metal.",
Platforms.ALL
),
EGL(
"lwjgl-egl", "LWJGL - EGL bindings",
"An interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system.",
Platforms.JAVA_ONLY
),
GLFW(
"lwjgl-glfw", "LWJGL - GLFW bindings",
"An multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.",
Platforms.ALL
),
JAWT(
"lwjgl-jawt", "LWJGL - JAWT bindings",
"The AWT native interface.",
Platforms.JAVA_ONLY
),
JEMALLOC(
"lwjgl-jemalloc", "LWJGL - jemalloc bindings",
"A general purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support.",
Platforms.ALL
),
LMDB(
"lwjgl-lmdb", "LWJGL - LMDB bindings",
"A compact, fast, powerful, and robust database that implements a simplified variant of the BerkeleyDB (BDB) API.",
Platforms.ALL
),
LZ4(
"lwjgl-lz4", "LWJGL - LZ4 bindings",
"A lossless data compression algorithm that is focused on compression and decompression speed.",
Platforms.ALL
),
NANOVG(
"lwjgl-nanovg", "LWJGL - NanoVG & NanoSVG bindings",
"A small antialiased vector graphics rendering library for OpenGL. Also includes NanoSVG, a simple SVG parser.",
Platforms.ALL
),
NFD(
"lwjgl-nfd", "LWJGL - Native File Dialog bindings",
"A tiny, neat C library that portably invokes native file open and save dialogs.",
Platforms.ALL
),
NUKLEAR(
"lwjgl-nuklear", "LWJGL - Nuklear bindings",
"A minimal state immediate mode graphical user interface toolkit.",
Platforms.ALL
),
OPENAL(
"lwjgl-openal", "LWJGL - OpenAL bindings",
"A cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications.",
Platforms.ALL
),
OPENCL(
"lwjgl-opencl", "LWJGL - OpenCL bindings",
"An open, royalty-free standard for cross-platform, parallel programming of diverse processors found in personal computers, servers, mobile devices and embedded platforms.",
Platforms.JAVA_ONLY
),
OPENGL(
"lwjgl-opengl", "LWJGL - OpenGL bindings",
"The most widely adopted 2D and 3D graphics API in the industry, bringing thousands of applications to a wide variety of computer platforms.",
Platforms.ALL
),
OPENGLES(
"lwjgl-opengles", "LWJGL - OpenGL ES bindings",
"A royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems - including consoles, phones, appliances and vehicles.",
Platforms.ALL
),
OPENVR(
"lwjgl-openvr", "LWJGL - OpenVR bindings",
"OpenVR is an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting.",
Platforms.ALL
),
OVR(
"lwjgl-ovr", "LWJGL - OVR bindings",
"The API of the Oculus SDK.",
Platforms.WINDOWS
),
PAR(
"lwjgl-par", "LWJGL - par_shapes bindings",
"Generate parametric surfaces and other simple shapes.",
Platforms.ALL
),
REMOTERY(
"lwjgl-remotery", "LWJGL - Remotery bindings",
"A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser.",
Platforms.ALL
),
RPMALLOC(
"lwjgl-rpmalloc", "LWJGL - rpmalloc bindings",
"A public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.",
Platforms.ALL
),
SSE(
"lwjgl-sse", "LWJGL - SSE bindings",
"Simple SSE intrinsics.",
Platforms.ALL
),
STB(
"lwjgl-stb", "LWJGL - stb bindings",
"Single-file public domain libraries for fonts, images, ogg vorbis files and more.",
Platforms.ALL
),
TINYEXR(
"lwjgl-tinyexr", "LWJGL - Tiny OpenEXR bindings",
"A small library to load and save OpenEXR(.exr) images.",
Platforms.ALL
),
TINYFD(
"lwjgl-tinyfd", "LWJGL - Tiny File Dialogs bindings",
"Provides basic modal dialogs.",
Platforms.ALL
),
VULKAN(
"lwjgl-vulkan", "LWJGL - Vulkan bindings",
"A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.",
Platforms.JAVA_ONLY
),
XXHASH(
"lwjgl-xxhash", "LWJGL - xxHash bindings",
"An Extremely fast Hash algorithm, running at RAM speed limits.",
Platforms.ALL
),
YOGA(
"lwjgl-yoga", "LWJGL - Yoga bindings",
"An open-source, cross-platform layout library that implements Flexbox.",
Platforms.ALL
),
ZSTD(
"lwjgl-zstd", "LWJGL - Zstandard bindings",
"Zstandard (zstd) is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios.",
Platforms.ALL
)
String artifact
String projectName
String projectDescription
Platforms[] platforms
private Artifacts(
String artifact,
String projectName, String projectDescription,
Platforms... platforms
) {
this.artifact = artifact
this.projectName = projectName
this.projectDescription = projectDescription
this.platforms = platforms
}
private String directory(String buildDir) {
return "$buildDir/$artifact"
}
private String path() {
return "${directory("bin/MAVEN")}/$artifact"
}
boolean active() {
return new File(directory("bin/RELEASE")).exists()
}
Map<String, Object> artifactNotation(String classifier = null) {
if ( classifier == null )
return [file: new File("${path()}.jar"), name: artifact, type: "jar"]
else
return [file: new File("${path()}-${classifier}.jar"), name: artifact, type: "jar", classifier: classifier]
}
}
artifacts {
/*
Ideally, we'd have the following structure:
-------------------------------------------
lwjgl
lwjgl-windows (depends on lwjgl)
glfw (depends on lwjgl)
glfw-windows (depends on glfw & lwjgl-windows)
stb (depends on lwjgl)
stb-windows (depends on stb & lwjgl-windows)
-------------------------------------------
If a user wanted to use GLFW + stb in their project, running on
the Windows platform, they'd only have to define glfw-windows
and stb-windows as dependencies. This would automatically
resolve stb, glfw, lwjgl and lwjgl-windows as transitive
dependencies. Unfortunately, it is not possible to define such
a relationship between Maven artifacts when using classifiers.
A method to make this work is make the natives-<arch> classified
JARs separate artifacts. We do not do it for aesthetic reasons.
Instead, we assume that a tool is available (on the LWJGL website)
that automatically generates POM/Gradle dependency structures for
projects wanting to use LWJGL. The output is going to be verbose;
the above example is going to look like this in Gradle:
-------------------------------------------
compile 'org.lwjgl:lwjgl:$lwjglVersion' // NOTE: this is optional, all binding artifacts have a dependency on lwjgl
runtime 'org.lwjgl:lwjgl:$lwjglVersion:natives-$lwjglArch'
compile 'org.lwjgl:lwjgl-glfw:$lwjglVersion'
runtime 'org.lwjgl:lwjgl-glfw:$lwjglVersion:natives-$lwjglArch'
compile 'org.lwjgl:lwjgl-stb:$lwjglVersion'
runtime 'org.lwjgl:lwjgl-stb:$lwjglVersion:natives-$lwjglArch'
-------------------------------------------
and a whole lot more verbose in Maven. Hopefully, the automation
is going to alleviate the pain.
*/
Artifacts.values().each { module ->
if ( module.active() ) {
archives module.artifactNotation()
archives module.artifactNotation("sources")
archives module.artifactNotation("javadoc")
module.platforms.each {
archives module.artifactNotation("natives-${it.name}")
}
}
}
}
signing {
required = deployment.type == BuildType.RELEASE
sign configurations.archives
}
signArchives.dependsOn "copyArchives"
uploadArchives.dependsOn signArchives
// TODO: Find a way to merge the POM generation closures
def lwjglPOM = { String projectName, String projectDescription ->
return {
project {
name projectName
description projectDescription
packaging "jar"
url 'https://www.lwjgl.org'
scm {
connection 'scm:git:https://github.com/LWJGL/lwjgl3.git'
developerConnection 'scm:git:https://github.com/LWJGL/lwjgl3.git'
url 'https://github.com/LWJGL/lwjgl3.git'
}
licenses {
license {
name 'BSD'
url 'https://www.lwjgl.org/license'
distribution 'repo'
}
}
developers {
developer {
id "spasi"
name "Ioannis Tsakpinis"
email "iotsakp@gmail.com"
url "https://github.com/Spasi"
}
}
}
}
}
def bindingPOM = { String projectName, String projectDescription ->
return {
project {
name projectName
description projectDescription
packaging "jar"
url 'https://www.lwjgl.org'
scm {
connection 'scm:git:https://github.com/LWJGL/lwjgl3.git'
developerConnection 'scm:git:https://github.com/LWJGL/lwjgl3.git'
url 'https://github.com/LWJGL/lwjgl3.git'
}
licenses {
license {
name 'BSD'
url 'https://www.lwjgl.org/license'
distribution 'repo'
}
}
developers {
developer {
id "spasi"
name "Ioannis Tsakpinis"
email "iotsakp@gmail.com"
url "https://github.com/Spasi"
}
}
dependencies {
dependency {
groupId 'org.lwjgl'
artifactId 'lwjgl'
version project.version
scope 'compile'
}
}
}
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: deployment.repo) {
authentication(userName: deployment.user, password: deployment.password)
}
beforeDeployment {
signing.signPom(it)
}
Artifacts.values().each {
addFilter(it.artifact) {
artifact, file -> artifact.name == it.artifact
}
pom(
it.artifact,
it == Artifacts.CORE
? lwjglPOM(it.projectName, it.projectDescription)
: bindingPOM(it.projectName, it.projectDescription)
)
}
}
}
}
task copyArchives(type: Copy) {
from "bin/RELEASE"
include "**"
destinationDir buildDir
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。