Skip to content

Ant scripts for projects that use Strongback #10

Closed

Description

@rhauch

When the WPILib Eclipse plugin creates robot projects, it sets up an Ant script that will build the JAR file for the robot and allow the developer to deploy the code to the robot.

We want to tie into this same build system so that building and deploying the project includes the strongback library, and enables running the tests. This may include defining a fragment to be inserted into the build.xml file and a few properties to be defined in the build.properties file. (For an example of what FRC Team 4931 did last year, see their build.xml and build.properties files.)

The strongback executable described in issue #6 may also be able to support automatically modifying a project, via:

strongback add-project <path-to-eclipse-project-dir>

Activity

  1. rhauch commented on Sep 14, 2015

    @rhauch
    MemberAuthor

    @Zabot suggested also using an Eclipse "User Library" rather than a "Classpath Variable". Each user library can define multiple JARs with source code (so more powerful than classpath variables), but changing a project to use user libraries and classpath variables is very similar.

    In fact, when the strongback add-project command is run, it can find the location of the Strongback distribution (worse comes to worse, we can look at the $PATH environment variable or if its not in the path look in the current directory). It can then automatically update the user's User Libraries, which is stored inside the .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs file (a properties file) in a property named org.eclipse.jdt.core.userLibrary.wpi. (We'd have to be sure to only add to the user libraries, not overwrite what they already have!) The value of the property contains a string representation of an XML document (with new line and tab characters), so the property in the org.eclipse.jdt.core.prefs file looks something like this:

    org.eclipse.jdt.core.userLibrary.wpi=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<eclipse-userlibraries version\="2">\n\t<library name\="strongback" systemlibrary\="false">\n\t\t<archive javadoc\="file:/Users/jsmith/strongback/javadoc/" path\="/Users/jsmith/strongback/lib/strongback.jar" source\="/Users/jsmith/strongback/lib/strongback-sources.jar"/>\n\t</library>\n\t<library name\="strongback-testing" systemlibrary="false">\n\t\t<archive javadoc\="file:/Users/jsmith/strongback/javadoc/" path\="/Users/jsmith/strongback/lib-tests/strongback-testing.jar" source\="/Users/jsmith/strongback/lib-tests/strongback-testing-sources.jar"/>\n\t</library>\n
    </eclipse-userlibraries>
    

    where the normal XML document would looks something like this:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <eclipse-userlibraries version="2">
        <library name="strongback" systemlibrary="false">
            <archive javadoc="file:/Users/jsmith/strongback/javadoc/" path="/Users/jsmith/strongback/lib/strongback.jar" source="/Users/jsmith/strongback/lib/strongback-sources.jar"/>
        </library>
        <library name="strongback-testing" systemlibrary="false">
            <archive javadoc="file:/Users/jsmith/strongback/javadoc/" path="/Users/jsmith/strongback/lib-tests/strongback-testing.jar" source="/Users/jsmith/strongback/lib-tests/strongback-testing-sources.jar"/>
        </library>
    </eclipse-userlibraries>
    

    The command would then modify the project's .classpath file to add the strongback and strongback-testing user libraries.

  2. added a commit that references this issue on Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions