-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
73772e5
to
f7f3cd2
Compare
binaries { | ||
withType(SharedLibraryBinarySpec) { binary -> | ||
if (binary.component.name == 'ntcoreJNI') { | ||
from(binary.sharedLibraryFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this cause this to get resolved eagerly at configuration time? Don't you want this to get resolved at task runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not. The native builds handle eagerly configuring this. It does get resolved at runtime.
config.gradle
Outdated
|
||
def buildAll = project.hasProperty('buildAll') | ||
|
||
def windows64PlatformDetect = { config-> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this closure take an arg but never use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always forget in gradle you can ignore closure arguments. There are other cases where that config is used, but I can remove it from here.
publish.gradle
Outdated
project(':arm:wpiutil').build.dependsOn outputVersions | ||
project(':arm:ntcore').build.dependsOn outputVersions | ||
} | ||
def licenseFile = new File("$rootDir/license.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just use file("$rootDir/license.txt")
publish.gradle
Outdated
model { | ||
tasks { | ||
it.each { | ||
if (it.name.contains('jniHeaders')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might also want to check that the type is a CopySpec
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the task it is looking at is not a copy task, so that doesn't work. This is one of the few cases where it is just hard to get something out of the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What type is it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/wpilibsuite/native-utils/blob/master/src/main/groovy/edu/wpi/first/nativeutils/rules/JNIConfigRules.groovy#L40
It's just a Task, it doesn't inherit from anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading through that code, just as an aside, its much better practice to create types for your tasks. Doing so allows you to use the annotations @Input
, @InputDirectory
, @Output
, @OutputDirectory
ect... That allow your build to do things better with task avoidance (speeding up the build).
Additionally, doing so would allow you to take advantage of the new gradle build cache where you can share the output of tasks on a central server (or even on your personal machine) to avoid running tasks that you've already run before.
Additionally, I worry that the lack of any sort of type system here will make this code unmaintainable by anyone in the future. Without a solid set of tests to prove that what the build is creating is correct it's much harder for new developers to dive in without the fear of breaking something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are the annotations different from just declaring Inputs and Outputs on the task, which I already do. Also, until all the native stuff supports the build cache (which none of it does currently), I don't think its necessary to take the extra work. I do agree that adding a custom type for this might be a good idea however. I just wish the team had commented on this weeks ago when I asked for help and suggestions rather then waiting until we were wanting to merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JLLeitschuh I created custom types for my tasks. I didn't add anything to them, since the default task worked just fine, but it does let me do type checking.
publish.gradle
Outdated
if (project.hasProperty('makeDesktop')) { | ||
artifact nat.ntcoreZip, { | ||
classifier = 'desktop' | ||
def createComponentZipTasks = { components, name, base, type, project, func -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe turn this into a more strongly typed groovy function instead of using a closure since there are so many inputs? It would help others read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Something similar to this is used in most of the repo's, so thats a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to pass on this, because I use a few script globals, and switching to a function breaks that, with the workarounds looking super hacky
src/test/java/TestClass.java
Outdated
public class TestClass { | ||
@Test | ||
public void generalTestCase() { | ||
assertEquals(true, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this testing? Perhaps a bit more documentation if you are actually expecting something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was more to verify that tests were actually running, and the test below is to make sure the JNI linking actually works. I'll remove the general one, and move the JNI one to it's own package.
src/test/java/TestClass.java
Outdated
@@ -0,0 +1,17 @@ | |||
import org.junit.BeforeClass; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be in the default package. This is not really done even in test systems. You should put this test in its own package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will move it.
67288bf
to
d2b3077
Compare
public static final int NT_NET_MODE_CLIENT = 0x02; | ||
public static final int NT_NET_MODE_STARTING = 0x04; | ||
public static final int NT_NET_MODE_FAILURE = 0x08; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an unintentional revert. Are you synced up to the latest master?
@@ -154,7 +136,6 @@ else if (System.getProperty("os.name").startsWith("Mac")) | |||
// public static native byte[] getRpcResultNonblocking(int callUid) throws RpcNoResponseException; | |||
|
|||
public static native void setNetworkIdentity(String name); | |||
public static native int getNetworkMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
publish.gradle
Outdated
|
||
task outputVersions() { | ||
description = 'Prints the versions of ntcore and wpiutil to a file for use by the downstream packaging project' | ||
description = 'Prints the versions of wpiutil to a file for use by the downstream packaging project' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/wpiutil/ntcore/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
build.gradle
Outdated
|
||
apply from: 'publish.gradle' | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '3.3' | ||
gradleVersion = '4.0.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we bump to 4.0.2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
ac7409f
to
d2fe992
Compare
publish.gradle
Outdated
it.each { | ||
if (it.name.contains('jniHeaders')) { | ||
from (it.outputs.files) { | ||
into '/' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this execute? It looks like it runs during task configuration time, not at task run time? Is that what you want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does execute at run time. Otherwise copy and zip tasks would be absolutely useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how that's possible? It seems like the receiver of the call to from
is project
not the task. As you said above, the task is of type DefaultTask
which doesn't have a from
method on it.
If the receiver of the from
call is project
then it would be executed immediately.
What is the receiver of the from
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cppSourcesZip. GitHub is just splitting the lines wierdly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooooh. That makes so much more sense.
Fixes mac builds Updates plugin to fix mac builds Removes unnecessary closure variable Plugin 1.2.4 Updates plugin to 1.2.5 Uses plugin .6 plugin 1.7 Plugin 1.2.8 Fixes review issues
Jenkins will fail until I update the scripts there, which I will do in a bit.