ghidra/gradle/nativeProject.gradle
2023-04-27 07:53:20 -04:00

54 lines
2.0 KiB
Groovy

/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*****************************************************************************************
This file is a "mix-in" gradle script that individual gradle projects should include if they
have native code (C or C++).
A gradle project can add native code support by including the following it its build.gradle file:
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
*****************************************************************************************/
// These same settings are needed in the GPL native, so rather than duplicating this file, we will just call the other file
def projectRootDir = rootProject.projectDir.path
apply from: "$projectRootDir/GPL/nativeBuildProperties.gradle"
// Include and rename native projects' buildNative.gradle files to build.gradle in the distribution
// so a user can build or rebuild natives for their specific platform.
// NOTE: GPL projects' build.gradle files are already written to build their natives from a release,
// so we can just include their build.gradle as as-is.
rootProject.assembleDistribution {
def p = this.project
from (p.projectDir.toString()) {
if (p.projectDir.parentFile.name == "GPL") {
include "build.gradle"
}
else {
include "buildNatives.gradle"
rename "buildNatives.gradle", "build.gradle"
}
into { getZipPath(p) }
}
}
task cleanNatives {
File nativeOutputDir = file('build/os')
doFirst {
delete nativeOutputDir
}
}