-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 2025toolchains
- Loading branch information
Showing
13 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../wpi/first/toolchain/roborio/FrcHome.java → ...java/edu/wpi/first/toolchain/FrcHome.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...Plugin/src/main/java/edu/wpi/first/toolchain/systemcore/SystemCoreToolchainExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package edu.wpi.first.toolchain.systemcore; | ||
|
||
import javax.inject.Inject; | ||
|
||
import edu.wpi.first.toolchain.opensdk.OpenSdkToolchainExtension; | ||
|
||
public abstract class SystemCoreToolchainExtension extends OpenSdkToolchainExtension { | ||
public static final String TOOLCHAIN_VERSION = "2025-12.2.0"; | ||
public static final String INSTALL_SUBDIR = "systemcore"; | ||
|
||
@Inject | ||
public SystemCoreToolchainExtension() { | ||
super(); | ||
getVersionLow().convention("12.2.0"); | ||
getVersionHigh().convention("12.2.0"); | ||
getToolchainVersion().convention(TOOLCHAIN_VERSION); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...ainPlugin/src/main/java/edu/wpi/first/toolchain/systemcore/SystemCoreToolchainPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package edu.wpi.first.toolchain.systemcore; | ||
|
||
import java.io.File; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.provider.Provider; | ||
import org.gradle.process.ExecOperations; | ||
|
||
import edu.wpi.first.toolchain.FrcHome; | ||
import edu.wpi.first.toolchain.NativePlatforms; | ||
import edu.wpi.first.toolchain.ToolchainDescriptor; | ||
import edu.wpi.first.toolchain.ToolchainDiscoverer; | ||
import edu.wpi.first.toolchain.ToolchainExtension; | ||
import edu.wpi.first.toolchain.configurable.CrossCompilerConfiguration; | ||
import edu.wpi.first.toolchain.opensdk.OpenSdkToolchainBase; | ||
|
||
public class SystemCoreToolchainPlugin implements Plugin<Project> { | ||
|
||
public static final String toolchainName = "systemCore"; | ||
public static final String baseToolchainName = "arm64-bookworm"; | ||
|
||
private SystemCoreToolchainExtension systemcoreExt; | ||
private Project project; | ||
private OpenSdkToolchainBase opensdk; | ||
private ExecOperations operations; | ||
|
||
@Inject | ||
public SystemCoreToolchainPlugin(ExecOperations operations) { | ||
this.operations = operations; | ||
} | ||
|
||
@Override | ||
public void apply(Project project) { | ||
this.project = project; | ||
|
||
systemcoreExt = project.getExtensions().create("systemcoreToolchain", SystemCoreToolchainExtension.class); | ||
|
||
ToolchainExtension toolchainExt = project.getExtensions().getByType(ToolchainExtension.class); | ||
|
||
opensdk = new OpenSdkToolchainBase(baseToolchainName, systemcoreExt, project, | ||
SystemCoreToolchainExtension.INSTALL_SUBDIR, "bookworm", project.provider(() -> "aarch64-bookworm-linux-gnu"), toolchainExt.getToolchainGraphService(), operations); | ||
|
||
CrossCompilerConfiguration configuration = project.getObjects().newInstance(CrossCompilerConfiguration.class, NativePlatforms.systemcore); | ||
|
||
configuration.getArchitecture().set("arm64"); | ||
configuration.getOperatingSystem().set("linux"); | ||
configuration.getCompilerPrefix().set(""); | ||
configuration.getOptional().convention(true); | ||
|
||
ToolchainDescriptor descriptor = new ToolchainDescriptor( | ||
project, | ||
toolchainName, | ||
toolchainName + "Gcc", | ||
configuration.getOptional()); | ||
descriptor.getToolchainPlatform().set(NativePlatforms.systemcore); | ||
descriptor.getVersionLow().set(systemcoreExt.getVersionLow()); | ||
descriptor.getVersionHigh().set(systemcoreExt.getVersionHigh()); | ||
configuration.getToolchainDescriptor().set(descriptor); | ||
|
||
toolchainExt.getCrossCompilers().add(configuration); | ||
|
||
populateDescriptor(descriptor); | ||
} | ||
|
||
public void populateDescriptor(ToolchainDescriptor descriptor) { | ||
Provider<File> fp = project.provider(() -> { | ||
String year = systemcoreExt.getToolchainVersion().get().split("-")[0].toLowerCase(); | ||
File frcHomeLoc = new File(new FrcHome(year).get(), "systemcore"); | ||
return frcHomeLoc; | ||
}); | ||
|
||
// Add FRC Home first, as we want it searched first | ||
descriptor.getDiscoverers().add(ToolchainDiscoverer.createProperty("FRCHome", descriptor, fp, opensdk::composeTool, project)); | ||
|
||
opensdk.populatePathAndDownloadDescriptors(descriptor); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...inPlugin/src/test/groovy/edu/wpi/first/toolchain/systemcore/SystemCoreDownloadTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package edu.wpi.first.toolchain.systemcore | ||
|
||
import org.gradle.testkit.runner.GradleRunner | ||
import static org.gradle.testkit.runner.TaskOutcome.* | ||
import edu.wpi.first.toolchain.opensdk.OpenSdkToolchainBase | ||
|
||
import spock.lang.Shared | ||
import spock.lang.TempDir | ||
import spock.lang.Specification | ||
import spock.lang.IgnoreIf | ||
|
||
@IgnoreIf({ !Boolean.valueOf(env['SPOCK_RUN_TOOLCHAINS']) }) | ||
class Arm64DownloadTest extends Specification { | ||
@TempDir File testProjectDir | ||
File buildFile | ||
@Shared File toolchainDir | ||
|
||
def setup() { | ||
buildFile = new File(testProjectDir, 'build.gradle') | ||
} | ||
|
||
def setupSpec() { | ||
String year = SystemCoreToolchainExtension.TOOLCHAIN_VERSION.split("-")[0].toLowerCase(); | ||
toolchainDir = OpenSdkToolchainBase.toolchainInstallLoc(year, SystemCoreToolchainExtension.INSTALL_SUBDIR); | ||
def result = toolchainDir.deleteDir() // Returns true if all goes well, false otherwise. | ||
assert result | ||
} | ||
|
||
def "Toolchain Can Download"() { | ||
given: | ||
buildFile << """plugins { | ||
id 'cpp' | ||
id 'edu.wpi.first.Toolchain' | ||
} | ||
toolchainsPlugin.withCrossSystemCore() | ||
""" | ||
when: | ||
def result = GradleRunner.create() | ||
.withProjectDir(testProjectDir) | ||
.withArguments('installSystemCoreToolchain', '--stacktrace') | ||
.withPluginClasspath() | ||
.build() | ||
|
||
then: | ||
result.task(':installSystemCoreToolchain').outcome == SUCCESS | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters