Skip to content

Commit

Permalink
Clean up and fix everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 authored and PeterJohnson committed Oct 20, 2024
1 parent 66e2046 commit 4ab32a0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 161 deletions.
91 changes: 30 additions & 61 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,9 @@ jobs:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
build-options: "-Pplatform=linux-athena"
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
artifact-name: Arm32
build-options: "-Pplatform=linux-arm32"
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
artifact-name: Arm64
build-options: "-Pplatform=linux-arm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: ""
build-options: -Pplatform=x64-linux

name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-latest
Expand All @@ -34,14 +25,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'true'
- run: sudo apt-get update && sudo apt-get install ant -y && sudo rm -rf /var/lib/apt/lists/* && sudo rm -f /bin/ant && sudo ln -s /usr/share/ant/bin/ant /bin/ant
name: Install Ant
- run: rm -rf /usr/local/arm-linux-gnueabihf && curl -SL https://github.com/wpilibsuite/opensdk/releases/download/v2023-9/armhf-raspi-bullseye-2023-x86_64-linux-gnu-Toolchain-10.2.0.tgz | sh -c 'mkdir -p /usr/local && cd /usr/local && tar xzf - --strip-components=2'
name: Replace arm32 compiler
if: matrix.artifact-name == 'Arm32'
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: '29b2ea2d4b6197e66ef346e62ccbba35b55b7de5'
- run: vcpkg install
name: install packages
Expand All @@ -57,24 +46,12 @@ jobs:
fail-fast: false
matrix:
include:
- artifact-name: Win64Release
architecture: x64
build-options: "-PskipDebug"
- artifact-name: Win32Release
architecture: x86
build-options: "-PskipDebug"
- artifact-name: WinArm64Release
architecture: x64
build-options: "-PskipDebug -Pplatform=windows-arm64"
- artifact-name: Win64
architecture: x64
build-options: "-PskipRelease -PskipSources"
- artifact-name: Win32
architecture: x86
build-options: "-PskipRelease -PskipSources"
- artifact-name: WinArm64
architecture: x64
build-options: "-PskipRelease -PskipSources -Pplatform=windows-arm64"
tool-arch: amd64_arm64
build-options: -Pplatform=arm64-windows
- artifact-name: Win64
tool-arch: amd64
build-options: -Pplatform=x64-windows

name: "Build - ${{ matrix.artifact-name }}"
runs-on: windows-2019
Expand All @@ -84,27 +61,21 @@ jobs:
submodules: 'true'
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
architecture: ${{ matrix.architecture }}
- name: Set Java Heap Size
run: sed -i 's/-Xmx2g/-Xmx1g/g' gradle.properties
if: matrix.architecture == 'x86'
java-version: 17
distribution: 'temurin'
- uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: '29b2ea2d4b6197e66ef346e62ccbba35b55b7de5'
- run: vcpkg install
- uses: ilammy/[email protected]
with:
arch: ${{ matrix.tool-arch }}
- run: vcpkg install --triplet=arm64-windows
name: install packages
- run: |
cd vcpkg_installed
ls
name: show
- run: |
@call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
set PATH=%PATH%;%ANT_HOME%\bin
gradlew publish ${{ matrix.build-options }}
shell: cmd
if: matrix.artifact-name == 'WinArm64'
- run: vcpkg install --triplet=x64-windows
name: install packages
if: matrix.artifact-name == 'Win64'
- run: ./gradlew publish ${{ matrix.build-options }}
name: Build with Gradle
- uses: actions/upload-artifact@v4
with:
Expand All @@ -120,17 +91,16 @@ jobs:
submodules: 'true'
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
- run: brew install cmake ninja
name: install ninja
- uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: '29b2ea2d4b6197e66ef346e62ccbba35b55b7de5'
- run: vcpkg install
- run: vcpkg install --triplet=x64-osx
name: install packages
- run: ./gradlew publish
- run: ./gradlew publish -Pplatform=x64-osx
name: Build with Gradle
- uses: actions/upload-artifact@v4
with:
Expand All @@ -146,17 +116,16 @@ jobs:
submodules: 'true'
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
- run: brew install cmake ninja
name: install ninja
- uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: '29b2ea2d4b6197e66ef346e62ccbba35b55b7de5'
- run: vcpkg install
- run: vcpkg install --triplet=arm64-osx
name: install packages
- run: ./gradlew publish -Pforcealternatemacbuild
- run: ./gradlew publish -Pplatform=arm64-osx
name: Build with Gradle
- uses: actions/upload-artifact@v4
with:
Expand All @@ -179,7 +148,7 @@ jobs:
path: build/downloads
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- run: ./gradlew copyToUpload -Prunmerge
name: Build with Gradle
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
apply from: 'publish.gradle'
if (project.hasProperty('runmerge')) {
apply from: 'merge.gradle'
} else {
apply from: 'publish.gradle'
}
4 changes: 1 addition & 3 deletions merge.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ def files = project.files(downloadsFolder)

def constantNames = [
'version.txt',
'ceres-cpp_CLS-headers.zip',
'ceres-cpp_CLS-osxarm64static.zip',
'ceres-cpp_CLSdebug-osxarm64staticdebug.zip'
'ceres-cpp_CLS-headers.zip'
]

def constantFiles = []
Expand Down
118 changes: 22 additions & 96 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,89 +21,41 @@ publishing {
}
}

def getPlatform() {
def platform
def os_name = System.getProperty("os.name")
def os_arch = System.getProperty("os.arch")

if (os_arch == 'amd64') {
os_arch = 'x86_64'
} else if (os_arch == 'i386') {
os_arch = 'x86'
} else if (os_arch == 'aarch64' || os_arch == 'arm64') {
os_arch = 'arm64'
}

if (OperatingSystem.current().isWindows()) {
platform = "windows-${os_arch}"
} else if (OperatingSystem.current().isLinux()) {
platform = "linux-${os_arch}"
} else if (OperatingSystem.current().isMacOsX()) {
platform = "osx-${os_arch}"
} else {
platform = "${os_name}-${os_arch}"
}
return platform
}

def getTriplet() {
def platform
def os_name = System.getProperty("os.name")
def os_arch = System.getProperty("os.arch")
def triplet_arch = ""
def triplet_name = ""

if (os_arch == 'amd64') {
triplet_arch = "x64"
} else if (os_arch == 'i386') {
triplet_arch = "x86"
} else if (os_arch == 'aarch64' || os_arch == 'arm64') {
triplet_arch = "arm64"
} else {
triplet_arch = "x64"
def fileNameFinder = new FileNameFinder()
for (File folder : file("$projectDir/vcpkg_installed").listFiles()) {
if (folder.name == project.platform) {
println folder.name
return folder.name
}
}

if (OperatingSystem.current().isWindows()) {
triplet_name = "windows"
} else if (OperatingSystem.current().isLinux()) {
triplet_name = "linux"
} else if (OperatingSystem.current().isMacOsX()) {
triplet_name = "osx"
}
return triplet_arch + "-" + triplet_name
throw new RuntimeException("Platform not found");
}

def getPlatformPath(platform) {
if (platform == "linux-athena") {
return "linux/athena"
} else if (platform == "linux-arm32") {

def getPlatformPath(triplet) {
if (triplet == "arm32-linux") {
return "linux/arm32"
} else if (platform == "linux-arm64") {
} else if (triplet == "arm64-linux") {
return "linux/arm64"
} else if (platform == "linux-x86") {
return "linux/x86"
} else if (platform == "linux-x86_64") {
} else if (triplet == "x64-linux") {
return "linux/x86-64"
} else if (platform == "osx-x86") {
return "osx/x86"
} else if (platform == "osx-x86_64") {
} else if (triplet == "x64-osx") {
return "osx/x86-64"
} else if (platform == "osx-arm64") {
} else if (triplet == "arm64-osx") {
return "osx/arm64"
} else if (platform == "windows-x86") {
return "windows/x86"
} else if (platform == "windows-x86_64") {
} else if (triplet == "x64-windows") {
return "windows/x86-64"
} else if (platform == "windows-arm64") {
} else if (triplet == "arm64-windows") {
return "windows/arm64"
} else {
return ""
}
}

ext.platform = getPlatform()
ext.platformPath = getPlatformPath(ext.platform)
ext.platformClassifier = project.platform.replaceFirst('-', '').replace('_', '-')
ext.triplet = getTriplet()
ext.platformPath = getPlatformPath(ext.triplet)
ext.platformClassifier = ext.platformPath.replaceFirst('/', '')

ext.repo = "thirdparty-ceres"

Expand Down Expand Up @@ -150,23 +102,6 @@ task outputVersions() {
}
}

task cppSourcesZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = zipBaseName
archiveClassifier = "sources"

from(licenseFile) {
into '/'
}
def resolvedDir = Paths.get(projectDir.canonicalPath).resolve("vcpkg_installed").resolve("buildtrees")
from(resolvedDir.toFile()) {
into '/source'
include '**/*.cpp', '**/*.cc'
}

includeEmptyDirs = false
}

task cppHeadersZip(type: Zip) {
dependsOn outputVersions
destinationDirectory = outputsFolder
Expand Down Expand Up @@ -197,6 +132,7 @@ task cppLibsZipStatic(type: Zip) {
def resolvedDir = Paths.get(projectDir.canonicalPath).resolve("vcpkg_installed").resolve(triplet).resolve("lib")
from(resolvedDir.toFile()) {
into project.platformPath + '/static'
exclude '**/pkgconfig'
include '**/*.a'
include '**/*.lib'
include '**/*.pdb'
Expand All @@ -214,7 +150,8 @@ task cppLibsZipStaticDebug(type: Zip) {
}
def resolvedDir = Paths.get(projectDir.canonicalPath).resolve("vcpkg_installed").resolve(triplet).resolve("debug").resolve("lib")
from(resolvedDir.toFile()) {
into project.platformPath + '/debug/static'
into project.platformPath + '/static'
exclude '**/pkgconfig'
include '**/*.a'
include '**/*.lib'
include '**/*.pdb'
Expand All @@ -229,17 +166,6 @@ if (!project.hasProperty('skipDebug')) {
addTaskToCopyAllOutputs(cppLibsZipStaticDebug)
}

if (!project.hasProperty('skipSources')) {
addTaskToCopyAllOutputs(cppSourcesZip)
addTaskToCopyAllOutputs(cppHeadersZip)
}

if (project.hasProperty('runmerge')) {
apply from: 'merge.gradle'
}



model {
publishing {
publications {
Expand Down

0 comments on commit 4ab32a0

Please sign in to comment.