org.gradle.model.Finalize Java Examples

The following examples show how to use org.gradle.model.Finalize. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NativeBinariesTestPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Finalize
public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary;
        final BinaryNamingScheme namingScheme = binary.getNamingScheme();

        RunTestExecutable runTask = tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class);
        final Project project = runTask.getProject();
        runTask.setDescription(String.format("Runs the %s", binary.getNamingScheme().getDescription()));

        final InstallExecutable installTask = binary.getTasks().withType(InstallExecutable.class).iterator().next();
        runTask.getInputs().files(installTask.getOutputs().getFiles());
        runTask.setExecutable(installTask.getRunScript().getPath());
        runTask.setOutputDir(new File(project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase()));
    }
}
 
Example #2
Source File: NativeBinariesTestPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Finalize
public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary;
        final BinaryNamingScheme namingScheme = binary.getNamingScheme();

        RunTestExecutable runTask = tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class);
        final Project project = runTask.getProject();
        runTask.setDescription(String.format("Runs the %s", binary.getNamingScheme().getDescription()));

        final InstallExecutable installTask = binary.getTasks().withType(InstallExecutable.class).iterator().next();
        runTask.getInputs().files(installTask.getOutputs().getFiles());
        runTask.setExecutable(installTask.getRunScript().getPath());
        runTask.setOutputDir(new File(project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase()));
    }
}
 
Example #3
Source File: ComponentModelBasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize
void createSourceTransformTasks(final TaskContainer tasks, final BinaryContainer binaries, LanguageRegistry languageRegistry) {
    for (LanguageRegistration<?> language : languageRegistry) {
        for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
            final CreateSourceTransformTask createRule = new CreateSourceTransformTask(language);
            createRule.createCompileTasksForBinary(tasks, binary);
        }
    }
}
 
Example #4
Source File: ComponentModelBasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize
// Needs to run after NativeComponentModelPlugin.Rules.configureGeneratedSourceSets()
void applyDefaultSourceConventions(ProjectSourceSet sources) {
    for (FunctionalSourceSet functionalSourceSet : sources) {
        for (LanguageSourceSet languageSourceSet : functionalSourceSet) {
            // Only apply default locations when none explicitly configured
            if (languageSourceSet.getSource().getSrcDirs().isEmpty()) {
                languageSourceSet.getSource().srcDir(String.format("src/%s/%s", functionalSourceSet.getName(), languageSourceSet.getName()));
            }
        }
    }
}
 
Example #5
Source File: NativeBinariesTestPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize // Must run after test binaries have been created (currently in CUnit plugin)
void attachTestedBinarySourcesToTestBinaries(BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testSuiteBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpec testedBinary = testSuiteBinary.getTestedBinary();
        testSuiteBinary.source(testedBinary.getSource());

        for (DependentSourceSet testSource : testSuiteBinary.getSource().withType(DependentSourceSet.class)) {
            testSource.lib(testedBinary.getSource());
        }
    }
}
 
Example #6
Source File: AndroidComponentModelPlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Finalize
public void finalizeAndroidModel(AndroidConfig androidModel) {
    if (androidModel.getBuildToolsRevision() == null
            && androidModel.getBuildToolsVersion() != null) {
        androidModel.setBuildToolsRevision(
                FullRevision.parseRevision(androidModel.getBuildToolsVersion()));
    }

    if (androidModel.getCompileSdkVersion() != null
            && !androidModel.getCompileSdkVersion().startsWith("android-")
            && Ints.tryParse(androidModel.getCompileSdkVersion()) != null) {
        androidModel.setCompileSdkVersion("android-" + androidModel.getCompileSdkVersion());
    }

}
 
Example #7
Source File: ComponentModelBasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize
void createSourceTransformTasks(final TaskContainer tasks, final BinaryContainer binaries, LanguageRegistry languageRegistry) {
    for (LanguageRegistration<?> language : languageRegistry) {
        for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
            final CreateSourceTransformTask createRule = new CreateSourceTransformTask(language);
            createRule.createCompileTasksForBinary(tasks, binary);
        }
    }
}
 
Example #8
Source File: ComponentModelBasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize
// Needs to run after NativeComponentModelPlugin.Rules.configureGeneratedSourceSets()
void applyDefaultSourceConventions(ProjectSourceSet sources) {
    for (FunctionalSourceSet functionalSourceSet : sources) {
        for (LanguageSourceSet languageSourceSet : functionalSourceSet) {
            // Only apply default locations when none explicitly configured
            if (languageSourceSet.getSource().getSrcDirs().isEmpty()) {
                languageSourceSet.getSource().srcDir(String.format("src/%s/%s", functionalSourceSet.getName(), languageSourceSet.getName()));
            }
        }
    }
}
 
Example #9
Source File: NativeBinariesTestPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize // Must run after test binaries have been created (currently in CUnit plugin)
void attachTestedBinarySourcesToTestBinaries(BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testSuiteBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpec testedBinary = testSuiteBinary.getTestedBinary();
        testSuiteBinary.source(testedBinary.getSource());

        for (DependentSourceSet testSource : testSuiteBinary.getSource().withType(DependentSourceSet.class)) {
            testSource.lib(testedBinary.getSource());
        }
    }
}
 
Example #10
Source File: AndroidComponentModelPlugin.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Finalize
public void setDefaultSrcDir(
        @Path("android.sources") AndroidComponentModelSourceSet sourceSet) {
    sourceSet.setDefaultSrcDir();
}