Skip to content

Commit

Permalink
Testing actions pt.2 - manually depend on link tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rongmario committed Feb 9, 2024
1 parent 7c3a05b commit 5e169ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
gradle-version: current
- name: Execute Gradle build
run: ./gradlew natives:build
run: ./gradlew natives:actionsBuild
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
29 changes: 24 additions & 5 deletions natives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@ plugins {
id 'cpp-library'
}

def onWindows = Os.isFamily(Os.FAMILY_WINDOWS)
def onMac = Os.isFamily(Os.FAMILY_MAC)

library {

baseName = Os.isFamily(Os.FAMILY_WINDOWS) ? 'libImagineBreaker' : 'ImagineBreaker'
baseName = onWindows ? 'libImagineBreaker' : 'ImagineBreaker'

binaries.configureEach { CppSharedLibrary library ->
def compileTask = library.compileTask.get()

if (compileTask.name.contains("Release")) {
compileTask.debuggable(false)
}

binaries.configureEach { CppBinary binary ->
def compileTask = binary.compileTask.get()
compileTask.includes.from("${Jvm.current().javaHome}/include")

def osFamily = binary.targetPlatform.targetMachine.operatingSystemFamily
def osFamily = library.targetPlatform.targetMachine.operatingSystemFamily
if (osFamily.macOs) {
compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
} else if (osFamily.linux) {
Expand All @@ -24,7 +32,7 @@ library {

compileTask.source.from fileTree(dir: "src/main/c", include: "**/*.c")

def toolChain = binary.toolChain
def toolChain = library.toolChain
if (toolChain instanceof VisualCpp) {
compileTask.compilerArgs.addAll(["/TC"])
} else if (toolChain instanceof GccCompatibleToolChain) {
Expand All @@ -42,3 +50,14 @@ library {
]

}

tasks.register('actionsBuild') {
group 'build'
if (onWindows) {
dependsOn 'linkReleaseWindowsX86-64', 'linkReleaseWindowsX86'
} else if (onMac) {
dependsOn 'linkReleaseMacosX86-64', 'linkReleaseMacosX86'
} else {
dependsOn 'linkReleaseLinuxX86-64', 'linkReleaseLinuxX86'
}
}

0 comments on commit 5e169ce

Please sign in to comment.