Compare commits

...

5 Commits

Author SHA1 Message Date
Stephen Gold
bd1b6d284c com.jme3.scene.shape.Line: protect the no-argument constructor (#1234) 2019-12-21 08:48:51 -05:00
Stephen Gold
8a04afd7a1 AnimControl: correct javadoc for the no-arg constructor (#1233) 2019-12-21 08:48:43 -05:00
Stephen Gold
f9d2e03362 Mesh: avoid NPE in getMorphTargets() when there are no targets (#1231) 2019-12-21 08:48:25 -05:00
Paul Speed
8905b3d8f8 Refactored how versions are auto-built to provide more normal versions
when building locally.
Normal auto-detected versions will be based on the base version parsed
from the most recent tag on the branch with a -SNAPSHOT appended.  If
the current commit is the tagged commit then it is used directly to
preserve backwards compatibility... but really that should be a CI
only option for most use-cases.
A new includeBranchInVersion option was added to allow the old behavior
of including the branch name in a munged version string for those
wanting to keep their experimental branch builds separate from their
normal master/version-branch builds.
2019-12-21 08:43:59 -05:00
Riccardo Balbo
a2169999e5 Remove "v" from version tag to maintain consistency with old releases 2019-12-21 05:02:37 -05:00
5 changed files with 115 additions and 27 deletions

View File

@ -8,6 +8,10 @@ jmeVersionName =
# If true, the version name will contain the commit hash
useCommitHashAsVersionName = false
# Set to true if a non-master branch name should be included in the automatically
# generated version.
includeBranchInVersion = false
# specify if JavaDoc should be built
buildJavaDoc = true

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2018 jMonkeyEngine
* Copyright (c) 2009-2019 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -102,7 +102,9 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
}
/**
* Serialization only. Do not use.
* Instantiate an animation control with no skeleton, suitable only for
* animations that don't contain any bone tracks. Also used for
* serialization.
*/
public AnimControl() {
}
@ -144,6 +146,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Retrieve an animation from the list of animations.
*
* @param name The name of the animation to retrieve.
* @return The animation corresponding to the given name, or null, if no
* such named animation exists.
@ -155,6 +158,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Adds an animation to be available for playing to this
* <code>AnimControl</code>.
*
* @param anim The animation to add.
*/
public void addAnim(Animation anim) {
@ -163,6 +167,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Remove an animation so that it is no longer available for playing.
*
* @param anim The animation to remove.
*/
public void removeAnim(Animation anim) {
@ -231,6 +236,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Adds a new listener to receive animation related events.
*
* @param listener The listener to add.
*/
public void addListener(AnimEventListener listener) {
@ -244,6 +250,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Removes the given listener from listening to events.
*
* @param listener
* @see AnimControl#addListener(com.jme3.animation.AnimEventListener)
*/
@ -308,6 +315,7 @@ public final class AnimControl extends AbstractControl implements Cloneable, Jme
/**
* Returns the length of the given named animation.
*
* @param name The name of the animation
* @return The length of time, in seconds, of the named animation.
*/

View File

@ -1527,7 +1527,11 @@ public class Mesh implements Savable, Cloneable, JmeCloneable {
}
public MorphTarget[] getMorphTargets() {
return morphTargets.getArray();
if (morphTargets == null) {
return new MorphTarget[0];
} else {
return morphTargets.getArray();
}
}
/**

View File

@ -55,7 +55,7 @@ public class Line extends Mesh {
/**
* No-argument constructor needed by SavableClassUtil.
*/
public Line() { // TODO protected
protected Line() {
}
public Line(Vector3f start, Vector3f end) {
@ -69,7 +69,6 @@ public class Line extends Mesh {
setBuffer(Type.Position, 3, new float[]{start.x, start.y, start.z,
end.x, end.y, end.z,});
setBuffer(Type.TexCoord, 2, new float[]{0, 0,
1, 1});

View File

@ -24,35 +24,107 @@ ext {
task configureVersionInfo {
try {
// Users can configure behavior by setting properties on the command
// line:
//
// jmeVersionName:
// If set this will override all automatic version detection.
//
// useCommitHashAsVersionName:
// If there is no jmeVersionName set and the current commit has no
// specific tag then setting this to 'true' will cause the version to
// be the full commit ID.
//
// includeBranchInVersion:
// Set to true if a non-master branch name should be included in the automatically
// generated version.
def grgit = Grgit.open(project.file('.'))
def head = grgit.head()
jmeRevision = grgit.log(includes: [head]).size()
jmeGitHash = head.id
jmeShortGitHash = head.abbreviatedId
jmeBranchName = grgit.branch.current.name
jmeGitTag = grgit.tag.list().find { it.commit == head }
if(jmeVersionName==""){
if (jmeGitTag != null) {
jmeGitTag = jmeGitTag.name
jmeFullVersion = jmeGitTag
jmeVersionTag = ""
} else {
if(useCommitHashAsVersionName=="true"&&jmeGitHash!=null&&!jmeGitHash.equals("")){
jmeFullVersion = jmeGitHash
jmeVersionTag = ""
}else{
jmeFullVersion="${jmeVersion}-";
if(jmeBranchName!="master")jmeFullVersion+="${jmeBranchName}-";
jmeFullVersion+="SNAPSHOT"
jmeVersionTag="SNAPSHOT"
}
}
}else{
jmeVersionTag=""
jmeFullVersion=jmeVersionName
// This code will find an exact-match tag if the current
// commit is the same as the tag commit.
jmeGitTag = grgit.tag.list().find { it.commit == head }
def latestTag;
if( jmeGitTag ) {
// Just use the name. We keep jmeGitTag separate because there
// is some logic that wants to know if this specific commit has
// a tag versus 'whatever tag we are a child of'... which is what
// 'latestTag' will be.
jmeGitTag = jmeGitTag.name
latestTag = jmeGitTag;
} else {
// Use describe to find the most recent tag. Unfortunately,
// in this version of grgit, we don't have the 'always' options
// so we can't make as many assumptions about the format of the
// string.
// If the commit is an exact match then it will return just the
// tag name... else it will be tagName-commitCount-abbreviatedId
// We'll use some groovy regex magic to get the tag either way.
def describe = grgit.describe()
def fullDescribe = (describe =~/(.*?)-(\d+)-g$jmeShortGitHash/)
latestTag = fullDescribe ? fullDescribe[0][1] : describe
println "Latest tag:" + latestTag
}
// We could enhance this with some more regex if we wanted to sanity
// check that it was formatted like our versions.
def tagVersion = (latestTag =~/v?(.*)/)[0][1];
// If the branch is not master then use the tag.
if( jmeBranchName != "master" ) {
jmeVersion = tagVersion
}
// Parse out just the base version part. -SNAPSHOT versions
// shouldn't really include our release suffixes
def baseVersion = (tagVersion =~/(\d+\.\d+.\d+)/)
baseVersion = baseVersion.size() > 0 ? baseVersion[0][0] : tagVersion
if( !jmeVersionName ) {
// If there is a specific tag for the top commit then we always
// use that.
if( jmeGitTag ) {
println "Using GIT tag as version"
jmeFullVersion = tagVersion; // already cleaned up
jmeVersionTag = "" // and no SNAPSHOT suffix for an exact version tag
// Note: this will not automatically add SNAPSHOT if the user has
// local changes that they haven't committed. Technically, only
// real CI builds should be using non-SNAPSHOT versions so we may
// eventually want to change the script to always use -SNAPSHOT with
// a CI option to turn it off.
// We could also check the grgit.status for unstaged modified/removed files.
// def unstaged = grgit.status().unstaged;
// def modCount = unstaged.modified.size() + unstaged.removed.size()
// ...but that seems like a wasteful check considering only official
// version builds should not have a -SNAPSHOT.
} else if( useCommitHashAsVersionName == "true" && jmeGitHash ) {
// The user has opted to use the hash... and we actually have
// a hash.
println "Using commit ID as version"
jmeFullVersion = jmeGitHash;
jmeVersionTag = ""
} else {
println "Auto-detecting version"
jmeVersionTag = "SNAPSHOT"
if( includeBranchInVersion == "true" && jmeBranchName != "master" ) {
jmeFullVersion = baseVersion + "-" + jmeBranchName + "-" + jmeVersionTag;
} else {
jmeFullVersion = baseVersion + "-" + jmeVersionTag;
}
}
} else {
// Just use defaults
println "Using user-defined version"
jmeFullVersion=jmeVersionName
jmeVersionTag = "SNAPSHOT"
}
println("Revision: ${jmeRevision}")
println("Hash: ${jmeGitHash}")
@ -61,7 +133,8 @@ task configureVersionInfo {
println("Build Date: ${jmeBuildDate}")
println("Build Branch: ${jmeBranchName}")
println("Use commit hash as version ${useCommitHashAsVersionName}")
println("Build Tag: ${jmeVersionTag}")
println("Base Version: ${baseVersion}")
println("Build Suffix: ${jmeVersionTag}")
println("Build Version: ${jmeFullVersion}")
} catch (ex) {